/* ========================================================================
   DNSai Theme System — CSS Custom Properties
   Brand palette from /home/reports/color_pallete.txt
   Dark mode is default. Toggle via body.dark-mode / body.light-mode
   ======================================================================== */

/* --- Brand Identity (constant across modes) --- */
:root {
  /* Brand Colors */
  --brand-cyan: #26c4ff;
  --brand-blue: #0054ff;
  --brand-gradient: linear-gradient(90deg, #26c4ff 0%, #0054ff 100%);
  --brand-gradient-hover: linear-gradient(90deg, #0048d4 0%, #007aff 100%);
  --btn-secondary-gradient: linear-gradient(to bottom, #0054FF, #0447D3);

  /* Status Colors */
  --color-success: #00c853;
  --color-warning: #ffab00;
  --color-error: #ff1744;
  --color-info: #40a8ff;

  /* Data Visualization */
  --data-pink: #FC6FCF;
  --data-steel: #97B8D5;
  --data-gold: #D3D212;
  --data-header: #40a8ff;

  /* Disabled */
  --color-disabled-bg: #5a5a5a;
  --color-disabled-text: #999999;

  /* Layout Metrics
     --nav-h is consumed by public_nav.css and auth.css. The public nav is
     sticky (in-flow) on auth pages, so this is only needed where the nav
     overlays content (landing hero) or where a mobile overlay is offset. */
  --nav-h: 64px;

  /* DNS Record-Type Colors (constant across modes) */
  --dns-a:          #26c4ff;   /* Bright Blue — IPv4 Address */
  --dns-aaaa:       #7c3aed;   /* Purple — IPv6 Address */
  --dns-cname:      #06b6d4;   /* Cyan — Canonical Name */
  --dns-mx:         #10b981;   /* Green — Mail Exchange */
  --dns-txt:        #f59e0b;   /* Orange — Text Record */
  --dns-ns:         #3b82f6;   /* Blue — Name Server */
  --dns-soa:        #6366f1;   /* Indigo — Start of Authority */
  --dns-srv:        #14b8a6;   /* Teal — Service Locator */
  --dns-ptr:        #f97316;   /* Orange — Reverse DNS */
  --dns-caa:        #ef4444;   /* Red — Certificate Authority */
  --dns-spf:        #f59e0b;   /* Orange — SPF */
  --dns-dmarc:      #ec4899;   /* Pink — DMARC */
  --dns-dkim:       #22c55e;   /* Green — DKIM */
  --dns-bimi:       #8b5cf6;   /* Violet — BIMI */
  --dns-https:      #a855f7;   /* Purple — HTTPS */
  --dns-technology: #6366f1;   /* Indigo — Technology */
  --dns-default:    #9ca3af;   /* Medium Gray — Fallback */

  /* Modal Overlay */
  --clr-bg-overlay: rgba(8, 34, 67, 0.5);
  --clr-bg-modal-start: #191919;
  --clr-bg-modal-end: #333333;
}

/* ========================================================================
   DARK MODE (default)
   ======================================================================== */
body.dark-mode {
  /* Backgrounds */
  --bg-body: #000000;
  --bg-section: #111111;
  --bg-surface: #1a1a1a;
  --bg-card: #222222;
  --bg-footer: #191919;
  --bg-input: #1a1a1a;
  --bg-feature-card: linear-gradient(135deg, #0a2a54 0%, #104a8a 100%);
  --bg-dark-card: linear-gradient(to bottom, #1f1f1f, #191919);
  /* Aliases used across settings/detail/domains/api_setup. An undefined
     var() with no fallback makes the whole declaration invalid, which paints
     these surfaces transparent — they must exist in every theme. */
  --bg-primary: var(--bg-body);
  --bg-secondary: var(--bg-surface);
  --bg-hover: #2a2a2a;

  /* Text */
  --text-primary: #ffffff;
  --text-secondary: #cccccc;
  --text-muted: #999999;
  --text-dimmed: #888888;
  --text-placeholder: #666666;

  /* Borders */
  --border-default: #333333;
  --border-emphasis: #555555;
  --border-input: #333333;
  --border-input-focus: #26c4ff;

  /* Links */
  --link-color: #26c4ff;
  --link-hover: #26c4ff;
  --link-content: #40a8ff;
  --text-link: var(--link-color);

  /* Interactive Accents */
  --accent: #26c4ff;
  --glow-primary: #26B6FE;
  --glow-secondary: #0054FF;
  --selected-tab: #26c4ff;
  --toggle-active: #26c4ff;

  /* Focus & Glow */
  --focus-ring: rgba(38, 196, 255, 0.3);
  --card-hover-shadow: 0 4px 15px rgba(0, 84, 255, 0.4);
  --input-focus-shadow: 0 0 0 3px rgba(38, 196, 255, 0.3);
  --btn-hover-shadow: 0 4px 15px rgba(0, 84, 255, 0.4);

  /* Outline / Ghost Button */
  --btn-outline-text: #26c4ff;
  --btn-outline-border: #26c4ff;
  --btn-outline-hover-bg: rgba(38, 196, 255, 0.1);

  /* Navigation */
  --nav-bg-top: rgba(0, 0, 0, 0);
  --nav-bg-scrolled: rgba(0, 0, 0, 0.95);
  --nav-blur-scrolled: blur(10px);
  --nav-shadow-scrolled: 0 2px 12px rgba(0, 0, 0, 0.3);
  --nav-link-color: #ffffff;
  --nav-link-hover: #26c4ff;
  --nav-link-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  --nav-underline: #26c4ff;
  --menu-icon-color: #fff;
  --menu-icon-hover: #26c4ff;

  /* Mode Switch Toggle */
  --mode-switch-bg: #666;
  --mode-switch-shadow: rgba(0, 0, 0, 0.5);

  /* Flyout Menu */
  --flyout-bg: #1a1a1a;
  --flyout-border: 1px solid rgba(255, 255, 255, 0.1);
  --flyout-shadow: -8px 0 40px rgba(0, 0, 0, 0.8);
  --flyout-link-color: #ffffff;
  --flyout-link-hover-bg: rgba(38, 196, 255, 0.12);
  --flyout-link-hover-color: #26c4ff;
  --flyout-bar-color: #26c4ff;
  --flyout-close-color: #999;
  --flyout-close-hover-color: #ffffff;
  --flyout-close-hover-bg: rgba(255, 255, 255, 0.08);
  --flyout-close-border: rgba(255, 255, 255, 0.1);
  --flyout-section-header: #26c4ff;

  /* Dropdown */
  --dropdown-bg: linear-gradient(135deg, #191919 0%, #333333 100%);
  --dropdown-border: 1px solid #555555;
  --dropdown-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --dropdown-header-color: #26c4ff;
  --dropdown-header-border: rgba(38, 196, 255, 0.2);
  --dropdown-link-color: #ffffff;
  --dropdown-link-hover-bg: rgba(38, 196, 255, 0.1);
  --dropdown-link-hover-color: #26c4ff;

  /* Modal */
  --modal-bg: linear-gradient(to bottom, #191919, #333333);
  --modal-text: #ffffff;

  /* Error Box */
  --error-bg: #2a0f0f;
  --error-border: #602b2b;
  --error-text: #ffd6d6;

  /* Toast Notification */
  --toast-bg: #0F1926;
  --toast-border: #97B8D5;
  --toast-text: #ffffff;

  /* Code / Monospace */
  --code-color: #26c4ff;
  --code-bg: #1a1a1a;

  /* DNS Button */
  --dns-btn-text: #ffffff;
  --dns-btn-border: #ffffff;
  --dns-btn-hover-bg: #ffffff;
  --dns-btn-hover-text: #000000;

  /* Sticky column opaque hover/selected (rgba(38,196,255,0.04/0.08) on --bg-card) */
  --sticky-hover-bg: #22282b;
  --sticky-selected-bg: #222f34;

  /* General */
  --overlay-bg: rgba(0, 0, 0, 0.6);
  --hero-overlay: linear-gradient(135deg, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.3));
  --card-shadow: none;
}

/* ========================================================================
   LIGHT MODE
   ======================================================================== */
body.light-mode {
  /* Backgrounds */
  --bg-body: #ffffff;
  --bg-section: #f1f1f1;
  --bg-surface: #f9f9f9;
  --bg-card: #f9f9f9;
  --bg-footer: #E6E6E6;
  --bg-input: #ffffff;
  --bg-feature-card: none;
  --bg-dark-card: none;
  --bg-primary: var(--bg-body);
  --bg-secondary: var(--bg-surface);
  --bg-hover: #ececec;

  /* Text */
  --text-primary: #000000;
  --text-secondary: #282828;
  --text-muted: #555555;
  --text-dimmed: #666666;
  --text-placeholder: #999999;

  /* Borders */
  --border-default: #cccccc;
  --border-emphasis: #e5e5e5;
  --border-input: #cccccc;
  --border-input-focus: #0054ff;

  /* Links */
  --link-color: #0054ff;
  --link-hover: #0054ff;
  --link-content: #0054ff;
  --text-link: var(--link-color);

  /* Interactive Accents */
  --accent: #0054ff;
  --glow-primary: #0054ff;
  --glow-secondary: #0054ff;
  --selected-tab: #0054ff;
  --toggle-active: #0054ff;

  /* Focus & Glow */
  --focus-ring: rgba(0, 84, 255, 0.2);
  --card-hover-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  --input-focus-shadow: 0 0 0 3px rgba(0, 84, 255, 0.2);
  --btn-hover-shadow: 0 4px 15px rgba(0, 84, 255, 0.4);

  /* Outline / Ghost Button */
  --btn-outline-text: #0054ff;
  --btn-outline-border: #0054ff;
  --btn-outline-hover-bg: rgba(0, 84, 255, 0.1);

  /* Navigation */
  --nav-bg-top: rgba(255, 255, 255, 1);
  --nav-bg-scrolled: rgba(255, 255, 255, 1);
  --nav-blur-scrolled: blur(10px);
  --nav-shadow-scrolled: 0 2px 8px rgba(0, 0, 0, 0.1);
  --nav-link-color: #000000;
  --nav-link-hover: #0054ff;
  --nav-link-shadow: none;
  --nav-underline: #0054ff;
  --menu-icon-color: #000;
  --menu-icon-hover: #0054ff;

  /* Mode Switch Toggle */
  --mode-switch-bg: #999;
  --mode-switch-shadow: rgba(0, 0, 0, 0.3);

  /* Flyout Menu */
  --flyout-bg: #ffffff;
  --flyout-border: 1px solid rgba(0, 0, 0, 0.12);
  --flyout-shadow: -8px 0 40px rgba(0, 0, 0, 0.15);
  --flyout-link-color: #1a1a1a;
  --flyout-link-hover-bg: rgba(0, 84, 255, 0.08);
  --flyout-link-hover-color: #0054ff;
  --flyout-bar-color: #0054ff;
  --flyout-close-color: #666;
  --flyout-close-hover-color: #1a1a1a;
  --flyout-close-hover-bg: rgba(0, 0, 0, 0.05);
  --flyout-close-border: rgba(0, 0, 0, 0.1);
  --flyout-section-header: #0054ff;

  /* Dropdown */
  --dropdown-bg: linear-gradient(135deg, #ffffff 0%, #f5f5f5 100%);
  --dropdown-border: 1px solid #dddddd;
  --dropdown-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  --dropdown-header-color: #0054ff;
  --dropdown-header-border: rgba(0, 84, 255, 0.2);
  --dropdown-link-color: #333333;
  --dropdown-link-hover-bg: rgba(0, 84, 255, 0.1);
  --dropdown-link-hover-color: #0054ff;

  /* Modal */
  --modal-bg: #474747;
  --modal-text: #ffffff;

  /* Error Box */
  --error-bg: #2a0f0f;
  --error-border: #602b2b;
  --error-text: #ffd6d6;

  /* Toast Notification */
  --toast-bg: #0F1926;
  --toast-border: #97B8D5;
  --toast-text: #ffffff;

  /* Code / Monospace */
  --code-color: #0054ff;
  --code-bg: #f1f1f1;

  /* DNS Button */
  --dns-btn-text: #000000;
  --dns-btn-border: #000000;
  --dns-btn-hover-bg: #000000;
  --dns-btn-hover-text: #ffffff;

  /* Sticky column opaque hover/selected (rgba(38,196,255,0.04/0.08) on --bg-card) */
  --sticky-hover-bg: #f1f7f9;
  --sticky-selected-bg: #e8f5f9;

  /* General */
  --overlay-bg: rgba(0, 0, 0, 0.6);
  --hero-overlay: linear-gradient(135deg, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.3));
  --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* ========================================================================
   BASE STYLES — Applied via CSS custom properties
   ======================================================================== */

body {
  font-family: 'Inter', 'Open Sans', 'Roboto', sans-serif;
  background-color: var(--bg-body);
  color: var(--text-primary);
  transition: background-color 0.3s ease, color 0.3s ease;
  margin: 0;
  padding: 0;
  line-height: 1.5;
}

/* --- Typography --- */
h1, h2, h3 {
  color: var(--text-primary);
}

p, li {
  color: var(--text-secondary);
}

small, .caption, .text-muted {
  color: var(--text-muted);
}

.text-dimmed {
  color: var(--text-dimmed);
}

code, pre {
  color: var(--code-color);
  background-color: var(--code-bg);
}

::placeholder {
  color: var(--text-placeholder);
}

/* --- Links --- */
a {
  color: var(--link-color);
  text-decoration: none;
  transition: color 0.3s ease;
}

a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

.content-link {
  color: var(--link-content);
}

/* --- Cards --- */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  box-shadow: var(--card-shadow);
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.card:hover {
  box-shadow: var(--card-hover-shadow);
}

/* --- Inputs --- */
input, textarea, select {
  background-color: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border-input);
  border-radius: 6px;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--border-input-focus);
  box-shadow: var(--input-focus-shadow);
  outline: none;
}

/* --- Buttons --- */

/* Primary CTA */
.btn-primary {
  background: var(--brand-gradient);
  color: #ffffff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: box-shadow 0.3s ease;
}

.btn-primary:hover {
  background: var(--brand-gradient-hover);
  box-shadow: var(--btn-hover-shadow);
}

/* Secondary */
.btn-secondary {
  background: var(--btn-secondary-gradient);
  color: #ffffff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: opacity 0.3s ease;
}

.btn-secondary:hover {
  opacity: 0.9;
}

/* Outline / Ghost */
.btn-outline {
  background: transparent;
  color: var(--btn-outline-text);
  border: 1px solid var(--btn-outline-border);
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

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

/* Disabled */
.btn-disabled, button:disabled {
  background: var(--color-disabled-bg);
  color: var(--color-disabled-text);
  border: none;
  cursor: not-allowed;
}

/* --- DNS Button (.dns-button) --- */
.dns-button {
  background: transparent;
  color: var(--dns-btn-text);
  border: 2px solid var(--dns-btn-border);
  border-radius: 50px;
  padding: 12px 32px;
  min-width: 220px;
  width: 100%;
  font-size: 14px;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.3s, color 0.3s, border-color 0.3s;
  text-align: center;
  text-decoration: none;
  display: inline-block;
}

.dns-button:hover {
  background-color: var(--dns-btn-hover-bg);
  color: var(--dns-btn-hover-text);
  border-color: var(--dns-btn-border);
  text-decoration: none;
}

/* Button Row Grid */
.button-row {
  display: grid;
  gap: 20px;
  justify-content: center;
  margin: 20px auto 0;
}

.button-row.four-buttons {
  grid-template-columns: repeat(4, minmax(220px, 1fr));
}

.button-row.five-buttons {
  grid-template-columns: repeat(5, minmax(190px, 1fr));
}

.button-row.six-buttons {
  grid-template-columns: repeat(3, 1fr);
}

.button-row.eight-buttons {
  grid-template-columns: repeat(4, minmax(220px, 1fr));
}

@media (max-width: 992px) {
  .button-row {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media (max-width: 600px) {
  .button-row {
    grid-template-columns: 1fr !important;
  }
  .dns-button {
    width: 100%;
  }
}

/* --- Tables --- */
table {
  border-collapse: collapse;
  width: 100%;
}

th {
  color: var(--data-header);
  border-bottom: 2px solid var(--border-default);
}

td {
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-default);
}

/* --- Modals --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--clr-bg-overlay);
  z-index: 9999;
  display: none;
  justify-content: center;
  align-items: flex-start;
  padding-top: 200px;
}

.modal-content {
  background: var(--modal-bg);
  border: 1px solid var(--data-steel);
  border-radius: 15px;
  padding: 20px;
  width: 45%;
  max-width: 400px;
  min-width: 320px;
  text-align: center;
  color: var(--modal-text);
}

@media (max-width: 768px) {
  .modal-content {
    width: 85%;
    max-width: 90%;
    min-width: 300px;
    padding: 20px 15px;
  }
}

@media (max-width: 480px) {
  .modal-content {
    width: 90%;
    max-width: 95%;
    min-width: 280px;
    padding: 18px 12px;
  }
}

/* --- Spinner --- */
.spinner {
  display: inline;
  font-size: 1rem;
  white-space: nowrap;
}

.dot {
  display: inline-block;
  animation: spin 1.2s linear infinite;
}

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

@keyframes spin {
  0%, 80%, 100% { transform: scale(0.5); }
  40% { transform: scale(1); }
}

/* --- Error Box --- */
.errorbox {
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  color: var(--error-text);
  padding: 12px 16px;
  border-radius: 8px;
  transition: all 0.3s ease;
}

/* --- Toast Notifications --- */
.toast-notification {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--toast-bg);
  color: var(--toast-text);
  padding: 12px;
  border: 1px solid var(--toast-border);
  border-radius: 5px;
  display: none;
  z-index: 10000;
  opacity: 1;
  transition: opacity 0.4s ease;
}

.toast-notification.fade-out {
  opacity: 0;
}

/* --- Custom Modal (alert/confirm replacement) --- */
.dnsai-modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 11000;
  align-items: center;
  justify-content: center;
  /* Keeps the dialog off the screen edges on phones. .dnsai-modal is
     content-box and only 90% wide, so without this it was squeezed flush to
     both edges at 320px. No effect on desktop, where max-width already wins. */
  box-sizing: border-box;
  padding: 16px;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.dnsai-modal-overlay.visible {
  display: flex;
}

.dnsai-modal {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: 14px;
  padding: 28px 32px 24px;
  max-width: 460px;
  width: 90%;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
}

.dnsai-modal-body {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.dnsai-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* --- Structured confirmation body (showConfirmNode) --- */
.confirm-title {
  margin: 0 0 16px;
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}

.confirm-rows {
  border: 1px solid var(--border-default);
  border-radius: 10px;
  overflow: hidden;
}

.confirm-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-default);
}

.confirm-row:last-child { border-bottom: none; }

.confirm-row-label {
  color: var(--text-muted);
  font-size: 13px;
}

.confirm-row-value {
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
  text-align: right;
}

.confirm-row--total {
  background: var(--bg-surface);
}

.confirm-row--total .confirm-row-label {
  color: var(--text-primary);
  font-weight: 600;
}

.confirm-row--total .confirm-row-value {
  font-size: 17px;
  font-weight: 700;
}

.confirm-note {
  margin: 14px 0 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-muted);
}

@media (max-width: 480px) {
  .dnsai-modal {
    padding: 22px 18px 18px;
  }
  .confirm-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }
  .confirm-row-value { text-align: left; }
  .confirm-row--total .confirm-row-value { font-size: 19px; }
}

.dnsai-modal-btn {
  padding: 9px 22px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: background 0.15s, box-shadow 0.15s;
}

.dnsai-modal-btn-primary {
  background: var(--brand-gradient);
  color: #ffffff;
}

.dnsai-modal-btn-primary:hover {
  box-shadow: 0 4px 12px rgba(0, 84, 255, 0.35);
}

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

.dnsai-modal-btn-cancel:hover {
  background: var(--bg-surface);
  color: var(--text-primary);
}

/* --- Navigation --- */
.nav-menu {
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 1300;
  padding: 14px 20px;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  transition: background-color 0.3s, backdrop-filter 0.3s, box-shadow 0.3s;
  background-color: var(--nav-bg-top);
  box-sizing: border-box;
}

.nav-links a {
  font-size: 15px;
  font-weight: 500;
  padding: 8px 14px;
  color: var(--nav-link-color);
  text-shadow: var(--nav-link-shadow);
  text-decoration: none;
  position: relative;
  transition: all 0.3s ease;
}

.nav-links a:hover {
  color: var(--nav-link-hover);
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 14px;
  width: 0;
  height: 2px;
  background: var(--nav-underline);
  transition: width 0.3s ease;
}

.nav-links a:hover::after {
  width: calc(100% - 28px);
}

/* --- Menu Icon --- */
.menu-icon {
  font-size: 28px;
  z-index: 1300;
  padding: 4px 8px;
  color: var(--menu-icon-color);
  cursor: pointer;
  transition: color 0.3s ease, transform 0.3s ease;
}

.menu-icon:hover {
  color: var(--menu-icon-hover);
  transform: scale(1.1);
}

/* --- Mode Switch Toggle --- */
.mode-switch {
  position: relative;
  display: inline-block;
}

.mode-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.mode-switch label {
  display: block;
  width: 35px;
  height: 15px;
  border-radius: 25px;
  background: var(--mode-switch-bg);
  box-shadow: inset 0 1px 3px var(--mode-switch-shadow);
  cursor: pointer;
  position: relative;
  transition: background 0.3s;
}

.mode-switch label::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 11px;
  height: 11px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.3s, background 0.3s;
}

.mode-switch input:checked + label::after {
  transform: translateX(20px);
}

/* --- Flyout Menu --- */
.flyout-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 1100;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.flyout-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.flyout-menu {
  position: fixed;
  right: 0;
  top: 0;
  width: 320px;
  height: 100vh;
  height: 100dvh;
  z-index: 1200;
  padding: 70px 24px 24px 24px;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  background: var(--flyout-bg);
  border-left: var(--flyout-border);
  box-shadow: var(--flyout-shadow);
  box-sizing: border-box;
}

.flyout-menu.open {
  transform: translateX(0);
}

.flyout-menu a {
  padding: 13px 16px;
  font-size: 15px;
  font-weight: 500;
  border-radius: 10px;
  color: var(--flyout-link-color);
  text-decoration: none;
  position: relative;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: block;
}

.flyout-menu a::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 4px;
  height: 100%;
  background: var(--flyout-bar-color);
  border-radius: 0 4px 4px 0;
  transform: scaleY(0);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.flyout-menu a:hover {
  background: var(--flyout-link-hover-bg);
  color: var(--flyout-link-hover-color);
  transform: translateX(4px);
}

.flyout-menu a:hover::before {
  transform: scaleY(1);
}

.flyout-menu a.active {
  color: var(--accent);
  font-weight: 600;
}

.flyout-close {
  margin-top: auto;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  padding: 13px 16px;
  border-top: 1px solid var(--flyout-close-border);
  color: var(--flyout-close-color);
  cursor: pointer;
  transition: all 0.25s ease;
  border-radius: 10px;
}

.flyout-close:hover {
  color: var(--flyout-close-hover-color);
  background: var(--flyout-close-hover-bg);
}

.flyout-section-header {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 12px 6px;
  margin-top: 8px;
  border-top: 1px solid var(--border-default);
  color: var(--flyout-section-header);
}

.flyout-section-header:first-child {
  margin-top: 0;
  border-top: none;
}

/* --- Utilities Dropdown --- */
.nav-dropdown {
  position: relative;
  display: inline-block;
}

.nav-dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 0;
  color: var(--nav-link-color);
  cursor: pointer;
  transition: color 0.2s ease;
}

.nav-dropdown-toggle:hover {
  color: var(--nav-link-hover);
}

.dropdown-arrow {
  font-size: 10px;
  transition: transform 0.2s ease;
}

.nav-dropdown:hover .dropdown-arrow {
  transform: rotate(180deg);
}

.nav-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  display: none;
  min-width: 500px;
  border-radius: 12px;
  padding: 16px 20px;
  z-index: 1000;
  gap: 24px;
  background: var(--dropdown-bg);
  border: var(--dropdown-border);
  box-shadow: var(--dropdown-shadow);
}

.nav-dropdown:hover .nav-dropdown-menu {
  display: flex;
}

.dropdown-column {
  flex: 1;
  min-width: 210px;
}

.dropdown-header {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 12px;
  margin-bottom: 8px;
  color: var(--dropdown-header-color);
  border-bottom: 1px solid var(--dropdown-header-border);
}

.nav-dropdown-menu a {
  padding: 8px 12px;
  font-size: 14px;
  border-radius: 6px;
  color: var(--dropdown-link-color);
  text-decoration: none;
  display: block;
  transition: all 0.15s ease;
}

.nav-dropdown-menu a:hover {
  background: var(--dropdown-link-hover-bg);
  color: var(--dropdown-link-hover-color);
  transform: translateX(4px);
}

@media (max-width: 768px) {
  .nav-dropdown {
    display: none;
  }
}

/* --- Status Badges --- */
.badge-success {
  color: var(--color-success);
}

.badge-warning {
  color: var(--color-warning);
}

.badge-error {
  color: var(--color-error);
}

.badge-info {
  color: var(--color-info);
}

/* --- Logo Title --- */
.logo-title {
  font-size: 2rem;
  line-height: 1.2;
  margin: 0;
  color: var(--text-primary);
  transition: color 0.3s ease;
}

.logo-title .bold {
  font-weight: 700;
}

.logo-title .thin {
  font-weight: 300;
}

/* Hero override: always white */
.header-hero .logo-title {
  color: #ffffff;
}

/* --- Sections --- */
.section-alt {
  background-color: var(--bg-section);
}

.surface {
  background-color: var(--bg-surface);
}

/* --- Overlay --- */
.overlay {
  background: var(--overlay-bg);
}

/* --- Nav Logo --- */
.nav-logo {
  display: flex;
  align-items: center;
  margin-right: 12px;
  text-decoration: none;
}

.nav-logo img {
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.5));
}

/* --- Nav Links Container --- */
.nav-links {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

/* --- Main Content (below fixed nav) --- */
.main-content {
  padding-top: 60px;
}

/* --- Logout Link --- */
.nav-logout-link {
  opacity: 0.7;
  font-size: 13px !important;
}

.nav-logout-link:hover {
  opacity: 1;
}

/* --- Mobile Responsive Navigation --- */

/* Hamburger hidden on desktop */
.menu-icon {
  display: none;
}

@media (max-width: 768px) {
  /* Show hamburger on mobile */
  .menu-icon {
    display: block;
    margin-left: auto;
  }

  /* Hide desktop nav links on mobile */
  .nav-links {
    display: none;
  }

}

/* --- Site Footer --- */

.site-footer {
  margin-top: 75px;
  padding: 24px 24px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-default);
}

body.dark-mode .site-footer {
  background: #000000;
}

body.light-mode .site-footer {
  background: #ffffff;
}

.site-footer-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  max-width: 1400px;
  margin: 0 auto;
}

.site-footer-links {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.site-footer-sep {
  color: var(--text-muted);
  opacity: 0.5;
}

.site-footer a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.site-footer a:hover {
  color: var(--accent);
}

@media (max-width: 767px) {
  .site-footer-inner {
    flex-direction: column;
    gap: 6px;
  }
}

/* --- Page Disclaimer --- */

.page-disclaimer {
  max-width: 1400px;
  margin: 48px auto 0;
  padding: 24px 24px 0;
  font-size: 10pt;
  line-height: 1.5;
}

body.dark-mode .page-disclaimer,
body.dark-mode .page-disclaimer a {
  color: #ffffff;
}

body.light-mode .page-disclaimer,
body.light-mode .page-disclaimer a {
  color: #000000;
}

.page-disclaimer a {
  text-decoration: none;
}

.page-disclaimer p {
  margin: 0 0 12px;
}

.page-disclaimer p:last-child {
  margin-bottom: 0;
}

/* --- Global Billing Banners (shown across all app pages) --- */
.global-billing-banner {
  padding: 12px 20px;
  font-size: 14px;
  text-align: center;
  margin-bottom: 16px;
  border-radius: 8px;
}

.global-billing-banner a {
  font-weight: 600;
  text-decoration: underline;
}

.global-billing-danger {
  background: rgba(255, 23, 68, 0.1);
  border: 1px solid rgba(255, 23, 68, 0.3);
  color: var(--color-error);
}

.global-billing-danger a {
  color: var(--color-error);
}

.global-billing-warning {
  background: rgba(255, 171, 0, 0.1);
  border: 1px solid rgba(255, 171, 0, 0.3);
  color: var(--color-warning);
}

.global-billing-warning a {
  color: var(--color-warning);
}

/* --- Layout metric overrides ---------------------------------------------
   Kept at the end so it wins over the :root default above. The public nav
   shrinks on phones; auth.css and public_nav.css both read --nav-h. */
@media (max-width: 640px) {
  :root { --nav-h: 56px; }
}
