/* ── Variables ───────────────────────────────────────────────────────────────*/
:root {
  --primary:       #1e40af;
  --primary-dark:  #1e3a8a;
  --primary-light: #3b82f6;
  --accent:        #059669;
  --accent-dark:   #047857;
  --dark:          #0f172a;
  --text:          #334155;
  --muted:         #64748b;
  --light-bg:      #f8fafc;
  --border:        #e2e8f0;
  --highlight:     #34d399;
  --white:         #ffffff;
}

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

body {
  font-family: 'Inter', 'Roboto', system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--white);
  line-height: 1.65;
  -webkit-text-size-adjust: 100%;
}

/* Kill any old loader immediately */
.loader { display: none !important; }

/* ── Navbar ──────────────────────────────────────────────────────────────────*/
.site-navbar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0.5rem 0;
  position: sticky;
  top: 0;
  z-index: 1030;
  box-shadow: 0 1px 8px rgba(0,0,0,.06);
}

.site-navbar .navbar-brand img {
  height: 46px;
  object-fit: contain;
  max-width: 200px;
}

.site-navbar .nav-link {
  color: var(--text) !important;
  font-weight: 500;
  font-size: 0.88rem;
  padding: 0.5rem 0.75rem !important;
  border-radius: 6px;
  transition: background .15s, color .15s;
}
.site-navbar .nav-link:hover,
.site-navbar .nav-link:focus {
  background: var(--light-bg);
  color: var(--primary) !important;
}

/* ── Dropdown menus ───────────────────────────────────────────────────────────*/
.site-dropdown {
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0,0,0,.10);
  padding: 0.5rem 0;
  min-width: 230px;
  max-height: 80vh;
  overflow-y: auto;
}
.site-dropdown .dropdown-item {
  font-size: 0.85rem;
  padding: 0.42rem 1.1rem;
  color: var(--text);
  border-radius: 0;
  transition: background .12s, color .12s;
}
.site-dropdown .dropdown-item:hover,
.site-dropdown .dropdown-item:focus {
  background: var(--light-bg);
  color: var(--primary);
}
.site-dropdown .dropdown-header {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.6rem 1.1rem 0.25rem;
}
.site-dropdown .dropdown-divider {
  margin: 0.3rem 0;
  border-color: var(--border);
}
.site-navbar .dropdown-toggle::after {
  margin-left: 0.3em;
  vertical-align: 0.15em;
}
@media (min-width: 992px) {
  .site-navbar .dropdown:hover > .dropdown-menu {
    display: block;
    animation: fadeDropdown .15s ease;
  }
}
@keyframes fadeDropdown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Mobile nav: give items more breathing room */
@media (max-width: 991px) {
  .site-navbar .navbar-collapse {
    border-top: 1px solid var(--border);
    margin-top: 0.5rem;
    padding-top: 0.5rem;
  }
  .site-navbar .nav-link {
    padding: 0.6rem 0.5rem !important;
    font-size: 1rem;
    border-radius: 0;
    border-bottom: 1px solid var(--border);
  }
  .site-navbar .nav-link:last-child { border-bottom: none; }
}

.btn-nav-cta {
  background: var(--accent) !important;
  color: var(--white) !important;
  border-radius: 8px !important;
  font-weight: 600 !important;
  font-size: 0.88rem !important;
  padding: 0.5rem 1.1rem !important;
  transition: background .2s !important;
}
.btn-nav-cta:hover {
  background: var(--accent-dark) !important;
}

/* Mobile CTA button */
@media (max-width: 991px) {
  .btn-nav-cta {
    display: inline-block !important;
    margin-top: 0.5rem !important;
    width: 100%;
    text-align: center;
    font-size: 1rem !important;
  }
}

/* ── Hero ────────────────────────────────────────────────────────────────────*/
.hero {
  background: linear-gradient(140deg, var(--dark) 0%, var(--primary-dark) 55%, var(--primary-light) 100%);
  color: var(--white);
  padding: 5.5rem 0 4.5rem;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 80% 50%, rgba(59,130,246,.18) 0%, transparent 70%);
  pointer-events: none;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.22);
  color: rgba(255,255,255,.92);
  border-radius: 999px;
  padding: .3rem .9rem;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .03em;
  margin-bottom: 1.25rem;
}

.hero h1 {
  font-size: clamp(1.8rem, 5vw, 3.4rem);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 1.1rem;
  letter-spacing: -.02em;
}
.hero h1 span { color: var(--highlight); }

.hero .lead {
  font-size: clamp(1rem, 2.5vw, 1.15rem);
  color: rgba(255,255,255,.82);
  max-width: 560px;
  margin-bottom: 2rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin-bottom: 2.5rem;
}

.hero-trust {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255,255,255,.15);
}
.hero-trust-item {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .82rem;
  color: rgba(255,255,255,.8);
  font-weight: 500;
}
.hero-trust-item i { color: var(--highlight); font-size: 1rem; }

@media (max-width: 767px) {
  .hero { padding: 3rem 0 2.5rem; }
  .hero-actions { flex-direction: column; }
  .hero-actions .btn { width: 100%; text-align: center; }
  .hero-trust { gap: 0.75rem; }
}

/* ── Page banner (inner pages) ───────────────────────────────────────────────*/
.page-banner,
.section.page-title.background-wrapper,
.section.page-title {
  background: linear-gradient(135deg, var(--dark) 0%, var(--primary-dark) 100%) !important;
  color: var(--white);
  padding: 2.5rem 0 2rem;
}
.page-banner h1,
.section.page-title h1 {
  font-size: clamp(1.4rem, 4vw, 2.2rem);
  font-weight: 700;
  margin-bottom: .4rem;
  letter-spacing: -.01em;
}
.page-banner p,
.section.page-title p { color: rgba(255,255,255,.78); margin-bottom: 0; }

/* Backward-compat: old theme classes */
.section              { display: block; }
.active-section       { display: block; }
.with-overlay         {}
.black-overlay        {}
.background-wrapper   {}
.small-padding        { padding-top: 1.5rem !important; padding-bottom: 1.5rem !important; }
.grey-background,
.section.grey-background { background: var(--light-bg); padding: 3.5rem 0; }

/* ── Stats bar ───────────────────────────────────────────────────────────────*/
.stats-bar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 0;
}
.stat-item { text-align: center; padding: .5rem 0.5rem; }
.stat-item .stat-number {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
}
.stat-item .stat-label { font-size: .75rem; color: var(--muted); font-weight: 500; margin-top: .2rem; }

/* ── Section titles ──────────────────────────────────────────────────────────*/
.section-label {
  display: inline-block;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--primary);
  background: rgba(30,64,175,.08);
  border-radius: 999px;
  padding: .25rem .9rem;
  margin-bottom: .75rem;
}
.section-title {
  font-size: clamp(1.4rem, 3.5vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--dark);
}

/* ── Feature cards ───────────────────────────────────────────────────────────*/
.feature-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.5rem;
  height: 100%;
  background: var(--white);
  transition: box-shadow .2s, transform .2s;
}
.feature-card:hover {
  box-shadow: 0 8px 32px rgba(30,64,175,.1);
  transform: translateY(-3px);
}
.icon-wrap {
  width: 52px; height: 52px;
  border-radius: 12px;
  background: rgba(30,64,175,.09);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 1rem;
  flex-shrink: 0;
}
.icon-wrap i { font-size: 1.5rem; color: var(--primary); }
.feature-card h5 { font-weight: 700; color: var(--dark); margin-bottom: .5rem; }
.feature-card p  { font-size: .9rem; color: var(--muted); margin-bottom: 0; }

/* ── Steps ───────────────────────────────────────────────────────────────────*/
.step-number {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--white);
  font-weight: 800;
  font-size: 1.2rem;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1rem;
  flex-shrink: 0;
}

/* ── Buttons ─────────────────────────────────────────────────────────────────*/
.btn-primary-custom,
.btn-punch.btn-primary,
.btn-punch.btn-darker {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: var(--white) !important;
  border-radius: 8px !important;
  font-weight: 600 !important;
  padding: .65rem 1.6rem !important;
  transition: background .2s, transform .15s, box-shadow .2s !important;
  box-shadow: 0 2px 10px rgba(30,64,175,.28) !important;
  min-height: 44px;
}
.btn-primary-custom:hover,
.btn-punch.btn-primary:hover,
.btn-punch.btn-darker:hover {
  background: var(--primary-dark) !important;
  border-color: var(--primary-dark) !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 18px rgba(30,64,175,.38) !important;
}

.btn-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--white);
  border-radius: 8px;
  font-weight: 600;
  padding: .65rem 1.6rem;
  transition: background .2s, transform .15s, box-shadow .2s;
  box-shadow: 0 2px 10px rgba(5,150,105,.28);
  min-height: 44px;
}
.btn-accent:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  color: var(--white);
  transform: translateY(-2px);
  box-shadow: 0 4px 18px rgba(5,150,105,.38);
}

/* All buttons: accessible touch target */
.btn { min-height: 44px; }

/* ── Quote form ──────────────────────────────────────────────────────────────*/
.quote-form-card {
  border: none;
  border-radius: 16px;
  box-shadow: 0 4px 32px rgba(0,0,0,.1);
  overflow: hidden;
}
.quote-form-card .card-header {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: var(--white);
  padding: 1.25rem 1.5rem;
  border: none;
}
.code-row-card {
  background: var(--light-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: .75rem;
  transition: border-color .2s;
}
.code-row-card:focus-within { border-color: var(--primary-light); }

/* Mobile form adjustments */
@media (max-width: 767px) {
  .code-row { padding: 0.75rem !important; }
  .code-row .row { gap: 0.5rem 0; }
}

/* ── Results ─────────────────────────────────────────────────────────────────*/
.savings-banner {
  background: linear-gradient(135deg, var(--accent-dark), var(--accent));
  color: var(--white);
  border-radius: 16px;
  padding: 2rem;
  text-align: center;
  margin-bottom: 2rem;
}
.savings-banner .savings-amount {
  font-size: clamp(2.2rem, 8vw, 4rem);
  font-weight: 900;
  letter-spacing: -.03em;
  line-height: 1;
}

/* ── CTA section ─────────────────────────────────────────────────────────────*/
.cta-section {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: var(--white);
  padding: 3.5rem 0;
}
.cta-section h2 { font-weight: 700; font-size: clamp(1.4rem, 3vw, 2rem); }

/* ── Footer ──────────────────────────────────────────────────────────────────*/
.site-footer {
  background: var(--dark);
  color: rgba(255,255,255,.65);
  padding: 3rem 0 0;
}
.site-footer h6 {
  color: var(--white);
  font-size: .75rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 1rem;
}
.site-footer a { color: rgba(255,255,255,.55); text-decoration: none; transition: color .15s; }
.site-footer a:hover { color: var(--white); }
.site-footer p { font-size: .88rem; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.08);
  padding: 1.25rem 0;
  margin-top: 2.5rem;
  font-size: .8rem;
}

/* ── Tables ──────────────────────────────────────────────────────────────────*/
.table thead th {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 600;
}
.table td, .table th { vertical-align: middle; }

/* Mobile table: make all tables scrollable */
@media (max-width: 767px) {
  .table-responsive-force {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* ── Forms (mobile) ──────────────────────────────────────────────────────────*/
.form-control, .form-select {
  min-height: 44px;
  font-size: 16px; /* prevents iOS zoom on focus */
}
@media (max-width: 767px) {
  .form-control, .form-select { font-size: 16px; }
}

/* ── Misc utilities ──────────────────────────────────────────────────────────*/
.text-success { color: var(--accent) !important; }
.divider { border: none; border-top: 1px solid var(--border); margin: 2.5rem 0; }

/* Code badge */
.code-badge {
  display: inline-block;
  background: rgba(30,64,175,.1);
  color: var(--primary);
  border-radius: 6px;
  padding: .15rem .5rem;
  font-family: monospace;
  font-size: .9em;
  font-weight: 600;
}

/* Alert improvements */
.alert { border-radius: 10px; }

/* ── Card hover ──────────────────────────────────────────────────────────────*/
.card-hover {
  transition: box-shadow .2s, transform .2s;
  cursor: pointer;
}
.card-hover:hover {
  box-shadow: 0 8px 28px rgba(0,0,0,.1);
  transform: translateY(-2px);
}

/* ── Admin panel ─────────────────────────────────────────────────────────────*/
.admin-sidebar {
  background: var(--dark);
  min-height: 100vh;
  padding: 1.5rem 0;
}
.admin-sidebar .nav-link {
  color: rgba(255,255,255,.6);
  padding: .6rem 1.25rem;
  border-radius: 6px;
  margin: .1rem .5rem;
  font-size: .9rem;
}
.admin-sidebar .nav-link:hover,
.admin-sidebar .nav-link.active {
  background: rgba(255,255,255,.1);
  color: var(--white);
}
.admin-sidebar .nav-link i { width: 20px; }

/* ── Responsive tweaks ───────────────────────────────────────────────────────*/
@media (max-width: 575px) {
  .hero { padding: 2.5rem 0 2rem; }
  .stats-bar .stat-item { border-bottom: 1px solid var(--border); }
  .stats-bar .col-6:nth-child(odd) { border-right: 1px solid var(--border); }
  .savings-banner { padding: 1.5rem; }
  .cta-section { padding: 2.5rem 0; }
  .site-footer { padding: 2rem 0 0; }
}

@media (max-width: 767px) {
  /* Ensure full-width buttons on mobile */
  .hero-actions .btn { display: block; }
}
