/*----  public/css/styles.css.backup ----*/

/* Step 4 of 7 – Theme variants registered (dark-brown / dark-blue). Inactive until Step 5 */
@import url('./themes/theme-dark-brown.css');
@import url('./themes/theme-dark-blue.css');


* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  /* Smooth theme transitions - Step 7.4 */
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

:root {
  /* Phase 9: Global light theme (default for all tenants) */
  --accent-primary: #0b5c89;
  --accent-secondary: #3b82f6;
  --accent-gradient: linear-gradient(135deg, #0b5c89, #3b82f6);
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Light Background Colors (GLOBAL DEFAULT) */
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #f1f5f9;
  --bg-light: #f8fafc;

  /* Light Text Colors (GLOBAL DEFAULT) */
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --text-primary-btn: #f4f4f4;
  --text-secondary-btn: #b3bdcb;

  /* Accent Colors */
  --accent: #0b5c89;
  --accent-hover: #084263;
  --primary-color: #1779a1;
  --primary-hover: #0b5c89;
  --secondary-color: #40b9c5;

  /* Message Colors (light theme friendly) */
  --user-msg: #1192a8;
  --assistant-msg: #f1f5f9;

  /* Status Colors */
  --success-color: #10b981;
  --error-color: #ef4444;
  --warning-color: #f59e0b;

  /* Light Border Colors (GLOBAL DEFAULT) */
  --border: #e2e8f0;
  --border-color: #e2e8f0;

  /* Layout */
  --sidebar-collapsed-width: 70px;
  --sidebar-expanded-width: 260px;
  --radius: 12px;
  --shadow-sm: 0 2px 8px rgba(0,0,0,.08);
  --container-max: 1200px;
}

/* Phase 9: Dark theme (tenant-customizable) */
body.dark-theme,
[data-theme-mode="dark"] {
  /* Dark Background Colors */
  --bg-primary: #0a1520;
  --bg-secondary: #0f1e2e;
  --bg-tertiary: #1a2d3f;
  --bg-light: #1a2d3f;

  /* Dark Text Colors */
  --text-primary: #e0e0e0;
  --text-secondary: #a0a0a0;

  /* Dark Accent Colors */
  --accent: #67eaf8;
  --accent-hover: #40b9c5;

  /* Dark Message Colors */
  --user-msg: #084263;
  --assistant-msg: #1779a1;

  /* Dark Border Colors */
  --border: #2a3f52;
  --border-color: rgba(255, 255, 255, 0.1);

  /* Dark Shadow */
  --shadow-sm: 0 4px 14px rgba(0,0,0,.25);
}

/* Phase 9: Alias for backward compatibility */
body.light-theme {
  /* Uses :root defaults (light theme) */
}

body {
  font-family: var(--font-family);
  background: var(--bg-primary);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
}

/* Allow scrolling for subscription pages */
body.subs-page {
  overflow-y: auto;
  overflow-x: hidden;
  height: auto;
  min-height: 100vh;
}

.app {
  display: flex;
  height: 100vh;
  position: relative;
}

/* App shell for subscription pages - allows scrolling */
.app-shell {
  display: flex;
  min-height: 100vh;
  width: 100%;
  overflow-x: hidden;
}

.app-shell .content-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.app-shell main.container {
  flex: 1;
  overflow-y: auto;
  width: 100%;
  padding-bottom: 60px;
}

/* Sidebar container that maintains layout space */
.sidebar-container {
  width: var(--sidebar-collapsed-width);
  flex-shrink: 0;
  position: relative;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-container.pinned {
  width: var(--sidebar-expanded-width);
}

/* Actual sidebar */
.sidebar {
  position: fixed;  /* Changed from absolute to fixed to match layout.css */
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--sidebar-collapsed-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
  z-index: 100;
  overflow-x: hidden;
  overflow-y: hidden;
}

.sidebar.hover-expanded {
  width: var(--sidebar-expanded-width);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
}

.sidebar-container.pinned .sidebar {
  width: var(--sidebar-expanded-width);
  box-shadow: none;
}

/* Sidebar header with hamburger */
.sidebar-header {
  display: flex;
  align-items: center;
  padding: 12px;
  min-height: 60px;
  gap: 12px;
  flex-shrink: 0;
}

.hamburger-menu {
  background: transparent;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s;
  min-width: 36px;
  height: 36px;
}

.hamburger-menu:hover {
  background: var(--bg-tertiary);
  transform: scale(1.05);
}

.hamburger-menu svg {
  width: 20px;
  height: 20px;
  transition: transform 0.3s;
}

.sidebar-container.pinned .hamburger-menu svg {
  transform: rotate(90deg);
}

/* Sidebar branding - Always visible logo */
.sidebar-branding {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px 12px 12px;
  border-bottom: 1px solid var(--border);
  justify-content: center;
  transition: justify-content 0.3s ease;
}

/* Keep logo always visible */
.sidebar-branding img,
.sidebar-branding svg {
  width: 24px;
  height: 24px;
  color: var(--accent);
  flex-shrink: 0;
  opacity: 1 !important;
}

.sidebar-logo {
  width: 24px;
  height: 24px;
  object-fit: contain;
  flex-shrink: 0;
}

/* Only hide the text */
.sidebar-branding-text {
  font-size: 18px;
  font-weight: 600;
  background: linear-gradient(135deg, #1779a1 0%, #40b9c5 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
  opacity: 0;
  width: 0;
  overflow: hidden;
  transition: opacity 0.3s ease 0.1s, width 0.3s ease;
}

/* Show text when expanded */
.sidebar.hover-expanded .sidebar-branding-text,
.sidebar-container.pinned .sidebar-branding-text {
  opacity: 1;
  width: auto;
}

/* Adjust branding alignment when expanded */
.sidebar.hover-expanded .sidebar-branding,
.sidebar-container.pinned .sidebar-branding {
  justify-content: flex-start;
}

/* New Chat button */
.new-chat-btn {
  margin: 12px;
  padding: 10px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  position: relative;
  overflow: hidden;
}

.new-chat-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(23, 121, 161, 0.3);
}

.new-chat-btn:active {
  transform: translateY(0);
}

.new-chat-btn-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.new-chat-btn-text {
  margin-left: 8px;
  opacity: 0;
  transform: translateX(-10px);
  transition: all 0.3s ease;
  white-space: nowrap;
  position: absolute;
  left: 38px;
}

.welcome-title {

  
    font-size: 48px;
    font-weight: 700;
    background: linear-gradient(135deg, #1779a1 0%, #40b9c5 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}


.sidebar.hover-expanded .new-chat-btn-text,
.sidebar-container.pinned .new-chat-btn-text {
  opacity: 1;
  transform: translateX(0);
  position: relative;
  left: auto;
}

/* New Chat dropdown icon */
.new-chat-dropdown-icon {
  width: 16px;
  height: 16px;
  margin-left: auto;
  flex-shrink: 0;
  opacity: 0;
  transform: translateX(-10px);
  transition: all 0.3s ease;
}

.sidebar.hover-expanded .new-chat-dropdown-icon,
.sidebar-container.pinned .new-chat-dropdown-icon {
  opacity: 1;
  transform: translateX(0);
}

/* New Chat wrapper and dropdown */
.new-chat-wrapper {
  position: relative;
  margin: 12px;
}

.new-chat-wrapper .new-chat-btn {
  margin: 0;
  width: 100%;
  justify-content: flex-start;
  gap: 8px;
}

.new-chat-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.2s ease;
  z-index: 1000;
  overflow: hidden;
}

.new-chat-dropdown.active {
  opacity: 1 !important;
  visibility: visible !important;
  transform: translateY(0);
  display: block !important;
}

.new-chat-dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
  text-align: left;
  text-decoration: none;
}

.new-chat-dropdown-item:hover {
  background: var(--hover-bg);
}

.new-chat-dropdown-item svg {
  flex-shrink: 0;
  opacity: 0.7;
}

.new-chat-dropdown-item:hover svg {
  opacity: 1;
}

/* Navigation items */
.sidebar-nav {
  padding: 8px 0;
  margin-left:7px;
  border-bottom: 1px solid var(--border);
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 2px 10px;
  margin: 2px 8px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
  position: relative;
  min-height: 30px;
  width: calc(100% - 16px);
}

.nav-item:hover {
  background: var(--bg-tertiary);
  transform: translateX(2px);
}

.nav-item-icon {
  min-width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-item-icon svg {
  width: 18px;
  height: 18px;
}

.nav-item-text {
  margin-left: 12px;
  font-size: 14px;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(-10px);
  transition: all 0.3s ease;
}

.sidebar.hover-expanded .nav-item-text,
.sidebar-container.pinned .nav-item-text {
  opacity: 1;
  transform: translateX(0);
}

/* Tooltip for collapsed state */
.nav-item-tooltip {
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%) scale(0.95);
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s;
  z-index: 1001;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.sidebar:not(.hover-expanded) .nav-item:hover .nav-item-tooltip {
  opacity: 1;
  transform: translateY(-50%) scale(1);
}

.sidebar-container.pinned .nav-item-tooltip {
  display: none;
}

/* Section label */
.section-label {
  padding: 12px 12px 8px 12px;
  font-size: 8px;
  font-weight: 700;
  color: #ffbb01;
  text-transform: uppercase;
  letter-spacing: 1px;
  /*opacity: 0;*/
  transform: translateX(-10px);
  transition: all 0.3s ease 0.15s;
  white-space: nowrap;
  margin-left: 2px;
}

/*
.sidebar.hover-expanded .section-label,
.sidebar-container.pinned .section-label {
  opacity: 1;
  transform: translateX(0);
}
  */

/* === Sidebar: pinned/expanded fixes for flex sizing === */

/* 1) Labels/section titles in pinned state must have real width */
.sidebar .sidebar-container .pinned .section-label .hover-expanded {
  flex: 1 1 auto !important;
  width: auto !important;
  max-width: none !important;
  min-width: 0 !important;
  opacity: 1 !important;
  transform: none !important;
}

/* 2) Chat list items: make the text block take space in pinned state */
.sidebar-container.pinned .chat-history-item,
.sidebar-container.pinned .chat-item {
  display: flex;            /* keep flex layout */
  align-items: left;
}

/* Hide chat history item content when sidebar is NOT expanded */
/* Hide content when sidebar is collapsed (not pinned AND not hover-expanded) */
.sidebar-container:not(.pinned) .sidebar:not(.hover-expanded) .chat-history-item-content {
  display: none !important;
}

/* Show content when sidebar is pinned OR hover-expanded */
.sidebar-container.pinned .chat-history-item-content,
.sidebar.hover-expanded .chat-history-item-content {
  display: flex !important;
  flex-direction: column;
  gap: 2px;
}

/* Hide the menu button when sidebar is NOT expanded */
.sidebar:not(.hover-expanded):not(.pinned) .chat-history-item-menu,
.sidebar-container:not(.pinned) .sidebar:not(.hover-expanded) .chat-history-item-menu {
  /*display: none !important;*/
}

/* Center the icon when sidebar is NOT expanded */
.sidebar:not(.hover-expanded):not(.pinned) .chat-history-item,
.sidebar-container:not(.pinned) .sidebar:not(.hover-expanded) .chat-history-item {
  justify-content: left;
  padding: 12px;
}

/* Ensure icon stays visible and centered */
.sidebar:not(.hover-expanded):not(.pinned) .chat-history-item-icon,
.sidebar-container:not(.pinned) .sidebar:not(.hover-expanded) .chat-history-item-icon {
  margin: 0;
}

.sidebar-container.pinned .chat-history-item .icon,
.sidebar-container.pinned .chat-item .icon {
  flex: 0 0 auto;           /* icons stay fixed width */
}

.sidebar-container.pinned .chat-history-item .chat-item-text,
.sidebar-container.pinned .chat-item .chat-item-text,
.sidebar-container.pinned .chat-history-item .chat-item-title,
.sidebar-container.pinned .chat-item .chat-item-title,
.sidebar-container.pinned .chat-history-item .chat-item-meta,
.sidebar-container.pinned .chat-item .chat-item-meta {
  flex: 1 1 auto !important; /* <-- the key reset */
  width: auto !important;
  max-width: none !important;
  min-width: 0 !important;   /* allow text to shrink/grow properly */
  opacity: 1 !important;
  transform: none !important;
  overflow: hidden;          /* keep your ellipsis if you use it */
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 3) Ensure the scroll area doesn’t clip text in pinned state */
.sidebar-container.pinned #chat-history,
.sidebar-container.pinned .chat-history {
  overflow-x: hidden;
  overflow-y: auto;
}

/* Chat history */


.chat-history {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 8px 8px;
  min-height: 0;
}

.chat-history-item {
  padding: 10px 12px;
  margin-bottom: 4px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.chat-history-item:hover {
  background: var(--bg-tertiary);
}

.chat-history-item.active {
  background: var(--bg-tertiary);
  border-left: 3px solid var(--accent);
  padding-left: 9px;
}

.chat-history-item-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: 0.7;
}

.chat-history-item-icon.bookmark-star-icon,
.chat-history-item-icon.bookmark-icon {
  color: #FFD700;
  opacity: 0.9;
}

.chat-history-item-title {
  flex: 1;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
  opacity: 0;
  transform: translateX(-10px);
  transition: all 0.3s ease 0.1s;
}

.sidebar.hover-expanded .chat-history-item-title,
.sidebar-container.pinned .chat-history-item-title {
  opacity: 1;
  transform: translateX(0);
}

.chat-history-item-time {
  font-size: 10px;
  color: var(--text-secondary);
  opacity: 0;
  transform: translateX(-10px);
  transition: all 0.3s ease 0.1s;
}

.sidebar.hover-expanded .chat-history-item-time,
.sidebar-container.pinned .chat-history-item-time {
  opacity: 1;
  transform: translateX(0);
}

.chat-history-item-menu {
  opacity: 0;
  transition: opacity 0.2s;
}

.chat-history-item:hover .chat-history-item-menu {
  opacity: 1;
}

.chat-menu-btn {
  background: transparent;
  border: none;
  color: #f5e507;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  font-size: 20px;
  line-height: 1;
  transition: background 0.2s;
}

.chat-menu-btn:hover {
  background: var(--border);
  color:  #f5e507;;
}

.chat-item-menu {
  position: absolute;
  right: 8px;
  top: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 1001;
  min-width: 120px;
}

.chat-item-menu.active {
  display: flex;
}

.chat-item-menu-option {
  padding: 8px 12px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s;
  border-bottom: 1px solid var(--border);
}

.chat-item-menu-option:last-child {
  border-bottom: none;
}

.chat-item-menu-option:hover {
  background: var(--bg-tertiary);
}

.chat-item-menu-option.danger {
  color: #fc8181;
}

.chat-item-menu-option.danger:hover {
  background: rgba(252, 129, 129, 0.1);
}

.empty-history {
  padding: 20px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
  opacity: 0;
  transition: opacity 0.3s ease 0.2s;
}

.sidebar.hover-expanded .empty-history,
.sidebar-container.pinned .empty-history {
  opacity: 1;
}

/* Sidebar footer */
.sidebar-footer {
  padding: 8px;
  border-top: 1px solid var(--border);
  margin-top: auto;
  position: relative;
  flex-shrink: 0;
}

/* User button - fixed centering */
.user-button {
  width: 100%;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 7px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.2s;
  box-sizing: border-box;
  overflow: hidden;
}

.user-button:hover {
  background: var(--bg-tertiary);
  transform: translateY(-1px);
}

/* Adjust alignment when expanded */
.sidebar.hover-expanded .user-button,
.sidebar-container.pinned .user-button {
  justify-content: flex-start;
}

.user-menu {
  position: absolute;
  bottom: 100%;
  left: 8px;
  right: 8px;
  margin-bottom: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 1000;
}

.user-menu.active {
  display: flex;
}

.user-menu-item {
  padding: 12px 16px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.user-menu-item:hover {
  background: var(--bg-tertiary);
}

.user-menu-item:not(:last-child) {
  border-bottom: 1px solid var(--border);
}

.user-menu-item.danger {
  color: #fc8181;
}

.user-menu-item.danger:hover {
  background: rgba(252, 129, 129, 0.1);
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
  flex-shrink: 0;
}

.user-avatar.guest {
  background: var(--text-secondary);
  color: var(--text-primary);
}

/* Hide user details when collapsed, keep avatar centered */
.user-details {
  margin-left: 12px;
  text-align: left;
  overflow: hidden;
  opacity: 0;
  width: 0;
  transform: translateX(-10px);
  transition: all 0.3s ease 0.2s;
  flex: 0;
}

.sidebar.hover-expanded .user-details,
.sidebar-container.pinned .user-details {
  opacity: 1;
  transform: translateX(0);
  flex: 1;
  width: auto;
}

.user-name {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 14px;
  color: var(--text-primary-btn);
}

.user-email {
  font-size: 12px;
  color: var(--text-secondary-btn);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Main content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.chat-header {
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* when we add .is-disabled to the stream label */
label.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* also catch the generic case in case you style with sibling labels */
input[type="checkbox"]:disabled + label {
  opacity: 0.5;
  cursor: not-allowed;
}


.chat-title-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.2s;
  flex: 1;
  max-width: 400px;
  position: relative;
}

.chat-title-wrapper:hover {
  background: var(--bg-tertiary);
}

.chat-title {
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-dropdown-icon {
  color: var(--text-secondary);
  flex-shrink: 0;
}

.chat-title-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px;
  min-width: 200px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  display: none;
  z-index: 1001;
  margin-top: 4px;
}

.chat-title-dropdown.active {
  display: block;
}

.chat-title-dropdown-item {
  padding: 8px 12px;
  background: transparent;
  border: none;
  color: var(--text-primary) !important;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
  border-radius: 4px;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.chat-title-dropdown-item:hover {
  background: var(--bg-tertiary);
}

.chat-title-dropdown-item.danger {
  color: #fc8181;
}

/* Subscriptions navigation dropdown */
.dropdown-section-title {
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

.subscriptions-nav a.chat-title-dropdown-item {
  text-decoration: none;
  color: var(--text-primary);
}

.settings-bar {
  display: flex;
  gap: 12px;
  align-items: center;
}

.switch-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.switch-label.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Custom Theme Toggle Switch */
.theme-toggle-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.theme-toggle-input {
  display: none;
}

.theme-toggle-slider {
  position: relative;
  width: 64px;
  height: 32px;
  background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
  border-radius: 32px;
  transition: all 0.3s ease;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.5);
  border: 2px solid #2a3f52;
  display: flex;
  align-items: center;
  padding: 2px;
}

.theme-toggle-circle {
  position: absolute;
  width: 24px;
  height: 24px;
  background: linear-gradient(135deg, #f0f0f0 0%, #e0e0e0 100%);
  border-radius: 50%;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  left: 3px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.theme-toggle-input:checked + .theme-toggle-slider {
  background: linear-gradient(135deg, #1779a1 0%, #0b5c89 100%);
  border-color: #1779a1;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3), 0 0 12px rgba(23, 121, 161, 0.3);
}

.theme-toggle-input:checked + .theme-toggle-slider .theme-toggle-circle {
  transform: translateX(32px);
  background: linear-gradient(135deg, #ffffff 0%, #f5f5f5 100%);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.theme-toggle-wrapper:hover .theme-toggle-slider {
  border-color: #444;
}

.theme-toggle-wrapper:hover .theme-toggle-input:checked + .theme-toggle-slider {
  border-color: #20a4d8;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3), 0 0 16px rgba(23, 121, 161, 0.5);
}

.theme-toggle-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: var(--text-secondary);
  transition: color 0.3s ease;
}

.theme-toggle-input:checked ~ .theme-toggle-label {
  color: #1779a1;
}

.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.message {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
}

.message.user,
.message.assistant {
  margin-left: 0 !important;
  margin-right: 0 !important;
}

.message.user .message-avatar {
  background: var(--user-msg);
  color: white;
}

.message.assistant .message-avatar {
  background: var(--assistant-msg);
  color: white;
}

/* Provider logo styling */
.message-avatar .provider-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 6px;
}

/* Model label styling */

.model-badge {color: var(--text-secondary);}

.model-label {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 4px;
  padding-left: 2px;
  font-style: italic;
  opacity: 0.8;
}

.message-content {
  flex: 1;
  line-height: 1.6;
  word-wrap: break-word;
  word-break: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
  white-space: pre-wrap;
}

.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
}

/* Style the logo image */
.empty-state img {
  width: 120px;
  height: 120px;
  margin-bottom: 24px;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(23, 121, 161, 0.3));
}

.empty-state h1 {
  font-size: 48px;
  font-weight: 700;
  background: linear-gradient(135deg, #1779a1 0%, #40b9c5 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

/* Center the empty state branding vertically and horizontally */
.empty-state {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: auto;
}

.input-area {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.input-wrapper {
  /*max-width: 800px;*/
  margin: 0 auto;
}

.input-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.action-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}

.action-btn:hover:not(:disabled) {
  background: var(--bg-tertiary);
}

.action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.action-btn.recording {
  background: #ff4444;
  border-color: #ff2222;
  color: white;
  animation: pulse 1.5s ease-in-out infinite;
}

/* Custom Select Dropdown */
.custom-select-wrapper {
  position: relative;
}

.custom-select {
  position: relative;
  min-width: 200px;
}

.custom-select-trigger {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: white;
  padding: 8px 36px 8px 36px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
}

.custom-select-trigger:hover {
  background: var(--bg-tertiary);
  border-color: var(--accent);
}

.custom-select.open .custom-select-trigger {
  border-color: var(--accent);
}

.custom-select-trigger .select-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.custom-select-trigger .select-arrow {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  transition: transform 0.2s;
  opacity: 0.7;
}

.custom-select.open .custom-select-trigger .select-arrow {
  transform: translateY(-50%) rotate(180deg);
}

.custom-select-options {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #2a2a2a;
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 400px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.custom-select.open .custom-select-options {
  display: block;
}

.custom-select-group {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.custom-select-group:last-child {
  border-bottom: none;
}

.custom-select-group-label {
  font-size: 10px;
  font-weight: 600;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 12px;
  user-select: none;
}

.custom-select-option {
  padding: 10px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  color: white;
  font-size: 13px;
  transition: background 0.1s;
}

.custom-select-option:hover {
  background: rgba(255, 255, 255, 0.1);
}

.custom-select-option.selected {
  background: rgba(var(--accent-rgb), 0.2);
}

.custom-select-option img {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* Hide native select (used for fallback) */
.model-selector {
  display: none;
}

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

.input-container {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  align-items: flex-end;
  padding: 12px;
  gap: 12px;
  transition: border-color 0.2s;
}

.input-container:focus-within {
  border-color: var(--accent);
}

#message-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 15px;
  resize: none;
  outline: none;
  max-height: 200px;
  min-height: 24px;
  font-family: inherit;
  line-height: 1.5;
  overflow-y: auto;
  overflow-x: hidden;
  white-space: pre-wrap;
  word-wrap: break-word;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

#message-input::-webkit-scrollbar {
  width: 6px;
}

#message-input::-webkit-scrollbar-track {
  background: transparent;
}

#message-input::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

#message-input::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

#message-input::placeholder {
  color: var(--text-secondary);
}

.send-btn {
  background: var(--accent) !important;
  border: none !important;
  color: white !important;
  width: 36px !important;
  height: 36px !important;
  min-width: 36px !important;
  min-height: 36px !important;
  border-radius: 8px !important;
  cursor: pointer;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: background 0.2s;
  flex-shrink: 0;
  padding: 0 !important;
}

.send-btn svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

.send-btn:hover:not(:disabled) {
  background: var(--accent-hover);
}

.send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.tts-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  display: none;
  margin-bottom: 12px;
  transition: all 0.3s ease;
}

.tts-panel.active {
  display: block;
}

.tts-panel.floating {
  position: fixed;
  right: 16px;
  bottom: 16px;
  margin-bottom: 0;
  box-shadow: 0 8px 24px rgba(0,0,0,.3);
  z-index: 1000;
  min-width: 480px;
  cursor: move;
}

.tts-panel.floating.dragging {
  opacity: 0.8;
}

.tts-controls {
  display: flex;
  gap: 12px;
  align-items: center;
  width: 100%;
}

.tts-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  transition: background 0.2s;
  flex-shrink: 0;
  line-height: 1;
}

.tts-btn:hover {
  background: var(--border);
}

.tts-seek {
  flex: 1;
  min-width: 120px;
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.tts-seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

.tts-seek::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
}

#ttsVol {
  width: 80px;
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  flex-shrink: 0;
}

#ttsVol::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

#ttsVol::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
}

.tts-time {
  font-size: 13px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 85px;
  text-align: center;
}

/* Browser TTS: Hide seek and volume (not supported), show only time counter */
.tts-panel[data-browser-tts="true"] #ttsSeek {
  display: none;
}

.tts-panel[data-browser-tts="true"] #ttsVol {
  display: none;
}

/* Browser TTS: Make time display more prominent */
.tts-panel[data-browser-tts="true"] .tts-time {
  flex: 1;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  padding: 0 12px;
  min-width: 120px;
}

/* Server TTS: Show all controls normally */

.vu-meter {
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  display: none;
  height: 30px;
}

.vu-meter.active {
  display: block;
}

.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 2000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  max-width: 400px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-title {
  font-size: 20px;
  font-weight: 600;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: background 0.2s;
}

.modal-close:hover {
  background: var(--bg-tertiary);
}

.modal-section {
  margin-bottom: 24px;
}

.modal-section:last-child {
  margin-bottom: 0;
}

.modal-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  padding: 12px;
  border-radius: 8px;
  transition: background 0.2s;
}

.checkbox-label:hover {
  background: rgba(23, 121, 161, 0.05);
}

.checkbox-input {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--accent);
}

.checkbox-text {
  flex: 1;
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.5;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 5px;
  background: rgba(64, 185, 197, 0.1);
  border: 1px solid rgba(64, 185, 197, 0.2);
  border-radius: 12px;
  margin-bottom: 3px;
}

.user-info-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 24px;
  flex-shrink: 0;
}

.user-info-avatar.guest {
  background: var(--text-secondary);
  color: var(--bg-primary);
}

.user-info-details {
  flex: 1;
  min-width: 0;
}

.user-info-name {
  font-weight: 600;
  font-size: 18px;
  color: var(--text-primary);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-info-email {
  font-size: 14px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modal-btn {
  width: 100%;
  background: var(--accent);
  color: white;
  border: none;
  padding: 12px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.2s;
  margin-bottom: 8px;
}

.modal-btn:last-child {
  margin-bottom: 0;
}

.modal-btn:hover {
  background: var(--accent-hover);
}

.modal-btn.secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-primary);
}

.modal-btn.secondary:hover {
  background: var(--bg-tertiary);
}

.modal-btn.danger {
  background: #c53030;
  color: white;
}

.modal-btn.danger:hover {
  background: #9b2c2c;
}

/* Modal input groups - override forms.css flex layout */
.modal .input-group,
#userModal .input-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 20px;
}

.modal .input-group:last-child,
#userModal .input-group:last-child {
  margin-bottom: 0;
}

.input-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.input-field {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  transition: all 0.2s;
  box-sizing: border-box;
}

.input-field:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg-primary);
}

.input-help-text {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 6px;
  line-height: 1.4;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 24px 0;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  /* Hide bookmarks section on small screens */
  .section-label:has(+ .chat-history),
  .chat-history {
    display: none !important;
  }

  .sidebar-container {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0;
    z-index: 1000;
  }

  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-expanded-width);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .sidebar-toggle {
    display: flex;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 101;
    background: var(--accent);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 20px;
    transition: background 0.2s;
    align-items: center;
    justify-content: center;
  }

  .sidebar-toggle:hover {
    background: var(--accent-hover);
  }

  .sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
  }

  .sidebar-overlay.active {
    display: block;
  }

  .settings-bar {
    display: none;
  }
}

@media (min-width: 769px) {
  .sidebar-toggle,
  .sidebar-overlay {
    display: none !important;
  }
}
/* ========================================
   AUTHENTICATION OVERLAY STYLES
   ======================================== */

.auth-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 21, 32, 0.95);
  backdrop-filter: blur(8px);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

.auth-overlay.active {
  display: flex;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.auth-overlay-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 48px 40px;
  max-width: 480px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  animation: slideUp 0.4s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.auth-overlay-icon {
  font-size: 64px;
  margin-bottom: 24px;
  animation: lockPulse 2s ease-in-out infinite;
}

@keyframes lockPulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

.auth-overlay-content h2 {
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.auth-overlay-content p {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 32px;
  line-height: 1.5;
}

.auth-overlay-buttons {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.auth-overlay-btn {
  flex: 1;
  padding: 14px 24px;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.auth-overlay-btn.primary {
  background: var(--accent);
  color: white;
}

.auth-overlay-btn.primary:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(23, 121, 161, 0.4);
}

.auth-overlay-btn.secondary {
  background: transparent;
  border: 2px solid var(--border);
  color: var(--text-primary);
}

.auth-overlay-btn.secondary:hover {
  background: var(--bg-tertiary);
  border-color: var(--accent);
  transform: translateY(-2px);
}

.auth-overlay-note {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
  padding: 16px;
  background: var(--bg-tertiary);
  border-radius: 8px;
  border-left: 3px solid var(--accent);
}

/* Light theme support */
body.light-theme .auth-overlay {
  background: rgba(255, 255, 255, 0.95);
}

/* Thinking indicator animation */
/* Thinking indicator animation */
.thinking-indicator {
  opacity: 0.9;
  animation: fadeInThinking 0.3s ease-in;
}

.thinking-indicator .message-content {
  display: flex;
  align-items: center;
  gap: 6px;
  font-style: italic;
}

.thinking-text {
  color: var(--text-secondary);
}

.thinking-dots {
  display: inline-flex;
  gap: 2px;
  min-width: 30px;
}

.thinking-dots .dot {
  animation: thinking-pulse 1.4s infinite;
  color: var(--accent);
  font-weight: bold;
}

.thinking-dots .dot:nth-child(1) {
  animation-delay: 0s;
}

.thinking-dots .dot:nth-child(2) {
  animation-delay: 0.2s;
}

.thinking-dots .dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes thinking-pulse {
  0%, 60%, 100% {
    opacity: 0.3;
    transform: scale(1);
  }
  30% {
    opacity: 1;
    transform: scale(1.3);
  }
}

@keyframes fadeInThinking {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 0.9;
    transform: translateY(0);
  }
}

/* Upload Progress Indicator */
.upload-loading {
  opacity: 0.8;
}

.upload-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
}

.upload-spinner {
  width: 20px;
  height: 20px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.upload-progress span {
  color: var(--text-secondary);
  font-style: italic;
}

/* File Preview Styles */
.file-previews {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.file-preview-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-tertiary);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.file-preview-image {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.file-preview-pdf {
  width: 80px;
  height: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: var(--bg-secondary);
  border-radius: 6px;
  border: 1px solid var(--border);
  color: var(--accent);
}

.pdf-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
}

.file-preview-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.file-preview-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-preview-size {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ============================================
   UPLOAD MODAL STYLES
   ============================================ */

.upload-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 3000;
  align-items: center;
  justify-content: center;
  animation: modalFadeIn 0.2s ease;
}

.upload-modal.active {
  display: flex;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.upload-modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 90%;
  max-width: 600px;
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  animation: modalSlideUp 0.3s ease;
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.upload-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.upload-modal-header h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.upload-modal-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s;
}

.upload-modal-close:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.upload-modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

/* Drop Zone */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 40px 20px;
  text-align: center;
  transition: all 0.3s;
  background: var(--bg-primary);
  margin-bottom: 24px;
}

.drop-zone.drag-over {
  border-color: var(--accent);
  background: rgba(23, 121, 161, 0.1);
  transform: scale(1.02);
}

.drop-zone svg {
  color: var(--accent);
  margin-bottom: 16px;
}

.drop-zone-text {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.drop-zone-subtext {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.drop-zone-info {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 16px;
}

.attach-files-btn {
  background: var(--accent);
  color: white;
  border: none;
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.attach-files-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(23, 121, 161, 0.3);
}

/* Resolution Options */
.resolution-options {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
}

.resolution-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.resolution-choices {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 12px;
}

.resolution-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.resolution-option:hover {
  border-color: var(--accent);
  background: var(--bg-tertiary);
}

.resolution-option input[type="radio"] {
  margin-top: 2px;
  cursor: pointer;
  accent-color: var(--accent);
}

.resolution-option input[type="radio"]:checked + .resolution-text {
  color: var(--accent);
}

.resolution-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.resolution-text strong {
  font-size: 14px;
  color: var(--text-primary);
}

.resolution-text small {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.resolution-info {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 12px;
  background: rgba(23, 121, 161, 0.1);
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.resolution-info svg {
  flex-shrink: 0;
  color: var(--accent);
  margin-top: 1px;
}

/* Selected Files Preview */
.selected-files {
  margin-bottom: 20px;
  max-height: 200px;
  overflow-y: auto;
}

.modal-file-item,
.selected-file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
  transition: all 0.2s;
}

.modal-file-item:hover,
.selected-file-item:hover {
  background: var(--bg-tertiary);
}

.selected-file-item {
  justify-content: space-between;
}

.file-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.file-name {
  color: var(--text-primary);
  font-weight: 500;
}

.file-size {
  color: var(--text-secondary);
  font-size: 12px;
}

.remove-file-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 24px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s;
  flex-shrink: 0;
}

.remove-file-btn:hover {
  background: var(--bg-tertiary);
  color: var(--danger);
}

.modal-file-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.modal-file-name {
  flex: 1;
  font-size: 14px;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-file-size {
  font-size: 12px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.modal-file-remove {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s;
  flex-shrink: 0;
}

.modal-file-remove:hover {
  background: rgba(252, 129, 129, 0.2);
  color: #fc8181;
}

/* Confirm Upload Button */
.confirm-upload-btn {
  width: 100%;
  background: var(--accent);
  color: white;
  border: none;
  padding: 14px 24px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.confirm-upload-btn:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(23, 121, 161, 0.4);
}

.confirm-upload-btn:disabled {
  background: var(--border);
  color: var(--text-secondary);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* File Preview Resolution Badge */
.file-preview-res {
  font-size: 11px;
  color: var(--accent);
  font-weight: 500;
  margin-top: 4px;
  display: block;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .upload-modal-content {
    width: 95%;
    max-height: 90vh;
  }

  .upload-modal-body {
    padding: 16px;
  }

  .drop-zone {
    padding: 30px 15px;
  }

  .resolution-choices {
    gap: 8px;
  }

  .resolution-option {
    padding: 10px;
  }

  .attach-files-btn {
    width: 100%;
  }
}

/* Scrollbar for selected files */
.selected-files::-webkit-scrollbar {
  width: 6px;
}

.selected-files::-webkit-scrollbar-track {
  background: var(--bg-primary);
  border-radius: 3px;
}

.selected-files::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.selected-files::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* ============================================
   SCROLLBAR STYLING - UNIVERSAL COMPATIBILITY
   ============================================ */

/* Modern browsers (Firefox, newer versions) */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) var(--bg-primary);
}

/* WebKit browsers (Chrome, Safari, Edge, Opera) */
*::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

*::-webkit-scrollbar-track {
  background: var(--bg-primary);
  border-radius: 3px;
}

*::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
  transition: background 0.2s ease;
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

*::-webkit-scrollbar-corner {
  background: var(--bg-primary);
}

/* Sidebar specific - extra slim */
.sidebar::-webkit-scrollbar {
  width: 4px;
}

.sidebar {
  scrollbar-width: thin;
}

/* Messages container */
.messages-container::-webkit-scrollbar {
  width: 6px;
}
.messages-container {
  padding-top: 80px !important;
}

/* Modal file list */
.selected-files::-webkit-scrollbar {
  width: 6px;
}

/* Chat history list */
.chat-list::-webkit-scrollbar {
  width: 4px;
}

============================================ */

/* Move chat list items left to align with other icons */
.chat-item,
.nav-item {
  padding-left: 5px; /* Reduce left padding by 5-10px */
}

/* Specific adjustments for chat history items */
.chat-list .chat-item {
  margin-left: -5px; /* Pull chat items left by 5px */
}

/* Center user avatar/logo in sidebar */
.sidebar .user-avatar,
.sidebar .user-info,
.sidebar .user-section {
  margin-left: 10px; /* Push user section right by 10px */
  margin-right: -10px; /* Compensate to maintain centering */
}

/* Alternative approach - if using specific selectors */
.sidebar-bottom .user-avatar,
.sidebar-user-section {
  transform: translateX(10px); /* Move user section right */
}

/* Ensure all sidebar icons are consistently aligned */
.sidebar .nav-icon,
.sidebar .chat-icon {
  margin-left: 0;
  padding-left: 0;
}

/* ============================================
   SIDEBAR NAVIGATION ALIGNMENT FIX
   ============================================ */

/* Move nav items left to align with other sidebar icons */
.sidebar-nav .nav-item {
  /*dding-left: 8px;  Reduce from default padding */
  /*rgin-left: -5px;  Pull items left by 5px */
}

/* Alternative approach if the above doesn't work */
.nav-item {
  transform: translateX(-8px); /* Move left by 8px */
}

/* Ensure nav item icons align properly */
.nav-item-icon {
  margin-left: 0;
  padding-left: 0;
}


/* Move user avatar/section right to center with other icons /
idebar .user-section,
.sidebar .user-avatar,
.sidebar-bottom {
  transform: translateX(10px);  Move right by 10px}*/

/*  New css here  */
/* Chat Context Menu */
.chat-context-menu {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  padding: 4px;
  min-width: 120px;
}

.context-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  background: none;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.2s;
}

.context-menu-item:hover {
  background: var(--bg-tertiary);
}

.context-menu-item.delete-item:hover {
  background: rgba(252, 129, 129, 0.1);
  color: #dc2626;
}

.chat-item.active {
  background: var(--bg-tertiary);
  border-left: 3px solid var(--accent);
}

/* ============================================
   ADD THESE LINES TO END OF YOUR EXISTING styles.css
   DO NOT REPLACE ANYTHING - JUST APPEND THESE
   ============================================ */

/* FIX #1: Chat title overflow in sidebar */
.chat-history-item-title {
  min-width: 0 !important; /* Critical for ellipsis in flexbox */
  max-width: 180px !important; /* Prevent overflow when expanded */
}

/* FIX #2: Messages anchor to bottom (like Claude/ChatGPT) */
.messages-container {
  justify-content: flex-end !important; /* Anchor to bottom */
}

.message:first-child {
  margin-top: auto !important; /* Push first message to bottom */
}

.message-bubble,
.message-content {
  min-width: 0 !important; /* Prevent flex overflow */
}

.message-bubble a {
  color: #67eaf8;
}
/* ============================================
   FINAL FIXES - ADD TO END OF styles.css
   ============================================ */

/* FIX #1: Chat title overflow in sidebar */
.chat-history-item-title {
  min-width: 0 !important;
  max-width: 180px !important;
}

/* FIX #2 & #3: Chat messages layout - consolidated */
.chat-messages {
  display: flex !important;
  flex-direction: column !important;
  justify-content: flex-start !important;
  padding-top: 100px !important;
}

.chat-messages .message:first-child {
  margin-top: auto !important;
}

/* FIX #4: Prevent message content overflow */
.message-bubble,
.message-content {
  min-width: 0 !important;
}

/* FIX #5: Center empty state branding */
.empty-state {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
  pointer-events: none; /* Don't block interactions with messages */
}

/* Ensure messages appear above empty state */
.message {
  position: relative;
  z-index: 2;
}

/* ============================================
   UI FIXES - Chat Messages & Input Area
   ============================================ */

/* Fix main content to use proper flex layout */
.main-content {
  height: 100vh !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}

/* Fix chat messages area - add scrollbar and proper flex */
.chat-messages {
  flex: 1 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding: 24px !important;
  padding-top: 100px !important;
  padding-bottom: 24px !important;
  /* display: flex already set above - don't override */
  position: relative !important;
  min-height: 0 !important; /* Critical for flex scrolling */
}

/* Messages wrapper inside chat-messages for proper spacing */
.chat-messages > * {
  margin-bottom: 24px;
}

.chat-messages > *:last-child {
  margin-bottom: 0;
}

/* Fix input area - stick to bottom */
.input-area {
  position: sticky !important;
  bottom: 0 !important;
  width: 100% !important;
  padding: 16px 24px !important;
  border-top: 1px solid var(--border) !important;
  background: var(--bg-primary) !important;
  z-index: 10 !important;
  flex-shrink: 0 !important; /* Prevent input from shrinking */
  margin-top: 0 !important; /* Remove any margin that might push it down */
}

/* Ensure header doesn't interfere with layout */
.chat-header {
  flex-shrink: 0 !important;
  position: sticky !important;
  top: 0 !important;
  background: var(--bg-primary) !important;
  z-index: 20 !important;
}

/* Smooth scrolling for chat messages */
.chat-messages {
  scroll-behavior: smooth !important;
}

/* Style the scrollbar */
.chat-messages::-webkit-scrollbar {
  width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

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

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

/* ============================================
   Message Content Formatting
   ============================================ */

/* Format message bubble content with proper HTML styling */
.message-bubble p {
  margin: 0 0 12px 0;
  line-height: 1.6;
}

.message-bubble p:last-child {
  margin-bottom: 0;
}

.message-bubble strong {
  font-weight: 600;
  color: var(--text-primary);
}

.message-bubble em {
  font-style: italic;
}

.message-bubble code {
  background: var(--bg-tertiary);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
  color: var(--accent);
}

.message-bubble pre {
  background: var(--bg-tertiary);
  padding: 12px;
  border-radius: 6px;
  overflow-x: auto;
  margin: 12px 0;
}

.message-bubble pre code {
  background: transparent;
  padding: 0;
  border-radius: 0;
  font-size: 0.9em;
  display: block;
  line-height: 1.5;
}

.message-bubble ul,
.message-bubble ol {
  margin: 12px 0;
  padding-left: 24px;
}

.message-bubble li {
  margin: 6px 0;
  line-height: 1.5;
}

.message-bubble h1,
.message-bubble h2,
.message-bubble h3,
.message-bubble h4,
.message-bubble h5 {
  margin: 16px 0 8px 0;
  font-weight: 600;
  color: var(--text-primary);
}

.message-bubble h1 {
  font-size: 1.5em;
}

.message-bubble h2 {
  font-size: 1.3em;
}

.message-bubble h3 {
  font-size: 1.1em;
}

.message-bubble h4 {
  font-size: 1.05em;
}

.message-bubble h5 {
  font-size: 1em;
  font-weight: 600;
}

.message-bubble br {
  display: block;
  content: "";
  margin-top: 6px;
}

/* ============================================
   CHAT MANAGER STYLES
   ============================================ */

.chat-manager-workspace {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg-primary);
  padding: 0;
  max-width: 100%;
}

.chat-manager-container {
  /*max-width: 900px;
  margin: 0 auto;*/
  padding: 40px 24px;
  max-width: 100%;
  overflow-x: hidden;
}

.chat-manager-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.chat-manager-title {
  font-size: 32px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.new-chat-btn-primary {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.new-chat-btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

/* Search Bar */
.chat-manager-search {
  margin-bottom: 24px;
}

.chat-search-input {
  width: 100%;
  padding: 12px 16px 12px 40px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text-primary);
  transition: all 0.2s;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cpath d='m21 21-4.35-4.35'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 12px center;
}

.chat-search-input:focus {
  outline: none;
  border-color: var(--accent);
  background-color: var(--bg-primary);
}

/* Controls Bar */
.chat-manager-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  gap: 16px;
  flex-wrap: wrap;
}

.chat-count-info {
  font-size: 14px;
  color: var(--text-secondary);
}

.chat-filter-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.filter-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.filter-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.filter-btn svg {
  width: 16px;
  height: 16px;
}

.select-toggle-btn {
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s;
}

.select-toggle-btn:hover {
  background: var(--bg-secondary);
  border-color: var(--accent);
}

.select-toggle-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* Bulk Actions Bar */
.bulk-actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 16px;
}

.bulk-actions-left {
  display: flex;
  align-items: center;
}

.bulk-checkbox-container {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-primary);
}

.bulk-checkbox-container input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.bulk-actions-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bulk-action-btn {
  padding: 8px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bulk-action-btn:hover {
  background: var(--bg-tertiary);
}

.bulk-action-btn.danger:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: #ef4444;
  color: #ef4444;
}

.bulk-action-close {
  padding: 4px 8px;
  background: transparent;
  border: none;
  font-size: 18px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.bulk-action-close:hover {
  color: var(--text-primary);
}

/* Chat List */
.chat-manager-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 100%;
  overflow-x: hidden;
}

.chat-manager-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  max-width: 100%;
  box-sizing: border-box;
}

.chat-manager-item:hover {
  background: var(--bg-tertiary);
  border-color: var(--accent);
}

.chat-manager-item.selected {
  background: rgba(59, 130, 246, 0.1);
  border-color: var(--accent);
}

.chat-item-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  flex-shrink: 0;
}

.chat-item-content {
  flex: 1;
  min-width: 0;
}

.chat-item-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  margin: 0 0 4px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-item-title .bookmark-icon {
  flex-shrink: 0;
  color: #FFD700;
  opacity: 0.9;
}

.chat-item-meta {
  font-size: 13px;
  color: var(--text-secondary);
}

.chat-item-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s;
}

.chat-manager-item:hover .chat-item-actions {
  opacity: 1;
}

.chat-item-action-btn {
  padding: 6px;
  background: transparent;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-item-action-btn:hover {
  background: var(--bg-primary);
  color: var(--text-primary);
}

.chat-item-action-btn.bookmarked {
  color: #FFD700;
}

.chat-item-action-btn.bookmarked:hover {
  color: #FFC700;
}

/* Empty State */
.empty-chat-manager {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.empty-chat-manager p:first-child {
  font-size: 18px;
  font-weight: 500;
  color: var(--text-primary);
  margin: 0 0 8px 0;
}

/* Select Mode */
.chat-manager-list.select-mode .chat-item-checkbox {
  display: block;
}

.chat-manager-list:not(.select-mode) .chat-item-checkbox {
  display: none;
}

/* Responsive */
@media (max-width: 768px) {
  .chat-manager-container {
    padding: 24px 16px;
    max-width: 100%;
    overflow-x: hidden;
  }

  .chat-manager-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .new-chat-btn-primary {
    width: 100%;
    justify-content: center;
  }

  .chat-manager-title {
    font-size: 24px;
  }

  .chat-manager-item {
    flex-wrap: nowrap;
    max-width: 100%;
    overflow: hidden;
    padding: 12px 8px;
    gap: 8px;
  }

  .chat-item-content {
    flex: 1;
    min-width: 0;
    overflow: hidden;
  }

  .chat-item-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  .chat-item-actions {
    opacity: 1;
    flex-shrink: 0;
    gap: 2px;
  }

  .chat-item-action-btn {
    padding: 4px;
    width: 32px;
    height: 32px;
  }

  .chat-item-action-btn svg {
    width: 16px;
    height: 16px;
  }

  .bulk-actions-bar {
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
  }

  .bulk-actions-right {
    justify-content: space-between;
  }

  .chat-manager-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .chat-filter-controls {
    width: 100%;
    justify-content: flex-start;
  }
}

/* Active Navigation Item */
.nav-item.active {
  background: var(--bg-tertiary);
  color: var(--accent);
}

.nav-item.active .nav-item-icon svg {
  stroke: var(--accent);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}



/* ============================================
   HEADER BRANDING STYLES
   ============================================ */

.header-branding {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-right: 24px;
}

.header-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.header-brand-text {
  font-size: 20px;
  font-weight: 600;
  background: linear-gradient(135deg, #1779a1 0%, #40b9c5 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
}

/* Hide on mobile */
@media (max-width: 768px) {
  .header-brand-text {
    display: none;
  }
}



/* ============================================
   MESSAGE ACTION BUTTONS
   ============================================ */

.message-content-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.message-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.message.assistant:hover .message-actions {
  opacity: 1;
}

.action-icon {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 6px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.action-icon:hover {
  background: var(--bg-tertiary);
  border-color: var(--accent);
  color: var(--text-primary);
}

.action-icon.active {
  border-color: var(--accent);
  background: var(--bg-tertiary);
}

.action-icon.active svg {
  fill: #ffffff !important; /* Solid white fill for active feedback */
  stroke: #ffffff !important;
}

.action-icon svg {
  width: 16px;
  height: 16px;
  fill: none; /* Default - no fill, only stroke */
}

/* ============================================
   FEEDBACK MODAL STYLES
   ============================================ */

/* Large modal for feedback view */
.modal.large-modal {
  max-width: 700px;
  width: 90%;
}

/* Feedback filter controls */
.feedback-filter-controls {
  margin-bottom: 20px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.feedback-filter-controls label {
  font-weight: 500;
  color: var(--text-primary);
  margin-right: 4px;
}

/* Feedback list container */
.feedback-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 500px;
  overflow-y: auto;
  padding: 2px; /* Prevent box shadow clipping */
}

/* Empty state in feedback list */
.feedback-list .empty-state {
  position: static;
  transform: none;
  padding: 40px;
  text-align: center;
}

.feedback-list .loading-state {
  padding: 40px;
  text-align: center;
  color: var(--text-secondary);
}

/* Feedback item card */
.feedback-item {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 12px;
  background: var(--bg-secondary);
  transition: all 0.2s;
}

.feedback-item:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(23, 121, 161, 0.1);
}

/* Success and error colors are now defined in the main :root section at the top of this file */

/* Mobile responsive for feedback modal */
@media (max-width: 768px) {
  .modal.large-modal {
    width: 95%;
    max-height: 90vh;
  }

  .feedback-filter-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .feedback-list {
    max-height: 400px;
  }
}



/* ============================================
   UNIVERSAL CARD COMPONENT
   ============================================ */

.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  transition: all 0.2s ease;
  overflow-x: hidden;
  max-width: 100%;
}

.card:hover {
  border-color: var(--accent);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.card-header h2,
.card-header h3 {
  margin: 0;
  font-size: 1.25rem;
  color: var(--text-primary);
}

.card-body {
  color: var(--text-secondary);
  line-height: 1.6;
}

.card-footer {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

/* ============================================
   UNIVERSAL EMPTY STATE COMPONENT
   ============================================ */

.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-secondary);
}

.empty-state svg,
.empty-state img {
  margin-bottom: 1.5rem;
  opacity: 0.3;
  width: 80px;
  height: 80px;
}

.empty-state h1,
.empty-state h2,
.empty-state h3 {
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  font-size: 1.75rem;
}

.empty-state p {
  margin-bottom: 2rem;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
  font-size: 1rem;
  line-height: 1.6;
}

/* ============================================
   UNIVERSAL LOADING SPINNER
   ============================================ */

.loading {
  text-align: center;
  padding: 3rem;
  color: var(--text-secondary);
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================
   FIX HORIZONTAL SCROLLBAR OVERFLOW
   ============================================ */

/* Prevent horizontal overflow on all pages */
html, body {
  overflow-x: hidden !important;
  max-width: 100vw !important;
}

body.subs-page {
  overflow-x: hidden !important;
  max-width: 100vw !important;
}

.main-content {
  overflow-x: hidden !important;
  max-width: 100% !important;
}

.container {
  overflow-x: hidden !important;
  max-width: 100% !important;
}

/* Ensure grid items don't cause overflow */
.grid {
  overflow-x: hidden !important;
}

