/* ==========================================================================
   CarInsuranceCostCalculator.com — Master Dual-Theme Stylesheet
   Complies 100% with Probashi Layout Locks & VisaCheck Dual-Theme Contrast Rules
   Zero Inline Colors | Zero Double Curly Braces | WCAG AAA Readability
   ========================================================================== */

:root,
html[data-theme="dark"] {
  --bg-page: #070C18;
  --bg-card: #0B132B;
  --bg-card-elevated: #111C38;
  --bg-input: #070C18;
  --bg-subtle: #162238;
  --text-primary: #F8FAFC;
  --text-secondary: #CBD5E1;
  --text-muted: #94A3B8;
  --accent-gold: #D4AF37;
  --accent-emerald: #10B981;
  --accent-emerald-dark: #059669;
  --border-card: rgba(212, 175, 55, 0.22);
  --border-subtle: rgba(148, 163, 184, 0.2);
  --shadow-card: 0 12px 32px rgba(0, 0, 0, 0.45);
}

html[data-theme="light"] {
  --bg-page: #F8FAFC;
  --bg-card: #FFFFFF;
  --bg-card-elevated: #F1F5F9;
  --bg-input: #FFFFFF;
  --bg-subtle: #F1F5F9;
  --text-primary: #0F172A;
  --text-secondary: #1E293B;
  --text-muted: #475569;
  --accent-gold: #B45309;
  --accent-emerald: #059669;
  --accent-emerald-dark: #047857;
  --border-card: #CBD5E1;
  --border-subtle: #E2E8F0;
  --shadow-card: 0 8px 24px rgba(15, 23, 42, 0.06);
}

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

html {
  scroll-behavior: smooth;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.65;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-page);
  color: var(--text-secondary);
  transition: background-color 0.2s ease, color 0.2s ease;
}

a {
  color: var(--accent-emerald);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  text-decoration: underline;
}

/* ==========================================================================
   1. Top Compliance Ticker & Site Header
   ========================================================================== */
.compliance-ticker {
  background: #0B132B;
  border-bottom: 1px solid rgba(212, 175, 55, 0.25);
  color: #CBD5E1;
  font-size: 0.82rem;
  padding: 8px 16px;
  text-align: center;
}

html[data-theme="light"] .compliance-ticker {
  background: #F1F5F9 !important;
  border-bottom: 1px solid #CBD5E1 !important;
  color: #1E293B !important;
}

.compliance-ticker strong {
  color: #D4AF37;
}

html[data-theme="light"] .compliance-ticker strong {
  color: #047857 !important;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 19, 43, 0.96);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-card);
  padding: 12px 24px;
}

html[data-theme="light"] .site-header {
  background: rgba(255, 255, 255, 0.97) !important;
  border-bottom: 1px solid #E2E8F0 !important;
}

.header-inner {
  max-width: 1360px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none !important;
}

.brand-logo-wrap {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  overflow: hidden;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  animation: float3DLogo 3.6s ease-in-out infinite, logoGlowPulse 3.6s ease-in-out infinite;
  will-change: transform, box-shadow;
}

.brand-logo-wrap::after {
  content: "";
  position: absolute;
  top: -60%;
  left: -120%;
  width: 70%;
  height: 220%;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.48) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: rotate(28deg);
  animation: logoSheenSweep 3.4s ease-in-out infinite;
  pointer-events: none;
}

.brand-logo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 12px;
}

.brand-logo-wrap-lg {
  width: 68px;
  height: 68px;
  border-radius: 16px;
}

.brand-logo-wrap-lg .brand-logo-img {
  border-radius: 16px;
}

.brand-logo-wrap-sm {
  width: 38px;
  height: 38px;
  border-radius: 10px;
}

.brand-logo-wrap-sm .brand-logo-img {
  border-radius: 10px;
}

.sidebar-app-header-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

@keyframes float3DLogo {
  0%, 100% {
    transform: translateY(0px) scale(1);
  }
  50% {
    transform: translateY(-2.5px) scale(1.04);
  }
}

@keyframes logoGlowPulse {
  0%, 100% {
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35), 0 0 0 1px rgba(16, 185, 129, 0.3);
  }
  50% {
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.55), 0 0 0 2px rgba(56, 189, 248, 0.65);
  }
}

@keyframes logoSheenSweep {
  0% {
    left: -130%;
  }
  45%, 100% {
    left: 160%;
  }
}

.brand-title {
  font-size: 1.12rem;
  font-weight: 800;
  color: var(--text-primary);
  display: block;
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 0.74rem;
  color: var(--text-muted);
  display: block;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.nav-link {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 6px 10px;
  border-radius: 8px;
  text-decoration: none !important;
}

.nav-link:hover,
.nav-link.active {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

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

.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  background: #162238;
  color: #F8FAFC;
  border: 1px solid rgba(212, 175, 55, 0.35);
}

html[data-theme="light"] .theme-toggle-btn {
  background: #F8FAFC !important;
  color: #141A31 !important;
  border: 1px solid #CBD5E1 !important;
}

/* ==========================================================================
   2. Button & CTA Duality Protocol (Rule 2 Lock)
   ========================================================================== */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none !important;
  background: linear-gradient(135deg, #D4AF37, #B89628);
  color: #070C18 !important;
  border: 1px solid #D4AF37;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

html[data-theme="light"] .btn-primary {
  background: #141A31 !important;
  color: #FFFFFF !important;
  border: 1px solid #141A31 !important;
}

.btn-primary:hover {
  transform: translateY(-1px);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 10px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none !important;
  background: #070C18;
  color: #CBD5E1 !important;
  border: 1px solid rgba(212, 175, 55, 0.25);
}

html[data-theme="light"] .btn-secondary {
  background: #F8FAFC !important;
  color: #141A31 !important;
  border: 1px solid #CBD5E1 !important;
}

.kicker-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: #162238;
  border: 1px solid rgba(212, 175, 55, 0.3);
  color: #D4AF37;
  margin-bottom: 12px;
}

html[data-theme="light"] .kicker-badge {
  background: #141A31 !important;
  color: #D9B15C !important;
  border: 1px solid #141A31 !important;
}

/* ==========================================================================
   3. Radiant Hero Header Lock (Rule 3 & Rule 6 Lock)
   ========================================================================== */
.hero-banner,
.article-hero-header {
  background: linear-gradient(135deg, #0B132B 0%, #111C38 100%);
  border: 1px solid var(--border-card);
  border-bottom: 3px solid #D4AF37;
  border-radius: 16px;
  padding: 28px 32px;
  margin-bottom: 28px;
}

html[data-theme="light"] .hero-banner,
html[data-theme="light"] .article-hero-header {
  background: linear-gradient(135deg, #FFFFFF 0%, #F1F5F9 100%) !important;
  color: #141A31 !important;
  border: 1px solid #CBD5E1 !important;
  border-bottom: 3px solid #D9B15C !important;
}

.article-title {
  font-size: clamp(1.65rem, 2.8vw, 2.35rem);
  font-weight: 800;
  color: #F8FAFC;
  margin: 0 0 12px 0;
  line-height: 1.25;
}

html[data-theme="light"] .article-title,
[data-theme="light"] .article-title {
  color: #0F172A !important;
  -webkit-text-fill-color: #0F172A !important;
  background: none !important;
  text-shadow: none !important;
}

.hero-subtitle {
  font-size: 1.02rem;
  color: var(--text-secondary);
  margin: 0 0 16px 0;
  max-width: 820px;
}

.meta-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.83rem;
  color: var(--text-muted);
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

/* ==========================================================================
   4. Structural 2-Column Layout Lock (Rule 1: Single <main> + Adjacent <aside>)
   ========================================================================== */
.article-layout-wrapper {
  max-width: 1360px;
  margin: 28px auto;
  padding: 0 20px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 350px;
  gap: 30px;
  align-items: start;
}

@media (max-width: 1024px) {
  .article-layout-wrapper {
    grid-template-columns: 1fr;
  }
}

.article-main-content {
  min-width: 0;
}

.article-sticky-sidebar {
  position: sticky;
  top: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

@media (max-width: 1024px) {
  .article-sticky-sidebar {
    position: static;
  }
}

/* ==========================================================================
   5. Interactive Car Insurance Cost Calculator Card
   ========================================================================== */
.calculator-card,
.surface-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 16px;
  padding: 26px;
  margin-bottom: 28px;
  box-shadow: var(--shadow-card);
}

.card-section-title {
  font-size: 1.32rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0 0 8px 0;
}

.calc-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

@media (max-width: 680px) {
  .calc-grid {
    grid-template-columns: 1fr;
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
}

.form-hint {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.form-select,
.form-input {
  width: 100%;
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 0.94rem;
  font-weight: 500;
  background-color: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border-card);
}

html[data-theme="light"] .form-select,
html[data-theme="light"] .form-input {
  background-color: #FFFFFF !important;
  color: #0F172A !important;
  border: 1px solid #CBD5E1 !important;
}

.calc-results-panel {
  margin-top: 24px;
  background: var(--bg-card-elevated);
  border: 1px solid var(--border-card);
  border-radius: 14px;
  padding: 24px;
}

.estimate-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

@media (max-width: 680px) {
  .estimate-summary-grid {
    grid-template-columns: 1fr;
  }
}

.metric-box {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
}

.metric-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  display: block;
}

.metric-value {
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--accent-emerald);
  display: block;
  margin: 4px 0;
}

.metric-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.breakdown-bars {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.breakdown-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.breakdown-row-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
}

.progress-track {
  width: 100%;
  height: 10px;
  background: var(--bg-subtle);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #059669, #10B981);
  border-radius: 999px;
}

/* ==========================================================================
   6. 2-Column Responsive TOC Standard (Rule 3 Lock: Zero <ol>)
   ========================================================================== */
.toc-container {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 14px;
  padding: 20px 24px;
  margin-bottom: 26px;
}

.toc-header {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 20px;
}

@media (max-width: 768px) {
  .toc-list {
    grid-template-columns: 1fr;
  }
}

.toc-list li a {
  display: block;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--bg-subtle);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 600;
  border: 1px solid var(--border-subtle);
  text-decoration: none !important;
}

.toc-list li a:hover {
  border-color: var(--accent-emerald);
  color: var(--accent-emerald);
}

/* ==========================================================================
   7. Data Tables Dual-Theme Lock (Rule 6 Lock)
   ========================================================================== */
.table-scroll-container,
.data-table-container {
  width: 100%;
  overflow-x: auto;
  border-radius: 12px;
  margin: 20px 0;
  background: #0B132B;
  border: 1px solid var(--border-card);
}

.data-table,
table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.91rem;
}

.data-table th,
table th {
  background: #059669;
  color: #FFFFFF;
  font-weight: 700;
  padding: 13px 16px;
  border-bottom: 2px solid #047857;
}

.data-table td,
table td {
  padding: 12px 16px;
  color: #CBD5E1;
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
}

.data-table tr:nth-child(even) td {
  background: rgba(22, 34, 56, 0.55);
}

/* Light Mode Explicit Table Overrides */
[data-theme="light"] .table-scroll-container,
[data-theme="light"] .data-table-container,
[data-theme="light"] table {
  background: #FFFFFF !important;
  border: 1px solid #CBD5E1 !important;
}

[data-theme="light"] table th,
[data-theme="light"] .data-table th {
  background: #059669 !important;
  color: #FFFFFF !important;
  border-bottom: 2px solid #047857 !important;
}

[data-theme="light"] table td,
[data-theme="light"] .data-table td {
  background: #FFFFFF !important;
  color: #1E293B !important;
  border-bottom: 1px solid #E2E8F0 !important;
}

[data-theme="light"] table tr:nth-child(even) td {
  background: #F8FAFC !important;
}

/* ==========================================================================
   8. Guide Typography, Callouts, Formula Box & FAQ Accordions
   ========================================================================== */
.executive-summary-card {
  background: var(--bg-card-elevated);
  border-left: 4px solid var(--accent-emerald);
  border-radius: 12px;
  padding: 18px 22px;
  margin-bottom: 24px;
  color: var(--text-primary);
  font-size: 0.98rem;
}

.guide-section {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 14px;
  padding: 24px 28px;
  margin-bottom: 22px;
}

.guide-section h2 {
  font-size: 1.38rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-top: 0;
  margin-bottom: 14px;
}

.guide-section p,
.guide-section li {
  color: var(--text-secondary);
  font-size: 0.98rem;
  margin-bottom: 12px;
}

.formula-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-card);
  border-radius: 10px;
  padding: 16px 18px;
  margin: 16px 0;
  font-size: 0.92rem;
  color: var(--text-primary);
}

.formula-box code {
  display: block;
  margin-top: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: var(--accent-emerald);
  font-weight: 600;
}

.faq-item {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 14px;
}

.faq-question {
  font-size: 1.04rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 8px 0;
}

.faq-answer {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.official-disclaimer {
  background: var(--bg-subtle);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  padding: 18px 22px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 28px;
}

/* ==========================================================================
   9. Canonical Sticky Sidebar & Country/State Chips (Rule 5 Lock)
   ========================================================================== */
.sidebar-widget {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 14px;
  padding: 20px;
  box-shadow: var(--shadow-card);
}

.sidebar-widget-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-primary);
  padding-bottom: 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar-app-card {
  background: var(--bg-card-elevated);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 14px;
}

.sidebar-app-title {
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0 0 6px 0;
}

.sidebar-app-pkg {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.75rem;
  color: var(--accent-emerald);
  display: block;
  margin-bottom: 8px;
  word-break: break-all;
}

.sidebar-app-desc {
  font-size: 0.84rem;
  color: var(--text-secondary);
  margin: 0 0 12px 0;
}

.country-chips-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.country-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  background: #162238;
  border: 1px solid rgba(212, 175, 55, 0.25);
  color: #F8FAFC;
  text-decoration: none !important;
}

.country-chip:hover {
  border-color: #10B981;
  color: #10B981;
}

.country-chip.active {
  background: rgba(16, 185, 129, 0.16);
  border-color: #10B981;
  color: #10B981;
}

[data-theme="light"] .country-chip {
  background: #F8FAFC !important;
  border: 1px solid #CBD5E1 !important;
  color: #334155 !important;
}

[data-theme="light"] .country-chip:hover {
  border-color: #059669 !important;
  color: #059669 !important;
}

[data-theme="light"] .country-chip.active {
  background: #ECFDF5 !important;
  border-color: #10B981 !important;
  color: #047857 !important;
  font-weight: 700 !important;
}

/* ==========================================================================
   10. Mobile Sticky Bar Lock (Rule 4: Hidden on Desktop, Shown <= 768px)
   ========================================================================== */
.sticky-app-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 90;
  background: var(--bg-card);
  border-top: 2px solid var(--accent-gold);
  padding: 10px 16px;
  display: none;
  box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.35);
}

@media (max-width: 768px) {
  .sticky-app-bar {
    display: block;
  }
  body {
    padding-bottom: 72px;
  }
}

.sticky-app-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* ==========================================================================
   11. Crisp White Light Mode Footer & Dark Footer Lock (Rule 3 Lock)
   ========================================================================== */
.site-footer {
  background: #0B132B;
  border-top: 1px solid var(--border-card);
  padding: 48px 24px 32px;
  margin-top: 56px;
  color: #CBD5E1;
}

html[data-theme="light"] .site-footer,
body.light-theme .site-footer {
  background: #FFFFFF !important;
  border-top: 1px solid #E2E8F0 !important;
  color: #585F78 !important;
}

.footer-inner {
  max-width: 1360px;
  margin: 0 auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 32px;
  margin-bottom: 32px;
}

@media (max-width: 900px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 560px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }
}

.footer-heading {
  font-size: 0.96rem;
  font-weight: 800;
  color: #F8FAFC;
  margin: 0 0 14px 0;
}

html[data-theme="light"] .footer-heading {
  color: #141A31 !important;
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-links a {
  font-size: 0.88rem;
  color: #CBD5E1;
  text-decoration: none;
}

html[data-theme="light"] .footer-links a {
  color: #585F78 !important;
}

.footer-links a:hover {
  color: var(--accent-emerald) !important;
  text-decoration: underline;
}

.footer-bottom {
  padding-top: 24px;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.82rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
}

.cta-row {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
