/* Material Design 3 CSS Variables */
.chat-llm-clean,
:root {
  /* Primary colors */
  --md3-primary: #6750a4;
  --md3-on-primary: #ffffff;
  --md3-primary-container: #eaddff;
  --md3-on-primary-container: #21005e;
  
  /* Secondary colors */
  --md3-secondary: #625b71;
  --md3-on-secondary: #ffffff;
  --md3-secondary-container: #e8def8;
  --md3-on-secondary-container: #1d192b;
  
  /* Tertiary colors */
  --md3-tertiary: #7d5260;
  --md3-on-tertiary: #ffffff;
  --md3-tertiary-container: #ffd8e4;
  --md3-on-tertiary-container: #31111d;
  
  /* Surface colors */
  --md3-surface: #fffbfe;
  --md3-on-surface: #1c1b1f;
  --md3-surface-variant: #e7e0ec;
  --md3-on-surface-variant: #49454f;
  
  /* Background colors */
  --md3-background: #fffbfe;
  --md3-on-background: #1c1b1f;
  
  /* Error colors */
  --md3-error: #ba1a1a;
  --md3-on-error: #ffffff;
  --md3-error-container: #ffdad6;
  --md3-on-error-container: #410002;
  
  /* Outline colors */
  --md3-outline: #79747e;
  --md3-outline-variant: #cac4d0;
  
  /* Shadow colors */
  --md3-shadow: rgba(0, 0, 0, 0.1);
  --md3-shadow-elevation-1: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
  --md3-shadow-elevation-2: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23);
  --md3-shadow-elevation-3: 0 10px 20px rgba(0, 0, 0, 0.19), 0 6px 6px rgba(0, 0, 0, 0.23);
  
  /* Chat LLM specific variables */
  --chat-llm-primary-color: var(--md3-primary);
  --chat-llm-primary-container: var(--md3-primary-container);
  --chat-llm-on-primary: var(--md3-on-primary);
  --chat-llm-surface-color: var(--md3-surface);
  --chat-llm-surface-hover-color: var(--md3-surface-variant);
  --chat-llm-on-surface: var(--md3-on-surface);
  --chat-llm-on-surface-variant: var(--md3-on-surface-variant);
  --chat-llm-outline: var(--md3-outline);
  --chat-llm-outline-variant: var(--md3-outline-variant);
  --chat-llm-shadow: var(--md3-shadow-elevation-1);
  --chat-llm-shadow-hover: var(--md3-shadow-elevation-2);
  --chat-llm-bg-color: var(--md3-background);
  --chat-llm-text-color: var(--md3-on-background);
  --chat-llm-text-secondary-color: var(--md3-on-surface-variant);
  --chat-llm-border-color: var(--md3-outline-variant);
}

/* Dark theme variables */
.chat-llm-clean.dark-theme {
  --md3-primary: #d0bcff !important;
  --md3-on-primary: #381e72 !important;
  --md3-primary-container: #4f378b !important;
  --md3-on-primary-container: #eaddff !important;
  
  --md3-secondary: #ccc2dc !important;
  --md3-on-secondary: #332d41 !important;
  --md3-secondary-container: #4a4458 !important;
  --md3-on-secondary-container: #e8def8 !important;
  
  --md3-tertiary: #efb8c8 !important;
  --md3-on-tertiary: #492532 !important;
  --md3-tertiary-container: #633b48 !important;
  --md3-on-tertiary-container: #ffd8e4 !important;
  
  --md3-surface: #1c1b1f !important;
  --md3-on-surface: #e6e1e5 !important;
  --md3-surface-variant: #49454f !important;
  --md3-on-surface-variant: #cac4d0 !important;
  
  --md3-background: #1c1b1f !important;
  --md3-on-background: #e6e1e5 !important;
  
  --md3-error: #ffb4ab !important;
  --md3-on-error: #690005 !important;
  --md3-error-container: #93000a !important;
  --md3-on-error-container: #ffdad6 !important;
  
  --md3-outline: #938f99 !important;
  --md3-outline-variant: #49454f !important;
  
  --md3-shadow: rgba(0, 0, 0, 0.3) !important;
  --md3-shadow-elevation-1: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.4) !important;
  --md3-shadow-elevation-2: 0 3px 6px rgba(0, 0, 0, 0.4), 0 3px 6px rgba(0, 0, 0, 0.5) !important;
  --md3-shadow-elevation-3: 0 10px 20px rgba(0, 0, 0, 0.5), 0 6px 6px rgba(0, 0, 0, 0.6) !important;
}

.chat-llm-hamburger {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 1px solid var(--chat-llm-border-color);
  border-radius: 8px;
  background: var(--chat-llm-surface-color);
  color: var(--chat-llm-text-color);
  cursor: pointer;
  z-index: 5;
  transition: all 0.2s ease;
}

.chat-llm-hamburger:hover {
  background: var(--chat-llm-surface-hover-color);
  border-color: var(--chat-llm-primary-color);
  box-shadow: var(--chat-llm-shadow-hover);
}

/* REMOVE legacy span styling inside hamburger to avoid mis-sizing icons */
/* .chat-llm-hamburger span { display:block; width:18px; height:2px; } */

/* Ensure icons have identical size and alignment */
.chat-llm-sidebar-header-row .dashicons,
.chat-llm-sidebar-header-row .material-symbols-outlined {
  font-size: 22px !important;
  line-height: 1 !important;
  width: 22px;
  height: 22px;
}
.chat-llm-sidebar-header-row .chat-llm-hamburger,
.chat-llm-sidebar-header-row .chat-llm-search-toggle {
  padding: 0 !important;
  margin: 0 !important;
}

/* Clean Chat Interface - Material Design 3 */
.chat-llm-clean {
  background: var(--chat-llm-bg-color);
  color: var(--chat-llm-text-color);
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', Oxygen, Ubuntu, Cantarell, sans-serif;
  border-radius: 16px;
  width: 100%;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: 280px 1fr;
  grid-template-areas: 'sidebar main';
  overflow: hidden; /* lock page scroll inside container */
  box-shadow: var(--chat-llm-shadow);
  transition: all 0.2s ease;
}
/* RTL support */
.chat-llm-clean.rtl { direction: rtl; }
/* Place sidebar on the right in RTL */
.chat-llm-clean.rtl { grid-template-columns: 1fr 280px; grid-template-areas: 'main sidebar'; }
.chat-llm-clean.rtl .chat-llm-sidebar { grid-column: 2; border-left: 1px solid var(--chat-llm-border-color); border-right: none; }
.chat-llm-clean.rtl.sidebar-collapsing .chat-llm-sidebar { border-left: none; }
.chat-llm-clean.rtl .chat-llm-main { grid-column: 1; }
/* General RTL text alignment overrides */
.chat-llm-clean.rtl .chat-llm-header > div { text-align: center !important; }
.chat-llm-clean.rtl .chat-llm-title,
.chat-llm-clean.rtl .chat-llm-subtitle,
.chat-llm-clean.rtl .chat-llm-disclaimer { text-align: right; direction: rtl;}
.chat-llm-clean.rtl .chat-llm-messages { direction: rtl; }
.chat-llm-clean.rtl .chat-llm-user { text-align: right; direction: rtl;}
.chat-llm-clean.rtl .chat-llm-assistant { text-align: right; direction: rtl;}
.chat-llm-clean.rtl .chat-llm-input-wrapper { text-align: right; direction: rtl; }
.chat-llm-clean.rtl .chat-llm-text { text-align: right; direction: rtl; }
.chat-llm-clean.rtl .chat-llm-conversations-label { text-align: right; direction: rtl; }
.chat-llm-clean.rtl .theme-text { text-align: right; direction: rtl; }
.chat-llm-clean.rtl .chat-llm-branding { text-align: right; direction: rtl; }
/* Slide directions in RTL */
.chat-llm-clean.rtl.sidebar-collapsing .chat-llm-sidebar { transform: translateX(-100%); }
.chat-llm-clean.rtl.sidebar-expanding .chat-llm-sidebar { transform: translateX(0); }
/* Header row inline alignment fix for RTL */
.chat-llm-clean.rtl .chat-llm-sidebar-header-row .chat-llm-search { margin-left: 0; margin-right: auto; }

/* Smooth grid transition when collapsing/expanding the sidebar */
.chat-llm-clean { transition: grid-template-columns 250ms ease; }
/* Smooth fade for sidebar content when collapsing/expanding */
.chat-llm-clean .chat-llm-sidebar { opacity: 1; transition: transform 250ms ease, opacity 200ms ease; will-change: transform, opacity; }
.chat-llm-clean.sidebar-collapsing .chat-llm-sidebar,
.chat-llm-clean.rtl.sidebar-collapsing .chat-llm-sidebar { opacity: 0; }
.chat-llm-clean.sidebar-expanding .chat-llm-sidebar,
.chat-llm-clean.rtl.sidebar-expanding .chat-llm-sidebar { opacity: 1; transform: translateX(0); }

/* Ensure no divider when collapsed */
.chat-llm-clean.sidebar-collapsed .chat-llm-sidebar { border-right: none !important; }
/* When sidebar is collapsed, hide its width completely */
.chat-llm-clean.sidebar-collapsed { grid-template-columns: 0 1fr !important; }
.chat-llm-clean.rtl.sidebar-collapsed { grid-template-columns: 1fr 56px !important; }
.chat-llm-clean.sidebar-collapsed .chat-llm-sidebar { width: 0 !important; padding: 0 !important; margin: 0 !important; }

/* Align header row height to icon size */
.chat-llm-sidebar-header-row { height: 40px; align-items: center; transition: opacity 200ms ease; }

/* Align collapsed icon to the same location as open */
.chat-llm-clean.sidebar-collapsed .chat-llm-sidebar-header-row { padding-top: 40px; opacity: 0.85; }

/* When no sidebar, use a single column full width */
.chat-llm-clean.no-sidebar { grid-template-columns: 1fr; grid-template-areas: 'main'; }

/* Sidebar: keep visible and non-scrollable (page scrolls only messages panel) */
.chat-llm-sidebar {
  background: var(--chat-llm-surface-color);
  border-right: 1px solid var(--chat-llm-border-color);
  display: grid;
  grid-template-rows: auto 1fr auto; /* header / list / footer */
  padding: 20px;
  gap: 16px;
  height: 100%;
  position: sticky; /* keep sidebar in view */
  top: 0;
  align-self: start;
  grid-area: sidebar;
}

.chat-llm-sidebar-header {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--chat-llm-border-color);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-llm-sidebar-header-row { 
  display:flex; 
  align-items:center; 
  justify-content: space-between; 
  gap: 8px; 
}

.chat-llm-sidebar-header-row .chat-llm-hamburger { order: 0; }
.chat-llm-sidebar-header-row .chat-llm-search { order: 1; margin-left: auto; }

.chat-llm-search { 
  display:flex; 
  align-items:center; 
  gap: 6px; 
}

.chat-llm-search-input { 
  width: 0; 
  transition: width 0.25s ease, opacity 0.2s ease; 
  background: var(--chat-llm-surface-color); 
  color: var(--chat-llm-text-color); 
  border: 1px solid var(--chat-llm-border-color); 
  border-radius: 8px; 
  padding: 6px 8px; 
  opacity: 0; 
  box-shadow: 0 1px 6px rgba(0,0,0,0.08);
}

.chat-llm-search-input.open { 
  width: 180px; 
  opacity: 1; 
}

.chat-llm-search-toggle { 
  background: transparent; 
  border: none; 
  color: var(--chat-llm-text-color); 
  border-radius: 20px; 
  width: 40px; 
  height: 40px; 
  cursor: pointer; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  transition: all 0.2s ease;
}

.chat-llm-search-toggle:hover {
  background: var(--chat-llm-surface-hover-color);
  box-shadow: var(--chat-llm-shadow);
}

.chat-llm-search-toggle .dashicons, 
.chat-llm-search-toggle .material-symbols-outlined { 
  font-size: 20px; 
}

/* Ensure sidebar hamburger is inline, not absolute */
.chat-llm-sidebar .chat-llm-hamburger { 
  position: static; 
  background: transparent; 
  border: none; 
  color: var(--chat-llm-text-color); 
  width: 40px; 
  height: 40px; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  border-radius: 20px; 
  transition: all 0.2s ease;
}

.chat-llm-sidebar .chat-llm-hamburger:hover { 
  background: var(--chat-llm-surface-hover-color); 
  box-shadow: var(--chat-llm-shadow);
}

.chat-llm-sidebar .chat-llm-hamburger .dashicons,
.chat-llm-sidebar .chat-llm-hamburger .material-symbols-outlined { 
  font-size: 20px; 
}

.chat-llm-new-chat {
  width: 100%;
  background: var(--chat-llm-primary-color);
  color: var(--chat-llm-on-primary);
  border: none;
  border-radius: 20px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  box-shadow: var(--chat-llm-shadow);
}

.chat-llm-new-chat:hover {
  background: var(--md3-primary-container);
  color: var(--md3-on-primary-container);
  box-shadow: var(--chat-llm-shadow-hover);
  transform: translateY(-1px);
}

.chat-llm-icon {
  font-size: 16px;
  font-weight: bold;
}

/* Optional: hide hamburger when sidebar is visible by default on desktop */
@media (min-width: 769px) {
  /* Do not force absolute; keep inline with search icon */
  .chat-llm-clean:not(.no-sidebar) .chat-llm-hamburger { position: static; }
  /* Constrain bubbles area only (not input) to stay within borders */
  .chat-llm-messages {
    max-width: 960px; /* match input wrapper max-width */
    width: 100%;
    box-sizing: border-box;
    margin-left: auto;
    margin-right: auto;
    padding-inline: 8px;
  }
  /* Bubble tails */
  .chat-llm-user { border-radius: 16px 16px 4px 16px; }
  .chat-llm-assistant { border-radius: 16px 16px 16px 4px; }
  .chat-llm-clean.rtl .chat-llm-user { border-radius: 16px 16px 16px 4px; }
  .chat-llm-clean.rtl .chat-llm-assistant { border-radius: 16px 16px 4px 16px; }
}

.chat-llm-conversations {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden; /* container around the scrolling list */
}

.chat-llm-conversations-label {
  font-size: 12px;
  color: var(--chat-llm-text-secondary-color);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.chat-llm-conversations-list {
  flex: 1 1 auto;
  overflow-y: auto; /* list itself scrolls */
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat-llm-conversation-item {
  background: var(--chat-llm-surface-color);
  border: 1px solid var(--chat-llm-border-color);
  color: var(--chat-llm-text-color);
  padding: 12px 16px;
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  font-size: 14px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.chat-llm-clean.rtl .chat-llm-conversation-item { text-align: right; }

.chat-llm-conversation-item:hover {
  background: var(--chat-llm-surface-hover-color);
  border-color: var(--chat-llm-primary-color);
  box-shadow: var(--chat-llm-shadow);
}

.chat-llm-conversation-item.active {
  background: var(--chat-llm-primary-color);
  color: var(--chat-llm-on-primary);
}

.chat-llm-conversation-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-llm-conversation-delete {
  background: transparent;
  border: 0px;
  color: var(--md3-error);
  cursor: pointer;
  padding: 4px 8px;
  font-size: 16px;
  border-radius: 16px;
  transition: all 0.2s ease;
}

.chat-llm-conversation-delete:hover {
  background: var(--md3-error-container);
  color: var(--md3-on-error-container);
}

.chat-llm-sidebar-footer {
  padding-top: 16px;
  border-top: 1px solid var(--chat-llm-border-color);
}

.chat-llm-theme-toggle {
  width: 100%;
  background: transparent;
  border: 1px solid var(--chat-llm-border-color);
  color: var(--chat-llm-text-color);
  border-radius: 20px;
  padding: 12px 16px;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.chat-llm-theme-toggle:hover {
  background: var(--chat-llm-surface-hover-color);
  border-color: var(--chat-llm-primary-color);
  box-shadow: var(--chat-llm-shadow);
}

.chat-llm-main {
  display: grid;
  grid-template-rows: auto 1fr; /* header / window */
  height: 100%;
  padding: 24px;
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  gap: 24px;
  grid-area: main;
  overflow: hidden; /* ensure inner window handles scrolling */
}

/* When header is hidden, let the window take all vertical space so the input sticks to the bottom */
.chat-llm-main.no-header { grid-template-rows: 1fr; gap: 0; }

/* Header Section */
.chat-llm-header {
  text-align: center;
  padding: 40px 0;
}

/* Make the window area expand so the composer can sit at the bottom */
.chat-llm-window {
  display: grid;
  grid-template-rows: 1fr auto; /* messages / composer */
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}


.chat-llm-assistant table {
  width: 100% !important;
  border-collapse: collapse;
  table-layout: fixed; /* prevent overflow on long content */
}
.chat-llm-assistant th,
.chat-llm-assistant td {
  word-break: break-word;
  vertical-align: top;
}
.chat-llm-assistant pre,
.chat-llm-assistant code {
  white-space: pre-wrap; /* wrap long lines */
  word-break: break-word;
}
.chat-llm-assistant pre { overflow-x: auto; }
.chat-llm-assistant table { border: 1px solid var(--chat-llm-border-color); }
.chat-llm-assistant th, .chat-llm-assistant td { border: 1px solid var(--chat-llm-border-color); padding: 8px; }
.chat-llm-assistant a { word-break: break-word; }
.chat-llm-assistant img,
.chat-llm-assistant video,
.chat-llm-assistant iframe { max-width: 100%; height: auto; }

.chat-llm-logo {
  margin-bottom: 24px;
}

.chat-llm-logo-icon {
  font-size: 48px;
  font-weight: bold;
  color: var(--chat-llm-on-primary);
  background: var(--chat-llm-primary-color);
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  box-shadow: var(--chat-llm-shadow-hover);
}

.chat-llm-title {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--chat-llm-text-color);
}
.dark-theme .chat-llm-title { color: var(--chat-llm-text-color) !important; }

.chat-llm-subtitle {
  font-size: 18px;
  color: var(--chat-llm-text-secondary-color);
  font-weight: 400;
}
.dark-theme .chat-llm-subtitle { color: var(--chat-llm-text-secondary-color) !important; }

/* Suggestions Section */
.chat-llm-suggestions {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-llm-suggestions-label {
  font-size: 14px;
  color: var(--chat-llm-text-secondary-color);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.chat-llm-suggestions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.chat-llm-suggestion-card {
  background: var(--chat-llm-surface-color);
  border: 1px solid var(--chat-llm-border-color);
  border-radius: 16px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.chat-llm-suggestion-card:hover {
  background: var(--chat-llm-surface-hover-color);
  border-color: var(--chat-llm-primary-color);
  transform: translateY(-2px);
  box-shadow: var(--chat-llm-shadow-hover);
}

.chat-llm-suggestion-content {
  flex: 1;
}

.chat-llm-suggestion-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--chat-llm-text-color);
  margin-bottom: 4px;
}

.chat-llm-suggestion-subtitle {
  font-size: 14px;
  color: var(--chat-llm-text-secondary-color);
  font-weight: 400;
}

.chat-llm-suggestion-arrow {
  font-size: 18px;
  color: var(--chat-llm-primary-color);
  font-weight: bold;
}

/* Messages Section */
.chat-llm-messages {
  /* Dynamically fill available height above the composer */
  height: auto;
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto; /* only messages pane scrolls */
  -webkit-overflow-scrolling: touch;
  padding: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Hide scrollbar UI but keep scrolling */
.chat-llm-messages::-webkit-scrollbar { width: 0px; height: 0px; }
.chat-llm-messages { scrollbar-width: none; /* Firefox */ -ms-overflow-style: none; /* IE/Edge */ }

.chat-llm-message {
  padding: 16px 20px;
  border-radius: 16px;
  line-height: 1.6;
  max-width: 85%;
  word-wrap: break-word;
}

.chat-llm-user {
  background: var(--chat-llm-primary-color);
  color: var(--chat-llm-on-primary);
  align-self: flex-end;
  margin-left: auto;
}

.chat-llm-assistant {
  background: var(--chat-llm-surface-color);
  color: var(--chat-llm-text-color);
  border: 1px solid var(--chat-llm-border-color);
  align-self: flex-start;
}
/* Ensure headings in assistant messages are readable in dark mode */
.chat-llm-assistant h1,
.chat-llm-assistant h2,
.chat-llm-assistant h3,
.chat-llm-assistant h4,
.chat-llm-assistant h5,
.chat-llm-assistant h6 { color: var(--chat-llm-text-color); }
.chat-llm-clean.dark-theme .chat-llm-assistant h1,
.chat-llm-clean.dark-theme .chat-llm-assistant h2,
.chat-llm-clean.dark-theme .chat-llm-assistant h3,
.chat-llm-clean.dark-theme .chat-llm-assistant h4,
.chat-llm-clean.dark-theme .chat-llm-assistant h5,
.chat-llm-clean.dark-theme .chat-llm-assistant h6 { color: var(--chat-llm-text-color) !important; }
/* Markdown styling consistency for all chats */
.chat-llm-assistant code { background: rgba(0,0,0,0.06); padding: 0 4px; border-radius: 4px; }
.chat-llm-assistant pre { background: rgba(0,0,0,0.06); padding: 12px; border-radius: 8px; overflow:auto; }
.chat-llm-assistant pre code { background: transparent; padding: 0; }
.chat-llm-assistant a { color: var(--chat-llm-primary-color); text-decoration: none; }
.chat-llm-assistant a:hover { text-decoration: underline; }
.dark-theme .chat-llm-assistant a { color: var(--chat-llm-primary-color) !important; }

.chat-llm-error {
  background: var(--md3-error-container);
  color: var(--md3-on-error-container);
  border: 1px solid var(--md3-error);
}

/* Input Section */
.chat-llm-input-container {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 12px;
  padding-left: 5px;
  padding-right: 5px;
}

.chat-llm-input-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--chat-llm-surface-color);
  border: none;
  border-radius: 28px;
  padding: 8px 16px;
  transition: all 0.2s ease;
  width: 100%;
  max-width: 960px;
  box-shadow: var(--chat-llm-shadow);
}

.chat-llm-input-wrapper:focus-within {
  box-shadow: 0 0 0 2px rgba(103, 80, 164, 0.1), var(--chat-llm-shadow-hover);
}

.chat-llm-attach,
.chat-llm-voice,
.chat-llm-send {
  background: transparent;
  border: none;
  color: var(--chat-llm-text-secondary-color);
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  width: 40px;
  height: 40px;
  position: relative;
  overflow: hidden;
}

.chat-llm-attach:hover,
.chat-llm-voice:hover {
  background: var(--chat-llm-surface-hover-color);
  color: var(--chat-llm-text-color);
}

.chat-llm-send {
  background: var(--chat-llm-primary-color);
  color: var(--chat-llm-on-primary);
}
.chat-llm-clean.rtl .chat-llm-send .material-symbols-outlined { transform: scaleX(-1); }

.chat-llm-send:hover {
  background: var(--md3-primary-container);
  color: var(--md3-on-primary-container);
  transform: scale(1.05);
  box-shadow: var(--chat-llm-shadow-hover);
}

.chat-llm-send .dashicons,
.chat-llm-send .material-symbols-outlined { 
  font-size: 20px; 
  line-height: 1; 
}

.chat-llm-text {
  flex: 1;
  background: transparent !important;
  border: none !important;
  color: var(--chat-llm-text-color);
  font-size: 16px;
  outline: none !important;
  padding: 8px 0;
  box-shadow: none !important;
  resize: none;
  line-height: 1.4;
}

.chat-llm-text::placeholder {
  color: var(--chat-llm-text-secondary-color);
}

/* Light Theme */
.chat-llm-clean.light-theme {
  background: var(--chat-llm-bg-color);
  color: var(--chat-llm-text-color);
  box-shadow: var(--chat-llm-shadow);
}

.chat-llm-clean.light-theme .chat-llm-sidebar {
  background: var(--chat-llm-surface-color);
  border-right: 1px solid var(--chat-llm-border-color);
}

.chat-llm-clean.light-theme .chat-llm-sidebar-header {
  border-bottom: 1px solid var(--chat-llm-border-color);
}

.chat-llm-clean.light-theme .chat-llm-new-chat {
  background: var(--chat-llm-primary-color);
  color: var(--chat-llm-on-primary);
  border: none;
}

.chat-llm-clean.light-theme .chat-llm-new-chat:hover {
  background: var(--md3-primary-container);
  color: var(--md3-on-primary-container);
}

.chat-llm-clean.light-theme .chat-llm-conversations-label {
  color: var(--chat-llm-text-secondary-color);
}

.chat-llm-clean.light-theme .chat-llm-conversation-item {
  color: var(--chat-llm-text-color);
  background: var(--chat-llm-surface-color);
  border: 1px solid var(--chat-llm-border-color);
}

.chat-llm-clean.light-theme .chat-llm-conversation-item:hover {
  background: var(--chat-llm-surface-hover-color);
  border-color: var(--chat-llm-primary-color);
}

.chat-llm-clean.light-theme .chat-llm-conversation-item.active {
  background: var(--chat-llm-primary-color);
  color: var(--chat-llm-on-primary);
}

.chat-llm-clean.light-theme .chat-llm-sidebar-footer {
  border-top: 1px solid var(--chat-llm-border-color);
}

.chat-llm-clean.light-theme .chat-llm-theme-toggle {
  border: 1px solid var(--chat-llm-border-color);
  color: var(--chat-llm-text-color);
}

.chat-llm-clean.light-theme .chat-llm-theme-toggle:hover {
  background: var(--chat-llm-surface-hover-color);
}

.chat-llm-clean.light-theme .chat-llm-title {
  color: var(--chat-llm-text-color);
}

.chat-llm-clean.light-theme .chat-llm-subtitle {
  color: var(--chat-llm-text-secondary-color);
}

.chat-llm-clean.light-theme .chat-llm-assistant {
  background: var(--chat-llm-surface-color);
  color: var(--chat-llm-text-color);
  border: 1px solid var(--chat-llm-border-color);
}

.chat-llm-clean.light-theme .chat-llm-user {
  background: var(--chat-llm-primary-color);
  color: var(--chat-llm-on-primary);
}

.chat-llm-clean.light-theme .chat-llm-input-wrapper {
  background: var(--chat-llm-surface-color);
}

.chat-llm-clean.light-theme .chat-llm-text {
  color: var(--chat-llm-text-color);
  background: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
}

.chat-llm-clean.light-theme .chat-llm-text::placeholder {
  color: var(--chat-llm-text-secondary-color);
}

.chat-llm-clean.light-theme .chat-llm-attach,
.chat-llm-clean.light-theme .chat-llm-voice {
  color: var(--chat-llm-text-secondary-color);
}

.chat-llm-clean.light-theme .chat-llm-attach:hover,
.chat-llm-clean.light-theme .chat-llm-voice:hover {
  background: var(--chat-llm-surface-hover-color);
  color: var(--chat-llm-text-color);
}

/* Responsive Design */
@media (max-width: 768px) {
  .chat-llm-clean {
    grid-template-columns: 1fr;
    height: 100vh; /* fit viewport height on mobile too */
  }
  @supports (height: 100dvh) {
    .chat-llm-clean { height: 100dvh; }
  }
  
  /* Mobile drawer from the left */
  .chat-llm-sidebar {
    display: flex;
    flex-direction: column !important; /* force rows in mobile drawer */
    align-items: stretch !important;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: min(80%, 320px);
    max-width: 100vw;
    transform: translateX(-100%);
    box-shadow: 0 12px 24px rgba(0,0,0,0.18);
    z-index: 9999;
  }
  
  .chat-llm-clean.sidebar-open {
    grid-template-columns: 1fr;
  }
  
  .chat-llm-clean.sidebar-open .chat-llm-sidebar {
    transform: translateX(0);
  }
  .chat-llm-hamburger { position: fixed; top: 12px; left: 12px; }
  /* Closed drawer: show hamburger with no border */
  .chat-llm-clean:not(.sidebar-open) .chat-llm-hamburger { border: none !important; background: transparent !important; box-shadow: none !important; }
  
  .chat-llm-main {
    padding: 16px;
    gap: 24px;
  }
  .chat-llm-input-wrapper { max-width: none; }
  .chat-llm-window { flex: 1 1 auto; min-height: 0; }
  /* Let the messages panel grow naturally on small screens */
  .chat-llm-messages { max-height: none; height: auto; overflow-y: auto; }
  .chat-llm-input-container { margin-top: auto; }
  
  .chat-llm-header {
    padding: 24px 0;
  }
  
  .chat-llm-logo-icon {
    width: 60px;
    height: 60px;
    font-size: 36px;
  }
  
  
  /* Scale typography responsively for tighter spaces */
  .chat-llm-title { font-size: clamp(20px, 5vw, 24px); }
  .chat-llm-subtitle { font-size: clamp(14px, 4vw, 16px); }
  
  /* Ensure suggestion cards don’t overflow narrow screens */
  .chat-llm-suggestions-grid { grid-template-columns: 1fr; }
  
  /* Allow chat bubbles to use a bit more width on phones */
  .chat-llm-message { max-width: 95%; }
}

/* Desktop-only refinement: place hamburger tighter to the edge in RTL */
@media (min-width: 769px) {
  .chat-llm-clean.rtl .chat-llm-sidebar-header-row { justify-content: flex-start; }
  .chat-llm-clean.rtl .chat-llm-sidebar-header-row .chat-llm-hamburger {
    margin-right: -10px; /* nudge into sidebar padding for optical alignment */
  }
}

/* Scrollbar Styling */
.chat-llm-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-llm-messages::-webkit-scrollbar-track {
  background: var(--chat-llm-bg-color);
}

.chat-llm-messages::-webkit-scrollbar-thumb {
  background: var(--chat-llm-border-color);
  border-radius: 3px;
}

.chat-llm-messages::-webkit-scrollbar-thumb:hover {
  background: var(--chat-llm-outline);
}

/* Animation for new messages */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-llm-message {
  animation: slideIn 0.3s ease-out;
}

/* Ripple effect for buttons */
.md3-ripple {
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  background: rgba(255,255,255,0.35);
  animation: md3-ripple 600ms linear;
  pointer-events: none;
}

/* Disclaimer */
.chat-llm-disclaimer {
  margin-top: 8px;
  font-size: 12px;
  color: var(--chat-llm-text-secondary-color);
  text-align: center;
}

.chat-llm-branding {
  margin-top: 8px;
  font-size: 12px;
  color: var(--chat-llm-text-secondary-color);
  text-align: center;
}

.chat-llm-sidebar-footer { margin-top: auto; }

@keyframes md3-ripple {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* Loading state */
.chat-llm-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--chat-llm-text-secondary-color);
  font-style: italic;
}

.chat-llm-loading::after {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid var(--chat-llm-border-color);
  border-top: 2px solid var(--chat-llm-primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Search page specific styles */
.chat-llm-search-container {
  margin-bottom: 16px;
}

.chat-llm-search-container .chat-llm-search-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--chat-llm-border-color);
  border-radius: 8px;
  background: var(--chat-llm-surface-color);
  color: var(--chat-llm-text-color);
  font-size: 14px;
  transition: border-color 0.2s ease;
}

.chat-llm-search-container .chat-llm-search-input:focus {
  outline: none;
  border-color: var(--chat-llm-primary-color);
}

.chat-llm-search-result {
  cursor: pointer;
  padding: 16px;
  border: 1px solid var(--chat-llm-border-color);
  border-radius: 12px;
  margin-bottom: 12px;
  transition: all 0.2s ease;
}

.chat-llm-search-result:hover {
  background: var(--chat-llm-surface-hover-color);
  border-color: var(--chat-llm-primary-color);
}

.chat-llm-search-result-title {
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--chat-llm-text-color);
}

.chat-llm-search-result-preview {
  color: var(--chat-llm-text-secondary-color);
  font-size: 14px;
  line-height: 1.4;
}

/* Back button styling */
.chat-llm-hamburger[href] {
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 20px;
  background: var(--chat-llm-surface-color);
  border: 1px solid var(--chat-llm-border-color);
  color: var(--chat-llm-text-color);
  transition: all 0.2s ease;
}

.chat-llm-hamburger[href]:hover {
  background: var(--chat-llm-surface-hover-color);
  border-color: var(--chat-llm-primary-color);
  box-shadow: var(--chat-llm-shadow);
}

.chat-llm-hamburger[href] .material-symbols-outlined {
  font-size: 20px;
}

/* Mobile floating hamburger button */
.chat-llm-hamburger-mobile {
  position: fixed;
  top: 12px;
  left: 12px;
  width: 40px;
  height: 40px;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: none;
  background: var(--chat-llm-surface-color);
  color: var(--chat-llm-text-color);
  box-shadow: none;
  z-index: 10000;
}


@media (max-width: 768px) {
  .chat-llm-hamburger-mobile { display: flex; }
  .chat-llm-hamburger-mobile:hover { background: var(--chat-llm-surface-hover-color); }

  /* Drawer layout & spacing */
  .chat-llm-clean.sidebar-open { overflow: hidden; }
  .chat-llm-sidebar {
    background: var(--chat-llm-surface-color) !important;
    border: none !important;
    padding: 16px 12px !important;
    height: 100vh !important;
    display: grid !important;
    grid-template-rows: auto 1fr auto !important; /* header / list / footer */
    grid-template-columns: 1fr !important; /* ensure single column layout */
    grid-auto-flow: row !important; /* create rows, not columns */
    gap: 16px !important;
  }
  /* Hide redundant hamburger inside drawer; keep search icon */
  .chat-llm-sidebar .chat-llm-hamburger { display: none !important; }
  .chat-llm-sidebar .chat-llm-search-toggle { display: flex !important; }
  .chat-llm-sidebar-header { border-bottom: 1px solid var(--chat-llm-border-color); padding-bottom: 12px; }
  .chat-llm-sidebar-header-row { justify-content: flex-end !important; }
  .chat-llm-sidebar .chat-llm-search { margin-left: auto !important; margin-right: 0 !important; }
  .chat-llm-conversations { min-height: 0 !important; display: flex !important; flex-direction: column !important; }
  .chat-llm-conversations-list { flex: 1 1 auto !important; overflow-y: auto !important; }
  .chat-llm-conversations-label { text-align: center !important; }
  .chat-llm-new-chat { width: 100% !important; }
}

/* Google Gemini-style search page layout */
.chat-llm-search-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--chat-llm-bg-color);
  color: var(--chat-llm-text-color);
}

/* Gemini-style header */
.chat-llm-search-header {
  padding: 24px 32px 0;
  border-bottom: 1px solid var(--chat-llm-border-color);
}

.chat-llm-search-brand {
  display: flex;
  align-items: center;
  justify-content: center; /* center the title */
  margin-bottom: 24px;
}

.chat-llm-search-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.chat-llm-search-logo .chat-llm-logo-icon { display:none; }

.chat-llm-search-title {
  font-size: 24px;
  font-weight: 400;
  color: var(--chat-llm-text-color);
  margin: 0;
  line-height: 1.2;
}

/* Main search area - Gemini style */
.chat-llm-search-main {
  padding: 32px;
  display: flex;
  justify-content: center;
  background: var(--chat-llm-bg-color);
}

.chat-llm-search-form { width: 100%; display:flex; justify-content:center; }

.chat-llm-search-content {
  flex: 1;
  padding: 0 32px 32px;
  max-width: 800px;
  margin: 0 auto;
}

.chat-llm-search-input-container {
  position: relative;
  max-width: 600px;
  width: 100%;
  display: flex;
  align-items: center;
}

.chat-llm-search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--chat-llm-text-secondary-color);
  font-size: 20px;
  pointer-events: none;
}

.chat-llm-search-clear {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--chat-llm-text-secondary-color);
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-llm-search-clear:hover {
  background: var(--chat-llm-surface-hover-color);
  color: var(--chat-llm-text-color);
}

.chat-llm-search-clear .material-symbols-outlined {
  font-size: 18px;
}

.chat-llm-search-input-container .chat-llm-search-input {
  flex: 1;
  padding: 16px 48px 16px 48px;
  border: 1px solid var(--chat-llm-border-color);
  border-radius: 28px;
  background: var(--chat-llm-surface-color);
  color: var(--chat-llm-text-color);
  -webkit-text-fill-color: var(--chat-llm-text-color);
  text-shadow: 0 0 0 var(--chat-llm-text-color);
  font-size: 16px;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08); /* more visible shadow */
  outline: none;
}

/* Hard override against theme/WooCommerce input styles so text and shadow are visible */
.chat-llm-search-page .chat-llm-search-input {
  color: var(--chat-llm-text-color) !important;
  background: var(--chat-llm-surface-color) !important;
  border: 1px solid var(--chat-llm-border-color) !important;
  box-shadow: 0 2px 10px rgba(0,0,0,0.14) !important;
  caret-color: var(--chat-llm-primary-color) !important;
}
.chat-llm-search-page .chat-llm-search-input::placeholder {
  color: var(--chat-llm-text-secondary-color) !important;
  opacity: 1 !important;
}

.chat-llm-search-input-container .chat-llm-search-input:focus {
  outline: none;
  border-color: var(--chat-llm-primary-color);
  box-shadow: 0 0 0 2px rgba(103, 80, 164, 0.18), 0 4px 14px rgba(0,0,0,0.18);
}

.chat-llm-recent-section {
  width: 100%;
  margin-bottom: 32px;
}

.chat-llm-recent-title {
  font-size: 20px;
  font-weight: 500;
  color: var(--chat-llm-text-color);
  margin: 0 0 20px 0;
  text-align: left;
}

.chat-llm-recent-list {
  display: grid;
  grid-template-columns: 1fr; /* list view by default */
  gap: 12px;
}

@media (min-width: 900px) {
  .chat-llm-recent-list { grid-template-columns: 1fr 1fr; }
}

.chat-llm-recent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border: 1px solid var(--chat-llm-border-color);
  border-radius: 12px;
  background: var(--chat-llm-surface-color);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 6px rgba(0,0,0,0.06);
  margin-bottom: 12px;
}

.chat-llm-recent-item:hover {
  background: var(--chat-llm-surface-hover-color);
  border-color: var(--chat-llm-primary-color);
  transform: translateY(-1px);
  box-shadow: var(--chat-llm-shadow-hover);
}

.chat-llm-recent-item .chat-llm-recent-title {
  font-weight: 500;
  color: var(--chat-llm-text-color);
  flex: 1;
}

.chat-llm-recent-date {
  font-size: 14px;
  color: var(--chat-llm-text-secondary-color);
  margin-left: 16px;
}

.chat-llm-no-recent {
  text-align: center;
  color: var(--chat-llm-text-secondary-color);
  padding: 24px;
  font-style: italic;
}

/* Search results section - Gemini style */
.chat-llm-search-results {
  width: 100%;
  margin-top: 24px;
}

.chat-llm-results-header {
  font-size: 16px;
  font-weight: 400;
  color: var(--chat-llm-text-secondary-color);
  margin-bottom: 20px;
  text-align: left;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--chat-llm-border-color);
}

.chat-llm-result-item {
  padding: 20px 24px;
  border: 1px solid var(--chat-llm-border-color);
  border-radius: 12px;
  background: var(--chat-llm-surface-color);
  cursor: pointer;
  margin-bottom: 16px;
  transition: all 0.2s ease;
  box-shadow: var(--chat-llm-shadow);
}

.chat-llm-result-item:hover {
  background: var(--chat-llm-surface-hover-color);
  border-color: var(--chat-llm-primary-color);
  transform: translateY(-1px);
  box-shadow: var(--chat-llm-shadow-hover);
}

.chat-llm-result-title {
  font-weight: 600;
  color: var(--chat-llm-text-color);
  margin-bottom: 8px;
  font-size: 16px;
}

.chat-llm-result-preview {
  color: var(--chat-llm-text-secondary-color);
  font-size: 14px;
  line-height: 1.5;
}

.chat-llm-no-results {
  text-align: center;
  color: var(--chat-llm-text-secondary-color);
  padding: 24px;
  font-style: italic;
}

/* Ensure search page inherits theme properly */
.chat-llm-search-page.dark-theme,
.chat-llm-clean.dark-theme .chat-llm-search-page {
  background: var(--chat-llm-bg-color);
  color: var(--chat-llm-text-color);
}

/* Mobile override placed late to beat earlier important rules */
@media (max-width: 768px) {
  .chat-llm-clean .chat-llm-sidebar .chat-llm-sidebar-header-row .chat-llm-hamburger,
  .chat-llm-clean.sidebar-open .chat-llm-sidebar .chat-llm-sidebar-header-row .chat-llm-hamburger,
  .chat-llm-clean .chat-llm-sidebar .chat-llm-hamburger[href] {
    display: none !important;
  }
}

.chat-llm-search-page.light-theme,
.chat-llm-clean.light-theme .chat-llm-search-page {
  background: var(--chat-llm-bg-color);
  color: var(--chat-llm-text-color);
}

/* Light theme overrides for search page */
.chat-llm-clean.light-theme .chat-llm-search-input-container .chat-llm-search-input {
  background: var(--chat-llm-surface-color);
  border-color: var(--chat-llm-border-color);
  color: var(--chat-llm-text-color);
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.chat-llm-clean.light-theme .chat-llm-search-input-container .chat-llm-search-input:focus {
  border-color: var(--chat-llm-primary-color);
  box-shadow: 0 0 0 2px rgba(103, 80, 164, 0.1), var(--chat-llm-shadow-hover);
}

.chat-llm-clean.light-theme .chat-llm-recent-item {
  background: var(--chat-llm-surface-color);
  border-color: var(--chat-llm-border-color);
}

.chat-llm-clean.light-theme .chat-llm-recent-item:hover {
  background: var(--chat-llm-surface-hover-color);
  border-color: var(--chat-llm-primary-color);
  box-shadow: var(--chat-llm-shadow-hover);
}

.chat-llm-clean.light-theme .chat-llm-result-item {
  background: var(--chat-llm-surface-color);
  border-color: var(--chat-llm-border-color);
}

.chat-llm-clean.light-theme .chat-llm-result-item:hover {
  background: var(--chat-llm-surface-hover-color);
  border-color: var(--chat-llm-primary-color);
  box-shadow: var(--chat-llm-shadow-hover);
}

/* Sidebar icon buttons: hamburger and search - identical style */
.chat-llm-sidebar .chat-llm-hamburger,
.chat-llm-sidebar .chat-llm-search-toggle {
  position: static;
  background: transparent;
  border: none;
  color: var(--chat-llm-text-color);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 20px;
  transition: all 0.2s ease;
  text-decoration: none;
}

.chat-llm-sidebar .chat-llm-hamburger:hover,
.chat-llm-sidebar .chat-llm-search-toggle:hover {
  background: var(--chat-llm-surface-hover-color);
  box-shadow: var(--chat-llm-shadow);
}

.chat-llm-sidebar .chat-llm-hamburger .material-symbols-outlined,
.chat-llm-sidebar .chat-llm-search-toggle .material-symbols-outlined {
  font-size: 20px;
}

/* Remove differing anchor style so link variant matches button style */
.chat-llm-hamburger[href] {
  text-decoration: none;
  background: transparent;
  border: none;
  color: var(--chat-llm-text-color);
  width: 40px;
  height: 40px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.chat-llm-hamburger[href]:hover {
  background: var(--chat-llm-surface-hover-color);
  border-color: transparent;
  box-shadow: var(--chat-llm-shadow);
}

.chat-llm-hamburger[href] .material-symbols-outlined {
  font-size: 20px;
}

/* Sidebar icon buttons override: circular, centered, no border/shadow */
.chat-llm-sidebar .chat-llm-hamburger,
.chat-llm-sidebar .chat-llm-search-toggle {
  width: 40px !important;
  height: 40px !important;
  border-radius: 50% !important;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0 !important;
}

.chat-llm-sidebar .chat-llm-hamburger:hover,
.chat-llm-sidebar .chat-llm-search-toggle:hover {
  background: transparent !important;
  box-shadow: none !important;
}

.chat-llm-sidebar .chat-llm-hamburger .material-symbols-outlined,
.chat-llm-sidebar .chat-llm-search-toggle .material-symbols-outlined {
  font-size: 22px !important;
  line-height: 1 !important;
}

/* Anchor variant matches button variant */
.chat-llm-hamburger[href] {
  width: 40px !important;
  height: 40px !important;
  border-radius: 50% !important;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.chat-llm-hamburger[href]:hover {
  background: transparent !important;
  box-shadow: none !important;
}

/* Sidebar slide animation */
.chat-llm-sidebar { transition: transform 250ms ease, opacity 200ms ease; }

/* Collapsing (animate out) */
.chat-llm-clean.sidebar-collapsing .chat-llm-sidebar { transform: translateX(-100%); transition: none !important; }
/* Expanding (animate in) */
.chat-llm-clean.sidebar-expanding .chat-llm-sidebar { transform: translateX(0); }

/* Collapsed state on desktop: keep a slim rail with the hamburger visible */
.chat-llm-clean.sidebar-collapsed { grid-template-columns: 56px 1fr; }
.chat-llm-clean.sidebar-collapsed .chat-llm-sidebar {
  visibility: visible;
  pointer-events: auto;
  transform: none;
  padding: 8px 8px;
}
.chat-llm-clean.sidebar-collapsed .chat-llm-sidebar-header { border-bottom: none; padding-bottom: 0; }
.chat-llm-clean.sidebar-collapsed .chat-llm-sidebar-header-row { justify-content: center; }
.chat-llm-clean.sidebar-collapsed .chat-llm-sidebar .chat-llm-search,
.chat-llm-clean.sidebar-collapsed .chat-llm-new-chat,
.chat-llm-clean.sidebar-collapsed .chat-llm-conversations,
.chat-llm-clean.sidebar-collapsed .chat-llm-sidebar-footer { display: none !important; }
/* In collapsed state keep hamburger visible but remove borders/background */
.chat-llm-clean.sidebar-collapsed .chat-llm-hamburger { border: none !important; background: transparent !important; box-shadow: none !important; }
/* Remove divider in collapsed state for both LTR and RTL */
.chat-llm-clean.sidebar-collapsed .chat-llm-sidebar { border-right: none !important; border-left: none !important; }
.chat-llm-clean.rtl.sidebar-collapsed .chat-llm-sidebar { border-left: none !important; }

/* Explicit dark theme component styles to pair with variable overrides */
.chat-llm-clean.dark-theme {
  background: var(--chat-llm-bg-color) !important;
  color: var(--chat-llm-text-color) !important;
}
.chat-llm-sheet.dark-theme { background: #0f0f13 !important; color: var(--chat-llm-text-color) !important; }
.chat-llm-sheet.light-theme { background: #fffbfe !important; color: var(--chat-llm-text-color) !important; }
.chat-llm-clean.dark-theme .chat-llm-message { color: var(--chat-llm-text-color) !important; }
.chat-llm-clean.dark-theme .chat-llm-assistant a { color: var(--chat-llm-primary-color) !important; }
.chat-llm-clean.dark-theme .chat-llm-user { color: var(--chat-llm-on-primary) !important; }
.chat-llm-clean.dark-theme .chat-llm-sidebar {
  background: var(--chat-llm-surface-color) !important;
  border-right: 1px solid var(--chat-llm-border-color) !important;
}
.chat-llm-clean.dark-theme .chat-llm-new-chat {
  background: var(--chat-llm-primary-color) !important;
  color: var(--chat-llm-on-primary) !important;
  border: none !important;
}
.chat-llm-clean.dark-theme .chat-llm-conversations-label { color: var(--chat-llm-text-secondary-color) !important; }
.chat-llm-clean.dark-theme .chat-llm-conversation-item {
  background: var(--chat-llm-surface-color) !important;
  border: 1px solid var(--chat-llm-border-color) !important;
  color: var(--chat-llm-text-color) !important;
}
.chat-llm-clean.dark-theme .chat-llm-conversation-item:hover { background: var(--chat-llm-surface-hover-color) !important; border-color: var(--chat-llm-primary-color) !important; }
.chat-llm-clean.dark-theme .chat-llm-theme-toggle { border: 1px solid var(--chat-llm-border-color) !important; color: var(--chat-llm-text-color) !important; }
.chat-llm-clean.dark-theme .chat-llm-main { color: var(--chat-llm-text-color) !important; }
.chat-llm-clean.dark-theme .chat-llm-assistant { background: var(--chat-llm-surface-color) !important; color: var(--chat-llm-text-color) !important; border: 1px solid var(--chat-llm-border-color) !important; }
.chat-llm-clean.dark-theme .chat-llm-user { background: var(--chat-llm-primary-color) !important; color: var(--chat-llm-on-primary) !important; }
.chat-llm-clean.dark-theme .chat-llm-input-wrapper { background: var(--chat-llm-surface-color) !important; border: none !important; }
.chat-llm-clean.dark-theme .chat-llm-text { color: var(--chat-llm-text-color) !important; background: transparent !important; border: none !important; outline: none !important; box-shadow: none !important; }
.chat-llm-clean.dark-theme .chat-llm-text::placeholder { color: var(--chat-llm-text-secondary-color) !important; }
.chat-llm-clean.dark-theme .chat-llm-attach,
.chat-llm-clean.dark-theme .chat-llm-voice { color: var(--chat-llm-text-secondary-color) !important; }
.chat-llm-clean.dark-theme .chat-llm-attach:hover,
.chat-llm-clean.dark-theme .chat-llm-voice:hover { background: var(--chat-llm-surface-hover-color) !important; color: var(--chat-llm-text-color) !important; }
.chat-llm-clean.dark-theme .chat-llm-search-input { background: var(--chat-llm-surface-color) !important; color: var(--chat-llm-text-color) !important; border: 1px solid var(--chat-llm-border-color) !important; }
.chat-llm-clean.dark-theme .chat-llm-result-item,
.chat-llm-clean.dark-theme .chat-llm-recent-item { background: var(--chat-llm-surface-color) !important; border: 1px solid var(--chat-llm-border-color) !important; color: var(--chat-llm-text-color) !important; }
.chat-llm-clean.dark-theme .chat-llm-disclaimer,
.chat-llm-clean.dark-theme .chat-llm-branding { color: var(--chat-llm-text-secondary-color) !important; }
.chat-llm-clean.dark-theme .chat-llm-search-header { border-color: var(--chat-llm-border-color) !important; }
.chat-llm-clean.dark-theme .chat-llm-search-input { background: var(--chat-llm-surface-color) !important; color: var(--chat-llm-text-color) !important; border-color: var(--chat-llm-border-color) !important; box-shadow: 0 2px 8px rgba(0,0,0,0.24) !important; }
.chat-llm-clean.dark-theme .chat-llm-search-clear { color: var(--chat-llm-text-secondary-color) !important; }
.chat-llm-clean.dark-theme .chat-llm-search-clear:hover { background: var(--chat-llm-surface-hover-color) !important; }

/* Widget-only layout constraints: apply only when template adds chat-llm-widget */
.chat-llm-clean.chat-llm-widget { height: 100% !important; min-height: 0 !important; overflow: hidden !important; }
.chat-llm-clean.chat-llm-widget .chat-llm-main { height: 100% !important; min-height: 0 !important; overflow: hidden !important; }
.chat-llm-clean.chat-llm-widget .chat-llm-window { height: 100% !important; min-height: 0 !important; display: grid !important; grid-template-rows: 1fr auto !important; overflow: hidden !important; }
.chat-llm-clean.chat-llm-widget .chat-llm-messages { overflow-y: auto !important; min-height: 0 !important; }
