/* Custom styles for ee-z platform */

/* Prevent premature mobile/tablet browser viewport pull-to-refresh completely */
html, body {
  overscroll-behavior-y: none !important;
  overscroll-behavior-x: none !important;
  overscroll-behavior: none !important;
}

#search-modal,
#search-results-list,
#primary-rail-sidebar,
#app-sidebar,
.sidebar-inner,
#sidebar-default-view,
#sidebar-search-view,
#main-content-pane,
#chat-scroll-area,
#chat-messages,
#chat-sessions-list,
#chat-input,
textarea,
input,
[class*="overflow-y-auto"],
[class*="overflow-x-auto"],
[data-scrollable],
.modal,
[id*="modal"] {
  overscroll-behavior-y: none !important;
  overscroll-behavior-x: none !important;
  overscroll-behavior: none !important;
}

textarea,
input,
#chat-input {
  touch-action: pan-y pan-x !important;
}

:root {
  --primary: #055b7f;
  --primary-hover: #044b6a;
  --primary-light: #edf7fa;
  --accent: #055b7f;
  --radius-min: 2px;
}

.dark {
  --primary: #055b7f;
  --primary-hover: #3da3c4;
  --primary-light: #011722;
  --accent: #3da3c4;
}

/* Logo instant visibility by theme without JS flash */
html.dark .eez-logo-light { display: none !important; }
html.dark .eez-logo-dark { display: inline-block !important; }
html:not(.dark) .eez-logo-light { display: inline-block !important; }
html:not(.dark) .eez-logo-dark { display: none !important; }

/* =====================================================================
   Pure Flat Design System: Global Elimination of All Shadows
   Enforces a clean, modern, flat aesthetic across all components:
   sidebars, modals, cards, buttons, dropdowns, inputs, tables, badges.
===================================================================== */
*,
*::before,
*::after {
  --tw-shadow: 0 0 #0000 !important;
  --tw-shadow-colored: 0 0 #0000 !important;
  box-shadow: none !important;
  text-shadow: none !important;
}

[class*="shadow"] {
  --tw-shadow: 0 0 #0000 !important;
  --tw-shadow-colored: 0 0 #0000 !important;
  box-shadow: none !important;
}

/* System-Wide Minimum Border Radius Enforcement */
*, ::before, ::after {
  --tw-border-opacity: 1;
}

button, input, select, textarea, kbd,
.btn, .badge, .card, .pill,
.cat-pill, .amount-btn, .ratio-btn,
[class*="rounded-"] {
  border-radius: var(--radius-min) !important;
}

.rounded-none {
  border-radius: 0px !important;
}

/* Selection Color with Brand Blue */
::selection {
  background-color: #055b7f !important;
  color: #ffffff !important;
}

/* Hide native number input spinners across all browsers */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none !important;
  margin: 0 !important;
}
input[type="number"] {
  -moz-appearance: textfield !important;
}

/* =====================================================================
   Modern Disappearing / Hover-Activated Floating Scrollbars
   - Invisible / transparent when mouse is not hovering
   - Smooth fade-in on hover
   - Floats beside the box without shifting container width
   - Applied to main page content, body, 1st & 2nd sidebars, and all scroll areas
===================================================================== */

/* Firefox standard properties */
html, body,
#main-content-pane,
#primary-rail-sidebar,
#app-sidebar,
.sidebar-inner,
#chat-sessions-list,
#chat-messages,
#sidebar-search-results,
[class*="overflow-y-auto"],
[class*="overflow-x-auto"] {
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
  transition: scrollbar-color 0.3s ease;
}

html:hover, body:hover,
#main-content-pane:hover,
#primary-rail-sidebar:hover,
#app-sidebar:hover,
.sidebar-inner:hover,
#chat-sessions-list:hover,
#chat-messages:hover,
#sidebar-search-results:hover,
[class*="overflow-y-auto"]:hover,
[class*="overflow-x-auto"]:hover {
  scrollbar-color: rgba(5, 91, 127, 0.45) transparent;
}

.dark html:hover, .dark body:hover,
.dark #main-content-pane:hover,
.dark #primary-rail-sidebar:hover,
.dark #app-sidebar:hover,
.dark .sidebar-inner:hover,
.dark #chat-sessions-list:hover,
.dark #chat-messages:hover,
.dark #sidebar-search-results:hover,
.dark [class*="overflow-y-auto"]:hover,
.dark [class*="overflow-x-auto"]:hover {
  scrollbar-color: rgba(61, 163, 196, 0.45) transparent;
}

/* WebKit / Chromium / Edge / Safari / Electron floating overlay scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
  background-color: transparent;
}

::-webkit-scrollbar-track {
  background: transparent !important;
}

/* Normal state: Thumb is 100% transparent/invisible */
::-webkit-scrollbar-thumb {
  background-color: transparent;
  border-radius: 3px !important;
  transition: background-color 0.25s ease-in-out;
}

/* Hover state: Thumb appears smoothly when container is hovered */
*:hover::-webkit-scrollbar-thumb {
  background-color: rgba(5, 91, 127, 0.4);
}

.dark *:hover::-webkit-scrollbar-thumb {
  background-color: rgba(61, 163, 196, 0.4);
}

/* Direct hover on thumb itself */
::-webkit-scrollbar-thumb:hover {
  background-color: rgba(5, 91, 127, 0.8) !important;
}

.dark ::-webkit-scrollbar-thumb:hover {
  background-color: rgba(61, 163, 196, 0.8) !important;
}

/* =====================================================================
   Touch Device Scrollbars (Mobile & Tablet): Visible, Comfortable 10px Width, Grabbable Thumb
   Users can easily see where they are and drag the thumb up and down with fingers
===================================================================== */
@media (pointer: coarse), (hover: none), (max-width: 1024px) {
  html, body,
  #main-content-pane,
  #primary-rail-sidebar,
  #app-sidebar,
  .sidebar-inner,
  #chat-sessions-list,
  #chat-scroll-area,
  #search-results-list,
  [class*="overflow-y-auto"],
  [class*="overflow-x-auto"] {
    scrollbar-width: thin !important;
    scrollbar-color: rgba(148, 163, 184, 0.65) transparent !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-y pan-x !important;
  }

  .dark html, .dark body,
  .dark #main-content-pane,
  .dark #primary-rail-sidebar,
  .dark #app-sidebar,
  .dark .sidebar-inner,
  .dark #chat-sessions-list,
  .dark #chat-scroll-area,
  .dark #search-results-list,
  .dark [class*="overflow-y-auto"],
  .dark [class*="overflow-x-auto"] {
    scrollbar-color: rgba(100, 116, 139, 0.65) transparent !important;
  }

  ::-webkit-scrollbar {
    width: 10px !important;
    height: 10px !important;
    background-color: transparent !important;
  }

  ::-webkit-scrollbar-track {
    background: transparent !important;
  }

  ::-webkit-scrollbar-thumb {
    background-color: rgba(148, 163, 184, 0.65) !important;
    border-radius: 9999px !important;
    border: 2px solid transparent !important;
    background-clip: padding-box !important;
    min-height: 48px !important;
  }

  .dark ::-webkit-scrollbar-thumb {
    background-color: rgba(100, 116, 139, 0.65) !important;
  }

  ::-webkit-scrollbar-thumb:active,
  ::-webkit-scrollbar-thumb:hover {
    background-color: rgba(5, 91, 127, 0.85) !important;
  }

  .dark ::-webkit-scrollbar-thumb:active,
  .dark ::-webkit-scrollbar-thumb:hover {
    background-color: rgba(61, 163, 196, 0.85) !important;
  }
}

/* =====================================================================
   App Shell Layout (pages with sidebars: user panel & admin panel)
   - Viewport height locked to 100vh / 100dvh to prevent whole-window scroll
   - Both 1st and 2nd sidebars ALWAYS extend 100% to the bottom of the viewport
     regardless of whether main pane content is short or empty.
===================================================================== */
body.has-sidebar {
  height: 100vh !important;
  height: 100dvh !important;
  max-height: 100vh !important;
  max-height: 100dvh !important;
  overflow: hidden !important;
}

body.has-sidebar > header {
  height: 4rem !important;
  min-height: 4rem !important;
  max-height: 4rem !important;
  flex-shrink: 0 !important;
}

body.has-sidebar > main,
body.has-sidebar main {
  height: calc(100vh - 4rem) !important;
  height: calc(100dvh - 4rem) !important;
  min-height: calc(100vh - 4rem) !important;
  min-height: calc(100dvh - 4rem) !important;
  max-height: calc(100vh - 4rem) !important;
  max-height: calc(100dvh - 4rem) !important;
  flex: 1 1 0% !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}

/* Universal .hidden enforcement so display:none is NEVER overridden by flex or specificity,
   while allowing responsive Tailwind variant classes (sm:, md:, lg:, xl:) to function normally */
.hidden:not([class*="sm:"]):not([class*="md:"]):not([class*="lg:"]):not([class*="xl:"]),
[hidden] {
  display: none !important;
}

/* Explicit Navigation Bar Display Guarantees */
#main-top-nav {
  display: flex !important;
}
@media (max-width: 767px) {
  #main-top-nav {
    display: none !important;
  }
}
@media (min-width: 768px) {
  #mobile-quick-nav,
  #mobile-nav-toggle {
    display: none !important;
  }
}

/* App Shell row container inside main (strictly targeting the main workspace flex shell, NOT fixed overlay modals) */
body.has-sidebar main > div:not(.fixed):not([id*="modal"]) {
  height: 100% !important;
  min-height: 100% !important;
  max-height: 100% !important;
  width: 100% !important;
  display: flex !important;
  flex-direction: row !important;
  overflow: hidden !important;
  position: relative !important;
}

/* Modals inside main or body must remain fixed overlays covering the entire viewport */
.fixed.inset-0,
main > [id*="modal"],
main > .fixed {
  position: fixed !important;
  top: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  max-height: 100vh !important;
  z-index: 50 !important;
}

/* 1st Level Primary Rail Sidebar (6rem / 96px) with Independent Disappearing Scroll */
#primary-rail-sidebar {
  width: 6rem !important;
  min-width: 6rem !important;
  max-width: 6rem !important;
  height: 100% !important;
  min-height: 100% !important;
  max-height: 100% !important;
  flex-shrink: 0 !important;
  z-index: 35 !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: space-between !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  overscroll-behavior-y: none !important;
  overscroll-behavior: none !important;
  box-shadow: none !important;
}

/* 2nd Level Sidebar Transition & Content Container */
.sidebar-transition,
#app-sidebar {
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), min-width 0.3s cubic-bezier(0.4, 0, 0.2, 1), max-width 0.3s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.2s ease !important;
  overflow: hidden !important;
  height: 100% !important;
  min-height: 100% !important;
  max-height: 100% !important;
  flex-shrink: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: space-between !important;
  box-shadow: none !important;
}

#app-sidebar:not(.sidebar-collapsed) {
  width: 16rem !important;
  min-width: 16rem !important;
  max-width: 16rem !important;
}

#sidebar-default-view.hidden,
#sidebar-search-view.hidden,
.sidebar-inner.hidden,
#app-sidebar .hidden {
  display: none !important;
}

#app-sidebar > .sidebar-inner:not(.hidden),
#sidebar-search-view:not(.hidden),
#sidebar-default-view:not(.hidden) {
  width: 16rem !important;
  min-width: 16rem !important;
  max-width: 16rem !important;
  height: 100% !important;
  min-height: 0 !important;
  max-height: 100% !important;
  flex: 1 1 0% !important;
  flex-shrink: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: space-between !important;
  overflow: hidden !important;
}

#sidebar-default-view:not(.hidden) > div:first-child {
  flex: 1 1 0% !important;
  min-height: 0 !important;
  max-height: 100% !important;
}

#sidebar-default-view:not(.hidden) > div:last-child {
  flex-shrink: 0 !important;
  z-index: 10 !important;
}

#chat-sessions-list {
  flex: 1 1 0% !important;
  min-height: 0 !important;
  max-height: 100% !important;
  overflow-y: auto !important;
  overscroll-behavior-y: none !important;
  overscroll-behavior: none !important;
}

#sidebar-search-view:not(.hidden) > div:first-child {
  flex: 1 1 0% !important;
  min-height: 0 !important;
  max-height: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}

#sidebar-search-results {
  flex: 1 1 0% !important;
  min-height: 0 !important;
  max-height: 100% !important;
  overflow-y: auto !important;
  overscroll-behavior-y: none !important;
  overscroll-behavior: none !important;
}

#main-content-pane {
  flex: 1 1 0% !important;
  height: 100% !important;
  min-height: 100% !important;
  max-height: 100% !important;
  min-width: 0 !important;
  overscroll-behavior-y: none !important;
  overscroll-behavior: none !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  position: relative !important;
}

#main-content-pane.chat-main-pane,
#main-content-pane:has(#chat-scroll-area) {
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}

#chat-scroll-area {
  flex: 1 1 0% !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  overscroll-behavior-y: none !important;
  overscroll-behavior: none !important;
}

#chat-input-container {
  flex-shrink: 0 !important;
  position: relative !important;
  z-index: 20 !important;
  bottom: 0 !important;
}

#app-sidebar.sidebar-collapsed {
  width: 0 !important;
  min-width: 0 !important;
  max-width: 0 !important;
  border-width: 0 !important;
  border-color: transparent !important;
  padding: 0 !important;
  margin: 0 !important;
  overflow: hidden !important;
  pointer-events: none !important;
}

/* =====================================================================
   Mobile Portrait Adaptations (<= 767.98px portrait)
   Applies ONLY in portrait mode on small mobile screens.
   Reverts completely to normal in landscape or on larger screens.
===================================================================== */
#mobile-portrait-sidebar-toggle,
#mobile-portrait-sidebar-backdrop {
  display: none !important;
}

@media (max-width: 767.98px) and (orientation: portrait) {
  /* Both sidebars CLOSED: completely hide both sidebars */
  body:not(.mobile-portrait-sidebars-open) #primary-rail-sidebar,
  body:not(.mobile-portrait-sidebars-open) #app-sidebar {
    display: none !important;
    width: 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
    border-width: 0 !important;
    border-color: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
    pointer-events: none !important;
  }

  /* Both sidebars OPEN: overlay presentation matching desktop flat style */
  body.mobile-portrait-sidebars-open #primary-rail-sidebar {
    position: fixed !important;
    top: 4rem !important;
    bottom: 0 !important;
    height: calc(100vh - 4rem) !important;
    height: calc(100dvh - 4rem) !important;
    max-height: calc(100vh - 4rem) !important;
    max-height: calc(100dvh - 4rem) !important;
    min-height: 0 !important;
    z-index: 50 !important;
    width: 6rem !important;
    min-width: 6rem !important;
    max-width: 6rem !important;
    display: flex !important;
    box-shadow: none !important;
    filter: none !important;
    pointer-events: auto !important;
  }
  [dir="rtl"] body.mobile-portrait-sidebars-open #primary-rail-sidebar {
    right: 0 !important;
    left: auto !important;
    border-left: 1px solid rgba(226, 232, 240, 1) !important;
    border-right: none !important;
  }
  .dark [dir="rtl"] body.mobile-portrait-sidebars-open #primary-rail-sidebar {
    border-left: 1px solid rgba(30, 41, 59, 1) !important;
  }
  [dir="ltr"] body.mobile-portrait-sidebars-open #primary-rail-sidebar {
    left: 0 !important;
    right: auto !important;
    border-right: 1px solid rgba(226, 232, 240, 1) !important;
    border-left: none !important;
  }
  .dark [dir="ltr"] body.mobile-portrait-sidebars-open #primary-rail-sidebar {
    border-right: 1px solid rgba(30, 41, 59, 1) !important;
  }

  body.mobile-portrait-sidebars-open #app-sidebar {
    position: fixed !important;
    top: 4rem !important;
    bottom: 0 !important;
    height: calc(100vh - 4rem) !important;
    height: calc(100dvh - 4rem) !important;
    max-height: calc(100vh - 4rem) !important;
    max-height: calc(100dvh - 4rem) !important;
    min-height: 0 !important;
    z-index: 48 !important;
    width: 16rem !important;
    min-width: 16rem !important;
    max-width: calc(100vw - 6rem) !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    box-shadow: none !important;
    filter: none !important;
    pointer-events: auto !important;
  }
  [dir="rtl"] body.mobile-portrait-sidebars-open #app-sidebar {
    right: 6rem !important;
    left: auto !important;
    border-left: 1px solid rgba(226, 232, 240, 1) !important;
    border-right: none !important;
  }
  .dark [dir="rtl"] body.mobile-portrait-sidebars-open #app-sidebar {
    border-left: 1px solid rgba(30, 41, 59, 1) !important;
  }
  [dir="ltr"] body.mobile-portrait-sidebars-open #app-sidebar {
    left: 6rem !important;
    right: auto !important;
    border-right: 1px solid rgba(226, 232, 240, 1) !important;
    border-left: none !important;
  }
  .dark [dir="ltr"] body.mobile-portrait-sidebars-open #app-sidebar {
    border-right: 1px solid rgba(30, 41, 59, 1) !important;
  }

  /* Mobile Portrait Toggle Button: visible ONLY when sidebars are closed! */
  body:not(.mobile-portrait-sidebars-open) #mobile-portrait-sidebar-toggle {
    display: flex !important;
    z-index: 52 !important;
  }
  [dir="rtl"] body:not(.mobile-portrait-sidebars-open) #mobile-portrait-sidebar-toggle {
    right: 0 !important;
    left: auto !important;
  }
  [dir="ltr"] body:not(.mobile-portrait-sidebars-open) #mobile-portrait-sidebar-toggle {
    left: 0 !important;
    right: auto !important;
  }

  /* When both sidebars are OPEN: hide floating toggle button completely (rail has its own toggle button) */
  body.mobile-portrait-sidebars-open #mobile-portrait-sidebar-toggle {
    display: none !important;
  }

  /* Backdrop Overlay when sidebars open */
  body.mobile-portrait-sidebars-open #mobile-portrait-sidebar-backdrop {
    display: block !important;
    position: fixed !important;
    top: 4rem !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 40 !important;
    background: rgba(0, 0, 0, 0.5) !important;
    pointer-events: auto !important;
  }

  /* Content pane occupies 100% screen */
  #main-content-pane {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
  }

  /* Blur and disable clicks on main content pane behind open sidebars */
  body.mobile-portrait-sidebars-open #main-content-pane {
    filter: blur(3px) !important;
    pointer-events: none !important;
    user-select: none !important;
  }

  /* Hide quick nav in mobile portrait to preserve clean view */
  #mobile-quick-nav {
    display: none !important;
  }
}

/* Screen width < 768px: Center titles and handle kebab menu for all pages */
@media (max-width: 767.98px) {
  #main-content-pane > div.border-b:first-child {
    position: relative !important;
  }
  /* Center title container horizontally */
  #main-content-pane > div.border-b:first-child > div:first-child {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    width: 100% !important;
    padding-left: 2.75rem !important;
    padding-right: 2.75rem !important;
    margin: 0 auto !important;
  }
  #main-content-pane > div.border-b:first-child > div:first-child h1,
  #main-content-pane > div.border-b:first-child > div:first-child span {
    text-align: center !important;
  }
  /* Inline actions hidden on small screens so they appear cleanly in the kebab menu */
  .header-actions-inline {
    display: none !important;
  }
}

/* Revert completely in landscape mode or screens >= 768px */
@media (orientation: landscape), (min-width: 768px) {
  #mobile-portrait-sidebar-toggle,
  #mobile-portrait-sidebar-backdrop {
    display: none !important;
  }

  #primary-rail-sidebar {
    position: relative !important;
    display: flex !important;
    width: 6rem !important;
    min-width: 6rem !important;
    max-width: 6rem !important;
  }

  #app-sidebar {
    position: relative !important;
    top: auto !important;
    bottom: auto !important;
    right: auto !important;
    left: auto !important;
    box-shadow: none !important;
  }
}

@media (orientation: landscape) and (min-width: 568px) {
  #main-top-nav {
    display: flex !important;
  }
  #mobile-nav-toggle {
    display: none !important;
  }
  #mobile-nav-drawer {
    display: none !important;
  }
}

/* Responsive adjustments for 2nd Level Sidebar in standard mobile landscape */
@media (max-width: 767px) and (orientation: landscape) {
  #app-sidebar {
    position: absolute !important;
    top: 0 !important;
    bottom: 0 !important;
    z-index: 30 !important;
    box-shadow: none !important;
  }
  [dir="rtl"] #app-sidebar {
    right: 6rem !important;
    left: auto !important;
    border-left: 1px solid rgba(226, 232, 240, 1) !important;
    border-right: none !important;
  }
  .dark [dir="rtl"] #app-sidebar {
    border-left: 1px solid rgba(30, 41, 59, 1) !important;
  }
  [dir="ltr"] #app-sidebar {
    left: 6rem !important;
    right: auto !important;
    border-right: 1px solid rgba(226, 232, 240, 1) !important;
    border-left: none !important;
  }
  .dark [dir="ltr"] #app-sidebar {
    border-right: 1px solid rgba(30, 41, 59, 1) !important;
  }
}

/* Markdown styling inside chat with Minimal Radius */
.prose-chat pre {
  background-color: #0f172a;
  color: #f8fafc;
  padding: 1rem;
  border-radius: 2px !important;
  overflow-x: auto;
  margin-top: 0.75rem;
  margin-bottom: 0.75rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.875rem;
  direction: ltr !important;
  text-align: left !important;
  border: 1px solid rgba(5, 91, 127, 0.25);
}

.prose-chat code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.875em;
  background-color: rgba(5, 91, 127, 0.12);
  padding: 0.15em 0.35em;
  border-radius: 2px !important;
  direction: ltr !important;
  display: inline-block;
}

.prose-chat pre code {
  background-color: transparent;
  padding: 0;
  display: block;
}

.prose-chat p {
  margin-bottom: 0.65rem;
  line-height: 1.75;
}

.prose-chat p:last-child {
  margin-bottom: 0;
}

.prose-chat ul, .prose-chat ol {
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
  padding-right: 1.5rem;
}
[dir="ltr"] .prose-chat ul, [dir="ltr"] .prose-chat ol {
  padding-right: 0;
  padding-left: 1.5rem;
}

.prose-chat li {
  margin-bottom: 0.25rem;
}

/* Cursor blink for streaming */
.typing-cursor::after {
  content: '▋';
  display: inline-block;
  color: #055b7f;
  animation: blink 0.9s infinite;
}
.dark .typing-cursor::after {
  color: #3da3c4;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ==============================================================
   Text Processing Pipeline Styling (Code, KaTeX, Tables, Callouts)
   ============================================================== */

/* Code Block & Syntax Highlighting */
.code-block {
  margin-top: 0.75rem;
  margin-bottom: 0.75rem;
  border-radius: 2px !important;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background-color: #0b0f19;
  overflow: hidden;
  direction: ltr !important;
  text-align: left !important;
  box-shadow: none !important;
}
.dark .code-block {
  border-color: rgba(51, 65, 85, 0.6);
  background-color: #070a12;
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 0.75rem;
  background-color: #111827;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.75rem;
  color: #94a3b8;
  user-select: none;
}
.dark .code-header {
  background-color: #030712;
}

.copy-code-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.5rem;
  border-radius: 2px;
  background-color: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  font-size: 0.7rem;
  font-family: inherit;
  transition: all 0.15s ease;
  cursor: pointer;
  border: 1px solid transparent;
}
.copy-code-btn:hover {
  background-color: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}

.code-block pre {
  margin: 0 !important;
  padding: 0.75rem 1rem !important;
  background-color: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.8125rem;
  line-height: 1.6;
  direction: ltr !important;
  text-align: left !important;
  color: #f8fafc;
}

.code-block code.hljs {
  background: transparent !important;
  padding: 0 !important;
  display: block;
}

/* KaTeX Math Styling */
.katex-block {
  margin: 0.75rem 0;
  text-align: center;
  overflow-x: auto;
  padding: 0.5rem 0;
  direction: ltr !important;
}
.katex-inline {
  display: inline-block;
  direction: ltr !important;
  padding: 0 0.15rem;
  vertical-align: -0.1em;
}
.katex {
  font-size: 1.05em;
  direction: ltr !important;
}

/* Markdown Tables */
.table-wrapper {
  margin: 0.75rem 0;
  overflow-x: auto;
  border-radius: 2px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  box-shadow: none !important;
}
.dark .table-wrapper {
  border-color: rgba(51, 65, 85, 0.6);
}
.table-wrapper table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}
.table-wrapper th, .table-wrapper td {
  padding: 0.5rem 0.85rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}
.dark .table-wrapper th, .dark .table-wrapper td {
  border-bottom-color: rgba(51, 65, 85, 0.4);
}
.table-wrapper th {
  background-color: rgba(241, 245, 249, 0.9);
  font-weight: 700;
  color: #1e293b;
}
.dark .table-wrapper th {
  background-color: rgba(30, 41, 59, 0.8);
  color: #f1f5f9;
}
.table-wrapper tbody tr:nth-child(even) {
  background-color: rgba(248, 250, 252, 0.6);
}
.dark .table-wrapper tbody tr:nth-child(even) {
  background-color: rgba(15, 23, 42, 0.4);
}

/* Callout Alerts (GitHub style) */
.callout-card {
  margin: 0.75rem 0;
  padding: 0.75rem 1rem;
  border-radius: 2px;
  font-size: 0.8125rem;
  line-height: 1.6;
}
[dir="rtl"] .callout-card {
  border-right-width: 4px;
}
[dir="ltr"] .callout-card {
  border-left-width: 4px;
}

/* Task List Checkbox */
.task-list-checkbox {
  margin: 0 0.4rem;
  vertical-align: middle;
  border-radius: 2px;
}

/* =====================================================================
   Smart Mobile Pull-To-Refresh Indicator: Permanently disabled as requested.
   Disabling this mechanism completely prevents accidental page reloads
   and restores 100% smooth, natural scrolling across all touch screens.
===================================================================== */
#eez-pull-refresh-indicator {
  display: none !important;
}

/* =====================================================================
   Assistant Message Action Bar & Bookmark Responsive Layout
   Mobile portrait (< 768px):
     - Bookmark button placed cleanly under model avatar
     - Row 1: Reactions & 5-Star Rating
     - Row 2: Remaining tools (start) and Single Response Export + Coins (opposite)
   Landscape mobile (orientation: landscape, height <= 520px) or Desktop (>= 768px):
     - Action bar flows in a single clean horizontal row
     - Bookmark button returns to action bar
===================================================================== */
@media (orientation: landscape) and (max-height: 520px) {
  .assistant-action-bar {
    flex-direction: row !important;
  }
  .assistant-action-bar .action-bar-row-2 {
    border-top: none !important;
    padding-top: 0 !important;
    flex: 1 1 0% !important;
  }
  .assistant-action-bar .action-bar-divider {
    display: block !important;
  }
  .bookmark-btn-mobile {
    display: none !important;
  }
  .bookmark-btn-desktop {
    display: inline-flex !important;
  }
}

