/**
 * Axon App - Application-Specific Styles
 *
 * This file contains styles specific to the main chat application.
 * Requires variables.css and components.css to be loaded first.
 */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Outfit:wght@500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ===========================================
   APP BODY OVERRIDES
   =========================================== */

body {
  height: 100vh;
  overflow: hidden;
  /* Subtle mesh gradient background */
  background-image:
    radial-gradient(circle at 15% 50%, rgba(16, 163, 127, 0.08), transparent 25%),
    radial-gradient(circle at 85% 30%, rgba(88, 101, 242, 0.05), transparent 25%);
}

/* ===========================================
   CUSTOM SCROLLBARS
   =========================================== */

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

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

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

/* ===========================================
   AUTH LAYOUT
   =========================================== */

.auth-wrapper {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 10;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 40px;
  background: rgba(23, 25, 30, 0.6);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-round);
  box-shadow: var(--shadow-lg);
  text-align: center;
  position: relative;
  overflow: hidden;
}

/* Auth glow effect */
.auth-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.03) 0%, transparent 60%);
  pointer-events: none;
}

.auth-brand h1 {
  font-size: var(--text-3xl);
  background: linear-gradient(135deg, #fff 0%, #a5b4fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: var(--spacing-sm);
}

.auth-brand p {
  color: var(--text-muted);
  margin-bottom: var(--spacing-lg);
}

.auth-form .form-group {
  text-align: left;
}

.auth-toggle {
  margin-top: var(--spacing-lg);
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.auth-toggle button {
  background: none;
  border: none;
  color: var(--accent-primary);
  cursor: pointer;
  font-weight: 500;
}

.auth-toggle button:hover {
  text-decoration: underline;
}

.auth-error {
  color: var(--color-error);
  font-size: var(--text-sm);
  margin-top: var(--spacing-sm);
  text-align: center;
}

/* ===========================================
   MAIN APP LAYOUT
   =========================================== */

.app-container {
  display: flex;
  height: 100vh;
}

/* ===========================================
   SIDEBAR
   =========================================== */

.sidebar {
  width: 280px;
  background: var(--bg-panel-glass);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  z-index: 50;
  transition: width var(--transition-smooth);
}

.sidebar-header {
  padding: var(--spacing-lg);
}

.new-chat-btn {
  width: 100%;
  background: var(--bg-hover);
  border: 1px solid var(--border-light);
  color: var(--text-main);
  padding: 12px var(--spacing-md);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
}

.new-chat-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.new-chat-btn svg {
  stroke-width: 2px;
  width: 18px;
  height: 18px;
}

/* Conversations List */
.conversations-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px var(--spacing-md);
}

.conversations-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin: var(--spacing-md) 0 var(--spacing-sm) 12px;
}

.conversation-item {
  padding: 10px 12px;
  font-size: var(--text-base);
  color: var(--text-muted);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-fast);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversation-item:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.conversation-item.active {
  background: var(--accent-subtle);
  color: var(--accent-primary);
  font-weight: 500;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: var(--spacing-md);
  border-top: 1px solid var(--border-light);
  position: relative;
}

.user-section {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: var(--transition-fast);
}

.user-section:hover {
  background: var(--bg-hover);
}

.user-avatar {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent-primary), #059669);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: white;
  font-size: var(--text-md);
  box-shadow: 0 0 10px var(--accent-glow);
  flex-shrink: 0;
}

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

.user-name {
  font-weight: 500;
  font-size: var(--text-base);
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-plan {
  font-size: var(--text-xs);
  color: var(--text-dim);
}

.user-menu-icon {
  width: 16px;
  height: 16px;
  color: var(--text-dim);
}

/* User Menu Dropdown */
.user-menu {
  position: absolute;
  bottom: 70px;
  left: var(--spacing-md);
  right: var(--spacing-md);
  background: rgb(30, 32, 38);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  z-index: var(--z-dropdown);
}

.user-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px var(--spacing-md);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-fast);
}

.user-menu-item:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.user-menu-item svg {
  width: 16px;
  height: 16px;
  opacity: 0.7;
}

.user-menu-logout:hover {
  background: var(--color-error-bg);
  color: var(--color-error);
}

.user-menu-logout:hover svg {
  opacity: 1;
}

/* ===========================================
   CHAT AREA
   =========================================== */

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  background: radial-gradient(circle at 50% -20%, rgba(16, 163, 127, 0.05), transparent 40%);
}

/* Chat Header */
.chat-header {
  height: 60px;
  padding: 0 var(--spacing-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-light);
  backdrop-filter: blur(8px);
  z-index: 10;
  gap: var(--spacing-md);
}

/* Account Switcher - Multi-account support */
.account-switcher {
  position: relative;
  margin-left: auto;
}

.account-switcher-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.account-switcher-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-primary);
}

.account-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 200px;
  max-width: 280px;
  background: rgb(30, 32, 38);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 100;
  overflow: hidden;
}

.account-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  color: var(--text-main);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s ease;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.account-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.account-dropdown-item.active {
  background: rgba(16, 163, 127, 0.1);
  color: var(--brand-primary);
}

.account-dropdown-item .account-check {
  margin-left: auto;
  color: var(--brand-primary);
  font-size: 16px;
}

.account-dropdown-item .account-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-dropdown-item .account-location {
  font-size: 11px;
  color: var(--text-dim);
  opacity: 0.7;
}

/* Agency Dropdown Enhancements */
.account-dropdown-header {
  padding: 8px 14px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--border-light);
}

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

.account-dropdown-item.agency-overview {
  background: linear-gradient(90deg, rgba(16, 163, 127, 0.08), transparent);
  border-bottom: 1px solid var(--border-light);
}

.account-dropdown-item.agency-overview .account-icon {
  width: 24px;
  height: 24px;
  background: linear-gradient(135deg, var(--brand-primary), #059669);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.account-dropdown-item.sub-account {
  padding-left: 28px;
  position: relative;
}

.account-dropdown-item.sub-account::before {
  content: '';
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border-primary);
}

.account-dropdown-item.sub-account:hover::before {
  background: var(--brand-primary);
}

.account-dropdown-item.sub-account.active::before {
  background: var(--brand-primary);
}

/* Tool Sections Grid */
.tool-sections-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-top: var(--spacing-md);
}

.tool-section-card {
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.15s ease;
}

.tool-section-card:hover {
  border-color: var(--border-primary);
}

.tool-section-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tool-section-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-main);
  text-transform: capitalize;
}

.tool-section-count {
  font-size: 12px;
  color: var(--text-dim);
}

.tool-section-toggle {
  width: 44px;
  height: 24px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  position: relative;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tool-section-toggle::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: transform 0.2s ease;
}

.tool-section-toggle.active {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
}

.tool-section-toggle.active::after {
  transform: translateX(20px);
}

.tool-section-card.disabled {
  opacity: 0.5;
}

.tool-section-card.disabled .tool-section-name {
  text-decoration: line-through;
}

/* Messages Container */
.messages-wrapper {
  flex: 1;
  overflow-y: auto;
  padding: var(--spacing-lg) 0;
  scroll-behavior: smooth;
}

.messages {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 var(--spacing-lg);
}

/* Individual Message */
.message {
  margin-bottom: var(--spacing-lg);
  opacity: 0;
  animation: slideUpFade 0.3s forwards;
  display: flex;
}

.message.user {
  justify-content: flex-end;
}

.message.assistant {
  justify-content: flex-start;
}

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

/* Message Bubbles */
.message-bubble {
  max-width: 85%;
  padding: 14px 18px;
  border-radius: 20px;
}

.message-bubble.user {
  background: var(--accent-primary);
  border-bottom-right-radius: 6px;
}

.message-bubble.assistant {
  background: rgba(45, 48, 55, 0.8);
  border: 1px solid var(--border-light);
  border-bottom-left-radius: 6px;
}

.message-content {
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--text-main);
}

.message-bubble.user .message-content {
  color: white;
}

/* Tool status adjusts for new structure */
.message-bubble .tool-status-container {
  margin-top: var(--spacing-md);
  padding-left: 0;
}

/* Code Blocks in Messages */
.message-content pre {
  background: #1e1e1e;
  border: 1px solid var(--border-solid);
  border-radius: var(--radius-md);
  padding: var(--spacing-md);
  margin: var(--spacing-md) 0;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

.message-content code {
  font-family: var(--font-mono);
}

.message-content p {
  margin-bottom: var(--spacing-sm);
}

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

/* Links in Messages - High contrast for accessibility */
.message-content a {
  color: #60a5fa;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.message-content a:hover {
  color: #93c5fd;
}

.message-bubble.user .message-content a {
  color: #bfdbfe;
}

.message-bubble.user .message-content a:hover {
  color: #ffffff;
}

/* Tool Status Indicators - Enhanced */
.tool-status-container {
  margin-top: var(--spacing-md);
}

.tool-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(30, 32, 38, 0.8);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--spacing-sm);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.tool-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--border-solid);
  transition: background 0.3s ease;
}

.tool-item.active {
  border-color: rgba(16, 163, 127, 0.4);
  background: rgba(16, 163, 127, 0.08);
  color: var(--text-main);
}

.tool-item.active::before {
  background: var(--accent-primary);
  animation: pulse-bar 1.5s ease-in-out infinite;
}

@keyframes pulse-bar {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.tool-item.success {
  border-color: rgba(16, 163, 127, 0.3);
  background: rgba(16, 163, 127, 0.05);
  color: var(--text-muted);
}

.tool-item.success::before {
  background: var(--accent-primary);
}

/* Retry state - AI is adapting, not failing */
.tool-item.retry {
  border-color: rgba(156, 163, 175, 0.3);
  background: rgba(156, 163, 175, 0.05);
  color: var(--text-muted);
}

.tool-item.retry::before {
  background: var(--text-dim);
}

.tool-icon {
  font-size: 18px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  flex-shrink: 0;
}

.tool-item.active .tool-icon {
  background: rgba(16, 163, 127, 0.15);
}

.tool-item.success .tool-icon {
  background: rgba(16, 163, 127, 0.1);
  color: var(--accent-primary);
}

.tool-item.retry .tool-icon {
  background: rgba(156, 163, 175, 0.1);
  color: var(--text-dim);
}

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

.tool-name {
  font-weight: 500;
  color: var(--text-main);
  margin-bottom: 2px;
}

.tool-item.success .tool-name,
.tool-item.retry .tool-name {
  color: var(--text-muted);
}

.tool-detail {
  font-size: var(--text-xs);
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tool-status-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-xs);
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--radius-round);
  flex-shrink: 0;
}

.tool-item.active .tool-status-badge {
  background: rgba(16, 163, 127, 0.2);
  color: var(--accent-primary);
}

.tool-item.success .tool-status-badge {
  background: rgba(16, 163, 127, 0.1);
  color: var(--accent-primary);
}

.tool-item.retry .tool-status-badge {
  background: rgba(156, 163, 175, 0.1);
  color: var(--text-dim);
}

.tool-spinner {
  animation: spin 1s linear infinite;
  font-size: 12px;
}

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

/* ===========================================
   INPUT AREA
   =========================================== */

.input-wrapper {
  background: linear-gradient(to top, var(--bg-dark) 80%, transparent 100%);
  padding: var(--spacing-lg) var(--spacing-lg) 30px;
  z-index: 20;
}

.input-container {
  max-width: 800px;
  margin: 0 auto;
  position: relative;
  background: rgba(47, 47, 47, 0.6);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-md);
  transition: var(--transition-fast);
}

.input-container:focus-within {
  border-color: var(--accent-primary);
  box-shadow: 0 8px 32px rgba(16, 163, 127, 0.15);
}

.input-box {
  width: 100%;
  background: transparent;
  border: none;
  color: white;
  padding: 18px 60px 18px var(--spacing-lg);
  font-size: var(--text-lg);
  font-family: var(--font-body);
  resize: none;
  max-height: 200px;
  line-height: 1.5;
}

.input-box:focus {
  outline: none;
}

.input-box::placeholder {
  color: var(--text-dim);
}

.send-btn {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 36px;
  height: 36px;
  background: var(--accent-primary);
  border: none;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
}

.send-btn:hover {
  background: var(--accent-hover);
  transform: scale(1.05);
}

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

.send-btn svg {
  fill: white;
  width: 18px;
  height: 18px;
}

/* ===========================================
   SCROLL TO BOTTOM BUTTON
   =========================================== */

.scroll-to-bottom-btn {
  position: absolute;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 40px;
  background: var(--bg-panel);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  opacity: 1;
  z-index: 50;
  box-shadow: var(--shadow-md);
}

.scroll-to-bottom-btn:hover {
  background: var(--bg-hover);
  color: var(--text-main);
  transform: translateX(-50%) translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.scroll-to-bottom-btn.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(10px);
}

/* ===========================================
   WELCOME SCREEN
   =========================================== */

.welcome {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 60px var(--spacing-lg);
  margin-top: 40px;
}

/* Welcome Message - Axon's greeting */
.welcome-message {
  display: flex;
  gap: 16px;
  max-width: 600px;
  text-align: left;
}

.welcome-avatar {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--accent-primary), #0ea5e9);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.welcome-content {
  flex: 1;
}

.welcome-title {
  font-size: var(--text-2xl);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 16px 0;
  background: linear-gradient(135deg, #fff, #99f6e4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.welcome-text {
  color: var(--text-secondary);
  font-size: var(--text-base);
  line-height: 1.6;
  margin: 0 0 12px 0;
}

.welcome-text strong {
  color: var(--text-primary);
}

.welcome-icon-inline {
  display: inline;
  font-size: 14px;
}

.welcome-hint {
  color: var(--text-muted);
  font-size: var(--text-sm);
  margin: 16px 0 0 0;
  font-style: italic;
}

/* Suggestion Cards - shown when GHL is connected */
.suggestion-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--spacing-md);
  margin-top: var(--spacing-lg);
  max-width: 600px;
}

.suggestion-card {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-md) var(--spacing-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
  color: var(--text-main);
  font-size: var(--text-base);
}

.suggestion-card:hover {
  background: var(--bg-hover);
  border-color: var(--accent-primary);
  transform: translateY(-1px);
}

.suggestion-card .suggestion-icon {
  font-size: 20px;
}

.suggestion-icon {
  font-size: 24px;
  line-height: 1;
  flex-shrink: 0;
}

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

.suggestion-text strong {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-main);
}

.suggestion-text span {
  font-size: var(--text-sm);
  color: var(--text-dim);
}

@media (max-width: 600px) {
  .suggestion-cards {
    grid-template-columns: 1fr;
  }
}

/* ===========================================
   ERROR STATES
   =========================================== */

.rate-limit-error {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-md);
  background: var(--color-error-bg);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-xl);
  padding: var(--spacing-lg);
  margin: var(--spacing-sm) 0;
}

.rate-limit-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.rate-limit-message strong {
  display: block;
  color: var(--color-error);
  margin-bottom: var(--spacing-sm);
  font-size: var(--text-md);
}

.rate-limit-message p {
  color: var(--text-muted);
  font-size: var(--text-base);
  margin: 0;
  line-height: 1.5;
}

.rate-limit-reset {
  margin-top: var(--spacing-sm) !important;
  font-size: var(--text-sm) !important;
  color: var(--text-dim) !important;
}

.error-text {
  color: var(--color-error);
  font-size: var(--text-base);
  padding: 12px;
  background: var(--color-error-bg);
  border-radius: var(--radius-md);
}

/* Notice Container - friendly, not alarming */
.error-container {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-md);
  background: rgba(156, 163, 175, 0.08);
  border: 1px solid rgba(156, 163, 175, 0.2);
  border-radius: var(--radius-xl);
  padding: var(--spacing-lg);
}

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

.error-content {
  flex: 1;
}

.error-title {
  display: block;
  color: var(--text-main);
  font-size: var(--text-md);
  margin-bottom: var(--spacing-xs);
}

.error-detail {
  color: var(--text-muted);
  font-size: var(--text-base);
  margin: 0 0 var(--spacing-sm) 0;
  line-height: 1.5;
}

.error-suggestion {
  color: var(--text-dim);
  font-size: var(--text-sm);
  margin: 0;
  padding-top: var(--spacing-sm);
  border-top: 1px solid rgba(156, 163, 175, 0.15);
}

/* ===========================================
   SETTINGS MODAL SPECIFIC
   =========================================== */

.settings-section {
  margin-bottom: var(--spacing-lg);
}

.settings-section h4 {
  font-size: var(--text-lg);
  font-weight: 600;
  margin-bottom: var(--spacing-sm);
}

.settings-description {
  color: var(--text-muted);
  font-size: var(--text-sm);
  margin-bottom: var(--spacing-md);
}

.settings-actions {
  display: flex;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-md);
}

#settings-test-result {
  margin-top: var(--spacing-md);
  padding: 12px;
  border-radius: var(--radius-md);
}

/* GHL Connection Status */
.ghl-status {
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  margin-bottom: var(--spacing-md);
}

.ghl-status.connected {
  background: var(--color-success-bg);
  border: 1px solid var(--accent-primary);
}

.ghl-status.disconnected {
  background: var(--bg-hover);
  border: 1px solid var(--border-solid);
}

.ghl-status-label {
  font-size: var(--text-sm);
  font-weight: 500;
}

.ghl-status.connected .ghl-status-label {
  color: var(--accent-primary);
}

.ghl-status.disconnected .ghl-status-label {
  color: var(--text-muted);
}

/* ===========================================
   RESPONSIVE
   =========================================== */

/* Mobile Menu Button - Hidden on desktop */
.mobile-menu-btn {
  display: none;
  background: transparent;
  border: none;
  padding: 8px;
  cursor: pointer;
  color: var(--text-main);
  border-radius: var(--radius-md);
  transition: background 0.2s;
}

.mobile-menu-btn:hover {
  background: var(--bg-hover);
}

.mobile-menu-btn svg {
  width: 24px;
  height: 24px;
}

/* Sidebar Overlay - Hidden by default */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.visible {
  display: block;
  opacity: 1;
}

@media (max-width: 768px) {
  /* Show mobile menu button */
  .mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Chat header layout for mobile */
  .chat-header {
    display: flex;
    align-items: center;
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border-light);
  }

  /* Sidebar slides in from left */
  .sidebar {
    position: fixed;
    left: -280px;
    height: 100vh;
    z-index: 100;
    transition: left 0.3s ease;
  }

  .sidebar.open {
    left: 0;
  }

  /* Show overlay when sidebar is open */
  .sidebar.open ~ .sidebar-overlay {
    display: block;
    opacity: 1;
  }

  .suggestion-chips {
    flex-direction: column;
  }

  .suggestion-chip {
    text-align: center;
  }

  .suggestion-cards {
    padding: 0 var(--spacing-sm);
  }

  .suggestion-card {
    padding: var(--spacing-md);
  }

  .messages {
    padding: 0 var(--spacing-md);
  }

  .input-wrapper {
    padding: var(--spacing-md);
  }

  .modal {
    margin: var(--spacing-md);
    max-width: calc(100% - var(--spacing-xl));
  }

  /* Ensure touch targets are at least 44px */
  .send-btn {
    min-width: 44px;
    min-height: 44px;
  }

  .new-chat-btn {
    min-height: 44px;
  }

  .conversation-item {
    min-height: 44px;
    display: flex;
    align-items: center;
  }
}

/* ===========================================
   CONFIRMATION MODAL
   =========================================== */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.modal-overlay .modal {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  max-width: 90vw;
  max-height: 90vh;
  overflow: auto;
}

.modal-overlay .modal-header {
  padding: var(--spacing-md) var(--spacing-lg);
  border-bottom: 1px solid var(--border-color);
}

.modal-overlay .modal-header h3 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--text-primary);
}

.modal-overlay .modal-body {
  padding: var(--spacing-lg);
}

.modal-overlay .modal-footer {
  padding: var(--spacing-md) var(--spacing-lg);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: var(--spacing-sm);
}

.confirmation-modal {
  max-width: 420px;
}

.confirmation-intro {
  color: var(--text-secondary);
  margin-bottom: var(--spacing-md);
}

.confirmation-actions {
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-md);
  padding: var(--spacing-sm);
  margin-bottom: var(--spacing-md);
}

.confirmation-action {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm);
  border-radius: var(--radius-sm);
}

.confirmation-action + .confirmation-action {
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  margin-top: var(--spacing-xs);
  padding-top: var(--spacing-sm);
}

.confirmation-action-emoji {
  font-size: 1.5rem;
  line-height: 1;
  flex-shrink: 0;
}

.confirmation-action-details {
  flex: 1;
  min-width: 0;
}

.confirmation-action-name {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.confirmation-action-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  word-break: break-word;
}

.confirmation-warning {
  font-size: 0.85rem;
  color: var(--warning);
  background: rgba(234, 179, 8, 0.1);
  border: 1px solid rgba(234, 179, 8, 0.2);
  border-radius: var(--radius-sm);
  padding: var(--spacing-sm);
  margin-bottom: var(--spacing-md);
}

.btn-danger {
  background: var(--error);
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
}

/* Cancelled tool item state */
.tool-item.cancelled {
  opacity: 0.7;
  border-left: 3px solid var(--text-muted);
}

.tool-item.cancelled .tool-icon {
  color: var(--text-muted);
}
