:root {
  /* LIGHT MODE (Default) */
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --accent: #2563eb;
  --accent-gold: #b45309;
  --card-bg: #ffffff;
  --border-color: #e2e8f0;
  --input-bg: #ffffff;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
  --hero-bg: url('alaska_bg.png');
}

[data-theme='dark'] {
  /* DARK MODE */
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --accent: #3b82f6;
  --accent-gold: #fbbf24;
  --card-bg: #1e293b;
  --border-color: #334155;
  --input-bg: #0f172a;
  --shadow-sm: 0 4px 6px -1px rgba(0,0,0,0.4);
  --shadow-md: 0 10px 25px -5px rgba(0,0,0,0.5);
  --hero-bg: url('alaska_bg.png');
}

[data-theme='alaska'] {
  /* ALASKA THEME (Navy/Gold/Ice) */
  --bg-primary: #0d1b2a;
  --bg-secondary: #1b263b;
  --text-primary: #e0e1dd;
  --text-secondary: #778da9;
  --accent: #e0a100; /* Precision Gold */
  --accent-gold: #e0a100;
  --card-bg: #1b263b;
  --border-color: #415a77;
  --input-bg: #0d1b2a;
  --shadow-sm: 0 4px 6px -1px rgba(0,0,0,0.5);
  --shadow-md: 0 10px 25px -5px rgba(0,0,0,0.6);
  --hero-bg: url('alaska_bg.png');
}

/* Global Alaska Background */
[data-theme='alaska'] body {
  background-image: linear-gradient(rgba(13, 27, 42, 0.92), rgba(13, 27, 42, 0.92)), var(--hero-bg);
  background-attachment: fixed;
  background-size: cover;
  background-position: center;
}

[data-theme='alaska'] .dark-section {
  background: rgba(27, 38, 59, 0.4); /* Transparent secondary areas to show background */
}

/* Ensure backgrounds are visible but restrained */
.hero-alaska {
  background: var(--hero-bg) no-repeat center center;
  background-size: cover;
  position: relative;
}
.hero-alaska::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to right, rgba(255,255,255,0.9), rgba(255,255,255,0.2));
  z-index: 1;
}
[data-theme='dark'] .hero-alaska::before,
[data-theme='alaska'] .hero-alaska::before {
  background: linear-gradient(to right, var(--bg-primary), rgba(15,23,42,0.6));
}

* { box-sizing: border-box; }
body { 
  font-family: 'Inter', system-ui, -apple-system, sans-serif; 
  background-color: var(--bg-primary); 
  color: var(--text-primary); 
  margin: 0; 
  transition: background 0.4s ease, color 0.4s ease; 
  line-height: 1.6;
}

/* Nav & Header */
.navbar { 
  display: flex; justify-content: space-between; align-items: center; 
  padding: 1.5rem 5%; background: var(--bg-primary); 
  border-bottom: 1px solid var(--border-color);
  position: sticky; top: 0; z-index: 100;
  transition: background 0.4s ease;
}
.logo { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.5px;}
.text-blue { color: var(--accent); }

/* Buttons */
.cta-outline { 
  padding: 0.7rem 1.5rem; border: 1.5px solid var(--border-color); 
  border-radius: 6px; color: var(--text-primary); font-weight: 600; 
  text-decoration: none; cursor: pointer; transition: all 0.2s;
}
.cta-outline:hover { border-color: var(--accent); color: var(--accent); }

.cta-primary { 
  padding: 1rem 2.5rem; background: var(--accent); color: var(--bg-primary); 
  font-weight: 700; font-size: 1.05rem; border-radius: 6px; 
  text-decoration: none; border:none; display: inline-block; cursor:pointer;
  transition: transform 0.2s, background 0.2s, box-shadow 0.2s;
  color: #fff; /* Force white for primary contrast unless it's Alaska Gold on White */
}
[data-theme='dark'] label, [data-theme='dark'] .light-label { color: var(--text-primary); }
[data-theme='alaska'] .cta-primary,
[data-theme='alaska'] button.cta-primary,
[data-theme='alaska'] .cta-outline:hover {
  color: #0d1b2a !important; /* Force Navy text on Gold background */
  font-weight: 700;
}
[data-theme='alaska'] .cta-outline {
  color: var(--accent-gold) !important;
}
[data-theme='alaska'] .nav-item.active {
  background: var(--accent-gold);
  color: #0d1b2a !important;
}
[data-theme='alaska'] .stat-card h3 {
  color: var(--accent-gold);
}
.hero-content h1 { font-size: clamp(3rem, 5vw, 4.5rem); margin-bottom: 1rem; line-height: 1.1; letter-spacing: -1px;}
.hero-content p { font-size: 1.2rem; color: var(--text-secondary); max-width: 700px; margin: 0 auto 2rem; }

.section-pad { padding: 6rem 5%; }
.dark-section { background: var(--bg-secondary); }

/* Service Card Detail Hero - Ensure Image Visibility */
.service-detail-hero { 
  padding: 6rem 5%; 
  background-color: var(--bg-secondary); /* Fallback */
  background-image: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.7)), var(--detail-bg, none);
  background-size: cover; 
  background-position: center; 
  text-align: center; 
  border-bottom: 1px solid var(--border-color);
}
.service-detail-hero h1 { color: #fff !important; text-shadow: 0 2px 4px rgba(0,0,0,0.3); }
.service-detail-hero p { color: rgba(255,255,255,0.9) !important; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }

/* Cards */
.card-grid { 
  display: grid; 
  grid-template-columns: repeat(3, 1fr); 
  gap: 2rem; 
  max-width: 1200px; 
  margin: 0 auto; 
}
@media (max-width: 1024px) { .card-grid { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); } }
.service-card { 
  background: var(--card-bg); padding: 2.5rem; border-radius: 12px; 
  border: 1px solid var(--border-color); box-shadow: var(--shadow-sm); 
  transition: transform 0.3s ease, border-color 0.3s;
}
.service-card:hover { transform: translateY(-5px); border-color: var(--accent); }
.gold-text { color: var(--accent-gold); font-weight: 600; font-size: 1.3rem; margin-bottom: 0.5rem; }

/* Forms & Quote Builder */
.form-card { 
  background: var(--card-bg); border-radius: 12px; border: 1px solid var(--border-color); 
  padding: 3rem; box-shadow: var(--shadow-md); max-width: 900px; margin: 0 auto;
}
.form-group { margin-bottom: 1.5rem; }
label { display: block; font-weight: 600; margin-bottom: 0.5rem; font-size: 0.95rem; color: var(--text-primary);}
input[type="text"], input[type="email"], input[type="number"], select, textarea, input[type="datetime-local"] { 
  width: 100%; padding: 0.9rem 1rem; border: 1px solid var(--border-color); 
  border-radius: 6px; background: var(--input-bg); color: var(--text-primary); 
  font-size: 1rem; font-family: inherit; transition: border-color 0.2s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1); }

/* Custom Checkbox Trees */
.scope-tree { margin-top: 2rem; background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: 8px; padding: 1.5rem; }
.scope-category { margin-bottom: 1.5rem; border-bottom: 1px solid var(--border-color); padding-bottom: 1.5rem; }
.scope-category:last-child { margin-bottom: 0; border-bottom: none; padding-bottom: 0; }
.scope-header { font-weight: 700; font-size: 1.1rem; margin-bottom: 1rem; color: var(--text-primary); display: flex; align-items: center; justify-content: space-between;}
.scope-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.checkbox-wrap { 
  display: flex; 
  align-items: center; 
  cursor: pointer; 
  padding: 0.8rem; 
  border-radius: 8px; 
  transition: all 0.2s; 
  border: 1px solid transparent;
}
.checkbox-wrap:hover { background: rgba(59, 130, 246, 0.08); border-color: rgba(59, 130, 246, 0.2); }
.checkbox-wrap input { width: 1.2rem; height: 1.2rem; margin-right: 0.8rem; cursor: pointer; accent-color: var(--accent); }
.checkbox-wrap span { font-size: 0.95rem; color: var(--text-secondary); font-weight: 500;}
.checkbox-wrap:has(input:checked) { background: rgba(59, 130, 246, 0.12); border-color: var(--accent); }
.checkbox-wrap input:checked + span { color: var(--text-primary); font-weight: 700;}

/* Price Estimator Area */
.price-display { 
  background: var(--bg-secondary); border: 1px solid var(--border-color);
  padding: 2.5rem; border-radius: 12px; margin-top: 3rem; text-align: center;
}
.price-display h3 { margin: 0; font-size: 1rem; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 1px;}
.price-display h1 { margin: 0.5rem 0 0 0; font-size: 3.5rem; color: var(--accent); font-weight: 800; line-height: 1;}
.price-meta { font-size: 0.9rem; color: var(--text-secondary); margin-top: 1rem; display: block; }

/* Modals */
.modal-overlay { 
  position: fixed; inset: 0; background: rgba(0,0,0,0.6); 
  display: flex; justify-content: center; align-items: center; 
  z-index: 9999; opacity: 0; visibility: hidden; transition: all 0.3s;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal-content { 
  background: var(--bg-primary); padding: 3rem; border-radius: 12px; 
  border: 1px solid var(--border-color); max-width: 600px; width: 95%; 
  position: relative; transform: translateY(20px); transition: transform 0.3s;
  max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-md);
}
.modal-overlay.active .modal-content { transform: translateY(0); }
.modal-close { position: absolute; top: 1.5rem; right: 1.5rem; cursor: pointer; font-size: 1.5rem; }

/* Theme Toggle (Fixed dYOT issue) */
.theme-toggle-btn { 
  position: fixed; bottom: 2rem; right: 2rem; height: 50px; width: 50px; 
  border-radius: 50%; background: var(--bg-secondary); border: 1px solid var(--border-color); 
  color: var(--text-primary); font-size: 1.2rem; cursor: pointer; 
  box-shadow: var(--shadow-sm); z-index: 9000; display: flex; align-items: center; justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
}
.theme-toggle-btn:hover { transform: scale(1.1); box-shadow: var(--shadow-md); }
.theme-toggle-btn svg { width: 20px; height: 20px; fill: currentColor; }

/* Dashboard / Portal */
.dash-layout { display: flex; flex-direction: column; min-height: 100vh; }
.table-wrapper { width: 100%; overflow-x: auto; background: var(--card-bg); border-radius: 8px; border: 1px solid var(--border-color); }
.data-table { width: 100%; border-collapse: collapse; text-align: left; }
.data-table th, .data-table td { padding: 1rem; border-bottom: 1px solid var(--border-color); }
.data-table th { font-size: 0.85rem; text-transform: uppercase; color: var(--text-secondary); background: rgba(0,0,0,0.02); }
.data-table tbody tr:hover { background: var(--bg-secondary); }

.badge { 
  padding: 0.4rem 1rem; 
  border-radius: 4px; 
  font-size: 0.75rem; 
  font-weight: 700; 
  display: inline-block; 
  text-transform: uppercase; 
  letter-spacing: 0.5px;
}
.badge.pending { background: rgba(212, 175, 55, 0.08); color: var(--accent-gold); border: 1px solid rgba(212, 175, 55, 0.2); }
.badge.success { background: rgba(52, 199, 89, 0.08); color: #34c759; border: 1px solid rgba(52, 199, 89, 0.2); }

/* Animation Utils */
.anim-fade { opacity: 0; transform: translateY(15px); transition: opacity 0.6s ease-out, transform 0.6s ease-out; }
.anim-fade.visible { opacity: 1; transform: translateY(0); }

/* Images & Visuals */
.premium-img { width: 100%; height: 400px; object-fit: cover; border-radius: 12px; box-shadow: var(--shadow-sm); }
.brand-image { width: 100%; height: 200px; object-fit: cover; border-radius: 12px 12px 0 0; }

.footer { text-align: center; padding: 4rem 2rem; background: var(--bg-secondary); border-top: 1px solid var(--border-color); }
.footer a { color: var(--text-secondary); text-decoration: none; margin: 0 1rem; transition: color 0.2s;}
.footer a:hover { color: var(--accent); }
.footer-socials { margin-top: 2rem; display: flex; justify-content: center; gap: 1rem;}
.footer-socials a svg { width: 24px; height: 24px; fill: currentColor; }

/* Mobile Navbar Book Link */
@media (max-width: 768px) {
    .navbar div:nth-child(2) {
        flex-wrap: wrap;
        justify-content: flex-end;
    }
    .navbar a[href="/book/index.html"] {
        font-size: 10px !important;
        padding: 4px 8px !important;
    }
}

