/* ============================================
   SEO TOOL PRO - MAIN STYLES
   Dark Mode + Glassmorphism Design System
   ============================================ */

:root {
  /* Typography Variables */
  --font-size-xs: 0.72rem;
  --font-size-sm: 0.8rem;
  --font-size-md: 0.875rem;
  --font-size-lg: 1rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.35rem;
  --line-height-tight: 1.25;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.625;

  /* Global Typography Foundation Tokens */
  --font-size-page-title: 17.5px;
  --line-height-page-title: 1.2;
  --font-weight-page-title: 700;

  --font-size-section-title: 13.5px;
  --line-height-section-title: 1.3;
  --font-weight-section-title: 600;

  --font-size-card-title: 13px;
  --line-height-card-title: 1.35;
  --font-weight-card-title: 600;

  --font-size-body: 13px;
  --line-height-body: 1.5;
  --font-weight-body: 400;

  --font-size-meta: 11.2px;
  --line-height-meta: 1.4;

  --font-size-form-label: 11.2px;
  --font-size-form-control: 11.48px;
  --line-height-form-control: 1.4;

  --font-size-table-header: 11px;
  --font-size-table-cell: 11.5px;
  --line-height-table-cell: 1.4;

  --font-size-badge: 10.5px;
  --line-height-badge: 1;
  --font-weight-badge: 600;

  --font-size-metric-value: 23px;
  --font-size-metric-value-sm: 17.5px;
  --line-height-metric-value: 1.2;

  /* Global Theme Tokens (Dark mode by default) */
  --app-bg: #050A12;
  --sidebar-bg: linear-gradient(180deg, #06101E 0%, #030810 100%);
  --sidebar-elevated: #0B1628;
  --topbar-bg: #0B1422;
  --surface: #0B1422;
  --surface-subtle: #101C2E;
  --surface-elevated: #111F33;
  --border: #243247;
  --text-primary: #F7FAFF;
  --text-secondary: #A8B3C7;
  --brand-primary: #29A8FF;
  --brand-primary-hover: #148BDE;
  --brand-cyan: #14E2D0;
  --brand-gold: #F2C45B;
  --brand-gold-deep: #C7922D;
  --brand-gold-soft: rgba(242, 196, 91, 0.12);
  --success: #12B76A;
  --warning: #F59E0B;
  --danger: #EF4444;

  /* Sidebar color roles (Dark mode) */
  --sidebar-text: #A8B3C7;
  --sidebar-text-active: #EAF7FF;
  --sidebar-icon-active: #38BDF8;
  --sidebar-bg-active: rgba(0, 140, 255, 0.22);
  --sidebar-bg-hover: rgba(0, 140, 255, 0.10);
  --sidebar-group-active-bg: rgba(0, 140, 255, 0.16);
  --sidebar-group-active-text: #38BDF8;
  --sidebar-accent-rail: #008CFF;

  /* Hover color for text links / tabs / small actions */
  --link-hover-color: var(--brand-gold);

  /* Backward compatibility aliases */
  --brand-secondary: var(--brand-cyan);
  --brand-accent: var(--brand-cyan);
  --brand-glow: rgba(41, 168, 255, 0.15);

  --geo-primary-blue: var(--brand-primary);
  --geo-cyan-accent: var(--brand-cyan);
  --geo-brand-gold: var(--brand-gold);
  --geo-app-bg: var(--app-bg);
  --geo-surface: var(--surface);
  --geo-border: var(--border);

  /* Legacy variable mapping to keep existing styles perfectly compatible */
  --bg-primary: var(--app-bg);
  --bg-secondary: var(--sidebar-bg);
  --bg-tertiary: var(--surface-subtle);
  --bg-card: var(--surface);
  --bg-card-hover: var(--surface-elevated);
  --bg-input: var(--surface-elevated);
  --bg-glass: var(--topbar-bg);
  --border-primary: var(--border);
  --border-card: var(--border);
  --border-focus: var(--brand-primary);
  --text-muted: var(--text-secondary);
  --text-placeholder: var(--text-secondary);

  /* Semantic Colors */
  --success-bg: rgba(18, 183, 106, 0.1);
  --warning-bg: rgba(245, 158, 11, 0.1);
  --danger-bg: rgba(239, 68, 68, 0.1);
  --info: var(--brand-primary);
  --info-bg: rgba(41, 168, 255, 0.1);

  /* AI Provider Colors */
  --openai-color: #10a37f;
  --gemini-color: #4285f4;
  --claude-color: #d97706;

  /* Intent Colors */
  --intent-info: var(--brand-primary);
  --intent-commercial: var(--brand-cyan);
  --intent-transactional: var(--success);
  --intent-navigational: var(--warning);

  /* Text */
  --text-placeholder: var(--text-secondary);

  /* Layout */
  --sidebar-width: 260px;
  --header-height: 60px;
  --border-radius-sm: 5px;
  --border-radius-md: 5px;
  --border-radius-lg: 5px;
  --border-radius-xl: 5px;
  --border-radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 30px var(--brand-glow);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }


/* ============================================
   LIGHT THEME OVERRIDES
   ============================================ */
[data-theme="light"] {
  /* Global Theme Tokens (Light mode) */
  --app-bg: #F5F8FC;
  --sidebar-bg: linear-gradient(180deg, #E2EFFF 0%, #BADDFC 100%);
  --sidebar-elevated: #D9E2EF;
  --topbar-bg: #FFFFFF;
  --surface: #FFFFFF;
  --surface-subtle: #F9FBFF;
  --surface-elevated: #F2F6FC;
  --border: #D9E2EF;
  --text-primary: #0B1220;
  --text-secondary: #526173;
  --brand-primary: #008CFF;
  --brand-primary-hover: #006FD6;
  --brand-cyan: #00D1C7;
  --brand-gold: #D6A53A;
  --brand-gold-deep: #9A6B12;
  --brand-gold-soft: #FFF4D6;
  --success: #12B76A;
  --warning: #F59E0B;
  --danger: #EF4444;

  /* Sidebar color roles (Light mode) */
  --sidebar-bg: linear-gradient(180deg, #F2F6FF 0%, #E5F3FF 100%);
  --sidebar-text: #334155;
  --sidebar-text-active: #005BBB;
  --sidebar-icon-active: #005BBB;
  --sidebar-bg-active: rgba(0, 140, 255, 0.16);
  --sidebar-bg-hover: rgba(0, 140, 255, 0.07);
  --sidebar-group-active-bg: rgba(0, 140, 255, 0.12);
  --sidebar-group-active-text: #005BBB;
  --sidebar-accent-rail: #008CFF;

  /* Hover color for text links / tabs / small actions */
  --link-hover-color: var(--brand-gold-deep);

  /* Backward compatibility aliases */
  --brand-secondary: var(--brand-cyan);
  --brand-accent: var(--brand-cyan);
  --brand-glow: rgba(0, 140, 255, 0.15);

  --geo-primary-blue: var(--brand-primary);
  --geo-cyan-accent: var(--brand-cyan);
  --geo-brand-gold: var(--brand-gold);
  --geo-app-bg: var(--app-bg);
  --geo-surface: var(--surface);
  --geo-border: var(--border);

  /* Legacy variable mapping to keep existing styles perfectly compatible */
  --bg-primary: var(--app-bg);
  --bg-secondary: var(--sidebar-bg);
  --bg-tertiary: var(--surface-subtle);
  --bg-card: var(--surface);
  --bg-card-hover: var(--surface-elevated);
  --bg-input: var(--surface-elevated);
  --bg-glass: var(--topbar-bg);
  --border-primary: var(--border);
  --border-card: var(--border);
  --border-focus: var(--brand-primary);
  --text-muted: var(--text-secondary);
  --text-placeholder: var(--text-secondary);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.16);
  --shadow-glow: 0 0 30px rgba(0, 140, 255, 0.15);
}

/* Smooth theme transitions */
*, *::before, *::after {
  transition: background-color 0.25s ease, border-color 0.2s ease, color 0.15s ease;
}
/* Disable transition on interactive + animated elements */
button, a, input, select, textarea,
.spinner, [class*="animate"], [style*="animation"] {
  transition: none;
}
.btn, .nav-item, .tab-btn, .chip { transition: all 0.15s ease !important; }

/* Light theme specific adjustments */
[data-theme="light"] .card::before {
  background: linear-gradient(90deg, transparent, rgba(0,0,0,0.05), transparent);
}
[data-theme="light"] .data-table thead th {
  background: rgba(0,0,0,0.03);
}
[data-theme="light"] .data-table tbody tr {
  border-bottom-color: rgba(0,0,0,0.05);
}
[data-theme="light"] ::-webkit-scrollbar-track { background: #e0e0ef; }
[data-theme="light"] ::-webkit-scrollbar-thumb { background: rgba(0, 140, 255, 0.25); }

/* Light theme — nav group header label colors */
[data-theme="light"] .nav-group-header > span:first-child,
[data-theme="light"] .nav-group-header > .nav-group-label { color: #475569 !important; }
[data-theme="light"] .nav-group-header:hover > span:first-child,
[data-theme="light"] .nav-group-header:hover > .nav-group-label { color: var(--sidebar-text-active) !important; }

/* Light theme — active nav item text */
[data-theme="light"] .nav-item.active { color: var(--sidebar-text-active) !important; }

/* Global interactive element hovers (excluding specific classes if needed) */
a:hover, .action-link:hover, .tab-btn:hover {
  color: var(--link-hover-color) !important;
}

/* ─── Theme Toggle Button ─── */
.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: 5px;
  border: 1px solid var(--border-primary);
  background: var(--bg-input);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all 0.2s ease !important;
  flex-shrink: 0;
}
.theme-toggle:hover {
  background: var(--bg-card-hover);
  border-color: var(--brand-primary);
  transform: rotate(20deg);
}

html { font-size: 14px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: rgba(0, 140, 255, 0.3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--brand-primary); }

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

#app {
  min-height: 100vh;
}

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

.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg, var(--bg-secondary));
  border-right: 1px solid var(--border-primary);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  transition: transform var(--transition-base);
  backdrop-filter: blur(20px);
  overflow: hidden; /* prevent full-page overflow */
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: linear-gradient(135deg, #008CFF 0%, #005BBB 100%);
  border-bottom: 1px solid rgba(0, 91, 187, 0.3);
  transition: background var(--transition-base);
}

[data-theme="dark"] .sidebar-brand {
  background: linear-gradient(135deg, #0B192C 0%, #1E293B 100%);
  border-bottom: 1px solid var(--border-primary);
}

.brand-icon {
  width: 36px;
  height: 36px;
  background: transparent;
  border-radius: var(--border-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.brand-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-text { display: flex; flex-direction: column; }
.brand-name { font-size: 1rem; font-weight: 700; color: #FFFFFF !important; letter-spacing: -0.3px; }
.brand-version { font-size: 0.75rem; color: rgba(255, 255, 255, 0.8) !important; }

.sidebar-nav {
  flex: 1;
  padding: 10px 10px;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 1px;
  /* custom scrollbar */
  scrollbar-width: thin;
  scrollbar-color: rgba(0,140,255,0.3) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(0,140,255,0.3); border-radius: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb:hover { background: rgba(0,140,255,0.6); }

.nav-section-label {
  font-size: 0.67rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 5px 10px 2px;
  text-transform: uppercase;
}

/* ── Nav Group spacing & Active State ── */
.nav-group {
  margin-top: 4px;
}

.nav-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--text-muted);
  margin-bottom: 4px !important;
}

.nav-group-header:hover {
  background: var(--sidebar-bg-hover);
  color: var(--sidebar-group-active-text);
}

.nav-group:not(.collapsed) > .nav-group-header,
.nav-group.active > .nav-group-header {
  background: var(--sidebar-group-active-bg) !important;
  color: var(--sidebar-group-active-text) !important;
  font-weight: 700 !important;
}

.nav-group:not(.collapsed) > .nav-group-header .nav-group-chevron,
.nav-group.active > .nav-group-header .nav-group-chevron {
  opacity: 0.9;
  color: var(--sidebar-group-active-text);
}

/* Space between group title and its items */
.nav-group-items {
  padding-top: 4px;
  padding-bottom: 3px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Chevron icon in group headers */
.nav-group-chevron {
  transition: transform 0.25s ease;
  opacity: 0.5;
  flex-shrink: 0;
}

.nav-group.collapsed .nav-group-chevron {
  transform: rotate(-90deg);
}

/* Hide items when collapsed */
.nav-group.collapsed .nav-group-items {
  display: none;
}

/* ── Nav Item & Active State ── */
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 3px 10px 3px 14px;
  border-radius: var(--border-radius-sm);
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 500;
  transition: all var(--transition-fast);
  position: relative;
  cursor: pointer;
  border: none !important;
}

.sidebar-nav a.nav-item:hover,
.nav-item:hover {
  background: var(--sidebar-bg-hover) !important;
  color: var(--sidebar-group-active-text) !important;
}

.nav-item:hover .nav-icon {
  color: var(--sidebar-group-active-text);
}

.sidebar-nav a.nav-item.active,
.nav-item.active {
  background: var(--sidebar-bg-active) !important;
  color: var(--sidebar-text-active) !important;
  font-weight: 700 !important;
  border: none !important;
  border-left: none !important;
  box-shadow: none !important;
}

.nav-item.active .nav-icon {
  color: var(--sidebar-icon-active);
}

/* Short blue accent rail, vertically centered */
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 16px;
  background: var(--sidebar-accent-rail);
  border-radius: 999px;
  box-shadow: 0 0 8px rgba(0, 140, 255, 0.4);
}

.nav-icon { width: 20px; height: 20px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.nav-label { flex: 1; }

.nav-badge {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 6px;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
  color: white;
  border-radius: var(--border-radius-full);
  letter-spacing: 0.02em;
}

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

.sidebar-collapse-btn {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  border-radius: var(--border-radius-sm);
  padding: 5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  transition: all var(--transition-fast);
}

.sidebar-collapse-btn {
  position: absolute;
  right: -12px;
  top: 20px;
  z-index: 1001;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-card, #1e1e2e);
  border: 1px solid var(--border-card, rgba(255,255,255,0.15));
  color: var(--text-muted, #94a3b8);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  transition: all 0.2s ease;
}

.sidebar-collapse-btn:hover {
  color: var(--brand-primary, #6366f1);
  border-color: var(--brand-primary, #6366f1);
  transform: scale(1.1);
}

.sidebar.collapsed .sidebar-collapse-btn svg {
  transform: rotate(180deg);
}

/* Collapsed Desktop Sidebar (64px Icon Rail) */
@media (min-width: 769px) {
  .sidebar {
    transition: width 0.25s ease !important;
  }
  .main-content {
    transition: margin-left 0.25s ease, width 0.25s ease !important;
  }
  .sidebar.collapsed {
    width: 64px !important;
  }
  .sidebar.collapsed .brand-text,
  .sidebar.collapsed .project-picker-info,
  .sidebar.collapsed .project-picker svg,
  .sidebar.collapsed .nav-label,
  .sidebar.collapsed .nav-group-chevron,
  .sidebar.collapsed .nav-section-label span,
  .sidebar.collapsed .nav-badge,
  .sidebar.collapsed .sidebar-footer {
    display: none !important;
  }
  .sidebar.collapsed .sidebar-brand {
    justify-content: center;
    padding: 16px 8px;
  }
  .sidebar.collapsed .brand-icon {
    margin: 0 auto;
  }
  .sidebar.collapsed .project-picker {
    justify-content: center;
    padding: 10px 4px;
    margin: 8px 6px;
  }
  .sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 10px 0;
    margin: 4px 8px;
    border-radius: 10px;
  }
  .sidebar.collapsed .nav-item .nav-icon {
    margin: 0 auto;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .sidebar.collapsed .nav-group-header {
    justify-content: center;
    padding: 8px 0;
  }
  body.sidebar-collapsed .main-content {
    margin-left: 64px !important;
    width: calc(100vw - 64px) !important;
  }
}

/* Mobile Sidebar Overlay Backdrop */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 9998;
  transition: opacity 0.3s ease;
}
.sidebar-overlay.active {
  display: block;
}

[data-theme="light"] .sidebar-footer {
  background: #ffffff69;
  border-top: 1px solid rgba(0, 140, 255, 0.18);
  backdrop-filter: blur(10px);
}

.ai-provider-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--border-radius-full);
  font-size: 0.8rem;
  color: var(--text-secondary);
}

[data-theme="light"] .ai-provider-pill {
  background: #ffffff69;
  border: 1px solid rgba(0, 140, 255, 0.18);
  backdrop-filter: blur(10px);
}

.provider-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background var(--transition-fast);
}

.provider-dot.active { background: var(--success); box-shadow: 0 0 6px var(--success); }

/* ===================== MAIN CONTENT ===================== */

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
}

/* ===================== HEADER ===================== */

.top-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  background: var(--bg-glass);
  border-bottom: 1px solid var(--border-primary);
  backdrop-filter: blur(20px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.sidebar-toggle {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--border-radius-sm);
  display: none;
  transition: color var(--transition-fast);
}

.sidebar-toggle:hover { color: var(--text-primary); }

.header-breadcrumb {
  flex: 1;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.header-breadcrumb span { color: var(--text-primary); }

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

.lang-toggle {
  display: flex;
  background: var(--bg-input);
  border-radius: var(--border-radius-full);
  padding: 3px;
  border: 1px solid var(--border-primary);
}

.lang-btn {
  background: none;
  border: none;
  padding: 4px 10px;
  border-radius: var(--border-radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
}

.lang-btn.active {
  background: var(--brand-primary);
  color: white;
}

/* ===================== MODULE CONTAINER ===================== */

.module-container {
  flex: 1;
  padding: 12px;
  overflow-y: auto;
  animation: fadeIn var(--transition-base);
}

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

/* ===================== TOAST ===================== */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1000;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-card);
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  color: var(--text-primary);
  min-width: 280px;
  max-width: 380px;
  animation: slideInRight 0.3s ease;
  backdrop-filter: blur(20px);
}

.toast.success { border-color: rgba(16, 185, 129, 0.3); }
.toast.error { border-color: rgba(239, 68, 68, 0.3); }
.toast.warning { border-color: rgba(245, 158, 11, 0.3); }

.toast-icon { font-size: 1.1rem; flex-shrink: 0; }
.toast-msg { flex: 1; }

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: 0 0 40px rgba(0,0,0,0.5); }
  .main-content { margin-left: 0; }
  .sidebar-toggle { display: block; }
}

/* ===================== MOBILE RESPONSIVE ===================== */
@media (max-width: 768px) {
  html { font-size: 13px; }

  .module-container { padding: 12px; }

  .top-header { padding: 0 16px; gap: 10px; }

  /* Stats grid: 2 cols on tablet, 1 col on phone */
  .stats-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 12px; }

  /* Section header stack */
  .section-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .section-actions { width: 100%; }
  .section-actions .btn { width: 100%; justify-content: center; }

  /* Form rows */
  .form-row.cols-2, .form-row.cols-3 { grid-template-columns: 1fr !important; }

  /* Dashboard grid: single column */
  .dashboard-grid { grid-template-columns: 1fr !important; }

  /* Quota grid: 2 cols on tablet */
  #quota-body > div[style*="grid-template-columns:repeat(3"],
  #quota-body > div[style*="grid-template-columns:repeat(5"],
  .quota-cards-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Card padding reduce */
  .card-body { padding: 10px; }
  .card-header { padding: 12px 14px; }

  /* Hide lang toggle labels — show short */
  .lang-toggle { display: none; }

  /* Toast full width */
  .toast-container { left: 16px; right: 16px; bottom: 16px; }
  .toast { min-width: unset; max-width: 100%; }

  /* Workflow stepper compact */
  .workflow-step { padding: 10px 12px; gap: 8px; }
  .step-desc { display: none; }
  .step-count { display: none; }

  /* Cluster groups */
  .cluster-kw-list { gap: 6px; }
  .cluster-kw-tag { font-size: 0.75rem; padding: 4px 8px; }

  /* Breadcrumb shorten */
  .header-breadcrumb { font-size: 0.75rem; }
  .header-breadcrumb span { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr !important; }

  #quota-body > div[style*="grid-template-columns:repeat(3"],
  #quota-body > div[style*="grid-template-columns:repeat(5"],
  .quota-cards-grid {
    grid-template-columns: 1fr !important;
  }

  .stat-card { padding: 14px; }
  .stat-value { font-size: 1.5rem !important; }
}

/* ===================== DROPDOWN / SELECT COLORS ===================== */
select,
select option {
  background-color: #1a1a2e;
  color: #e2e8f0;
}

select option:hover,
select option:checked {
  background-color: var(--brand-primary);
  color: #ffffff;
}

/* Also target Firefox */
@-moz-document url-prefix() {
  select option { background: #1a1a2e; color: #e2e8f0; }
}

/* ===================== TOOLTIP STYLING ===================== */
.help-tooltip-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50% !important; /* Force circle shape */
  background: rgba(0, 140, 255, 0.15);
  color: var(--brand-primary);
  font-size: 0.65rem;
  font-weight: bold;
  margin-left: 6px;
  cursor: help;
  user-select: none;
  border: 1px solid rgba(0, 140, 255, 0.3);
  transition: all 0.15s ease;
  vertical-align: middle;
}
.help-tooltip-trigger:hover, .help-tooltip-trigger:focus {
  background: var(--brand-primary);
  color: #fff;
  outline: none;
}

#global-tooltip-popover {
  position: absolute;
  z-index: 10000;
  background: #1e1e38;
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 8px 12px;
  border-radius: 5px;
  font-size: 0.75rem;
  line-height: 1.4;
  max-width: 240px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  white-space: pre-wrap;
  word-wrap: break-word;
}
#global-tooltip-popover.visible {
  opacity: 1;
  pointer-events: auto;
}

