﻿/* ============================================================
   RESET & VARIABLES
   ============================================================ */
:root {
  --primary: #00796b;
  --primary-dark: #005a4f;
  --accent: #1abc9c;
  --bg: #f7f9fc;
  --card: #ffffff;
  --text: #1a1a1a;
  --muted: #5a6472;
  --border: #d0d7de;
  --label: #00796b;
  --input-h: 48px;
  --label-h: 32px;
  --radius: 8px;
}

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

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

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

.site-header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.logo span {
  color: var(--accent);
}
.site-header nav a {
  margin-left: 20px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
}
.site-header nav a:hover {
  color: var(--primary);
}

.breadcrumb-nav {
  padding: 12px 0;
  background: #f7f9fc;
  font-size: 0.85rem;
}
.breadcrumb-nav ol {
  list-style: none;
  display: flex;
  gap: 8px;
  padding: 0;
  margin: 0;
}
.breadcrumb-nav li::after {
  content: "›";
  margin-left: 8px;
  color: #999;
}
.breadcrumb-nav li:last-child::after {
  content: "";
}
.breadcrumb-nav a {
  color: #00796b;
  text-decoration: none;
}
.breadcrumb-nav a:hover {
  text-decoration: underline;
}
.breadcrumb-nav [aria-current="page"] {
  color: #666;
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  padding: 40px 0;
  text-align: center;
}
.hero h1 {
  font-size: 2rem;
  margin-bottom: 8px;
}
.hero p {
  opacity: 0.9;
  max-width: 600px;
  margin: 0 auto;
  font-size: 0.95rem;
}

/* ============================================================
   TWO-COLUMN CALCULATOR GRID
   ============================================================ */
.calculator-section {
  padding: 30px 0;
}

.calculator-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 25px;
  align-items: start;
}

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

/* ============================================================
   FORM GRID (2 columns inside the form)
   ============================================================ */
.salary-form {
  background: var(--card);
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);

  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 18px;
}

/* Each field */
.field {
  display: flex;
  flex-direction: column;
  min-width: 0; /* prevents overflow in grid */
}

/* Full-width field (spans both columns) */
.field.full {
  grid-column: 1 / -1;
}

/* The submit button spans both columns */
.btn-calculate {
  grid-column: 1 / -1;
  margin-top: 8px;
  padding: 14px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-calculate:hover {
  background: var(--primary-dark);
}

/* ============================================================
   LABELS — fixed height so inputs always align
   ============================================================ */
.field label {
  display: block;
  min-height: var(--label-h);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--label);
  margin-bottom: 6px;
  line-height: 1.2;
  /* Allow wrapping but keep 2 lines max */
  max-height: calc(var(--label-h) * 1);
}

/* ============================================================
   INPUTS / SELECTS — fixed height for perfect alignment
   ============================================================ */
.field input,
.field select {
  height: var(--input-h);
  width: 100%;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  background: #fff;
  color: var(--text);
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
  appearance: none;
  -webkit-appearance: none;
}

.field select {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  padding-right: 32px;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 121, 107, 0.12);
}

/* Locked (disabled) state — same height, green background */
.field input:disabled,
.field select:disabled {
  background-color: #e8f5e9;
  color: #4a6b5e;
  cursor: not-allowed;
  border-color: #c8e6c9;
}

/* Small helper text under a field */
.field small {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.3;
}

/* ============================================================
   RESULTS PANEL
   ============================================================ */
.results {
  background: var(--card);
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
  position: sticky;
  top: 90px;
}
.results.hidden {
  display: none;
}

.result-header {
  text-align: center;
  margin-bottom: 18px;
}
.result-header h2 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #333;
  margin-bottom: 12px;
  font-weight: 700;
}
.big-number {
  font-size: 2.6rem;
  font-weight: 800;
  color: #1a1a1a;
  line-height: 1;
  letter-spacing: -1px;
}
.sub-number {
  font-size: 0.9rem;
  color: #888;
  margin-top: 6px;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  border-bottom: 1px solid #eee;
  padding-bottom: 8px;
}
.tab {
  background: none;
  border: none;
  padding: 7px 14px;
  font-size: 0.82rem;
  color: #555;
  cursor: pointer;
  border-radius: 6px;
  font-weight: 600;
}
.tab.active {
  background: var(--primary);
  color: #fff;
}
.tab:hover:not(.active) {
  background: #f0f0f0;
}

.tab-content {
  display: none;
}
.tab-content.active {
  display: block;
}

/* Breakdown */
.breakdown-details {
  margin-top: 16px;
  background: #f7f9fc;
  padding: 10px 14px;
  border-radius: 8px;
}
.breakdown-details summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--primary);
}
.breakdown-table {
  width: 100%;
  margin-top: 10px;
  border-collapse: collapse;
}
.breakdown-table td {
  padding: 5px 4px;
  font-size: 0.8rem;
  border-bottom: 1px solid #e2e8f0;
}
.breakdown-table td:last-child {
  text-align: right;
  font-weight: 600;
}
.breakdown-table .total-row td {
  border-top: 2px solid var(--primary);
  border-bottom: none;
  padding-top: 8px;
}

/* ============================================================
   CONTENT SECTIONS
   ============================================================ */
.content-section {
  padding: 40px 0;
  background: #fff;
}
.content-section h2 {
  margin-bottom: 14px;
  color: var(--primary-dark);
  font-size: 1.4rem;
}
.content-section ol {
  padding-left: 20px;
}
.content-section li {
  margin-bottom: 8px;
  font-size: 0.95rem;
}
details {
  background: var(--bg);
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: pointer;
}
details summary {
  font-weight: 600;
  font-size: 0.9rem;
}
details p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.88rem;
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  background: #1a1a1a;
  color: #aaa;
  text-align: center;
  padding: 20px 0;
  font-size: 0.8rem;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 600px) {
  .hero h1 {
    font-size: 1.5rem;
  }
  .salary-form {
    grid-template-columns: 1fr;
  }
  .field.full {
    grid-column: 1;
  }
  .big-number {
    font-size: 2rem;
  }
}
/* ============================================================
   PREVENT HORIZONTAL OVERFLOW (Fixes scrollbar issue)
   ============================================================ */
html,
body {
  overflow-x: hidden;
  max-width: 100vw;
}

* {
  min-width: 0; /* Prevents flex/grid children from overflowing */
}

/* ============================================================
   HEADER — Flex layout with hamburger support
   ============================================================ */
.site-header {
  background: #fff;
  border-bottom: 1px solid #eee;
  padding: 14px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: nowrap;
}

.logo {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  white-space: nowrap;
}
.logo span {
  color: var(--accent);
}

/* Hamburger button — hidden on desktop */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 28px;
  height: 22px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 110;
}

.hamburger span {
  display: block;
  width: 100%;
  height: 2.5px;
  background: var(--primary);
  border-radius: 2px;
  transition:
    transform 0.25s ease,
    opacity 0.2s ease;
  transform-origin: center;
}

/* Hamburger → X when open */
.hamburger.active span:nth-child(1) {
  transform: translateY(9.5px) rotate(45deg);
}
.hamburger.active span:nth-child(2) {
  opacity: 0;
}
.hamburger.active span:nth-child(3) {
  transform: translateY(-9.5px) rotate(-45deg);
}

/* Navigation — desktop */
.main-nav {
  display: flex;
  align-items: center;
  gap: 24px;
}
.main-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  transition: color 0.2s;
}
.main-nav a:hover {
  color: var(--primary);
}

/* ============================================================
   MOBILE — Show hamburger + collapse nav
   ============================================================ */
@media (max-width: 768px) {
  .hamburger {
    display: flex;
  }

  .main-nav {
    position: fixed;
    top: 0;
    right: -100%;
    width: 70%;
    max-width: 300px;
    height: 100vh;
    background: #fff;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 80px 28px 28px;
    gap: 20px;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.08);
    transition: right 0.3s ease;
    z-index: 105;
  }

  .main-nav.open {
    right: 0;
  }

  .main-nav a {
    font-size: 1.05rem;
    font-weight: 600;
    padding: 8px 0;
    width: 100%;
    border-bottom: 1px solid #f0f0f0;
  }

  /* Hero adjustments */
  .hero {
    padding: 30px 0;
  }
  .hero h1 {
    font-size: 1.5rem;
  }
  .hero p {
    font-size: 0.9rem;
  }

  /* Calculator grid — single column */
  .calculator-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  /* Results — remove sticky on mobile (it doesn't help) */
  .results {
    position: static;
    top: auto;
  }

  /* Form — keep two columns down to 500px */
  .salary-form {
    padding: 18px;
    gap: 14px 14px;
  }

  /* Big number slightly smaller */
  .big-number {
    font-size: 2rem;
  }

  /* Breakdown table more compact */
  .breakdown-table td {
    font-size: 0.78rem;
    padding: 5px 3px;
  }

  /* Chart container fix — prevents overflow */
  .tab-content {
    width: 100%;
    overflow: hidden;
  }
  #chart-flow,
  #chart-composition {
    width: 100% !important;
    max-width: 100%;
  }
}

/* Extra small devices */
@media (max-width: 480px) {
  .container {
    padding: 0 14px;
  }

  /* Form — single column below 480px */
  .salary-form {
    grid-template-columns: 1fr;
  }
  .field.full {
    grid-column: 1;
  }

  .hero h1 {
    font-size: 1.3rem;
  }

  .big-number {
    font-size: 1.8rem;
  }

  .tabs {
    flex-wrap: wrap;
  }
  .tab {
    font-size: 0.75rem;
    padding: 6px 10px;
  }

  /* Ensure charts don't overflow */
  .apexcharts-canvas {
    max-width: 100% !important;
  }
}

/* ============================================================
   LANDING PAGE STYLES
   ============================================================ */
.landing-content {
  max-width: 800px;
  margin: 0 auto;
}

.landing-content h2 {
  color: var(--primary-dark);
  font-size: 1.5rem;
  margin-bottom: 16px;
}

.landing-content h3 {
  color: var(--primary);
  font-size: 1.1rem;
  margin: 24px 0 12px;
}

.landing-content p {
  margin-bottom: 14px;
  font-size: 0.95rem;
  line-height: 1.7;
}

.landing-content ul {
  margin: 12px 0 20px 20px;
}

.landing-content ul li {
  margin-bottom: 6px;
  font-size: 0.93rem;
}

.landing-content .breakdown-table {
  background: #fff;
  border-radius: 8px;
  padding: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.landing-content .breakdown-table th {
  font-size: 0.85rem;
  color: var(--primary-dark);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
  padding-bottom: 8px !important;
  border-bottom: 2px solid var(--primary);
}

.landing-content .breakdown-table td {
  padding: 8px !important;
  border-bottom: 1px solid #e2e8f0;
  font-size: 0.9rem;
}

/* RAL field: prevent overflow on mobile */
#ral {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.5px;
}

@media (max-width: 480px) {
  #ral {
    font-size: 0.9rem;
  }
}

/* ============================================================
   NAV DROPDOWN
   ============================================================ */
.nav-dropdown {
  position: relative;
}
.nav-dropdown .dropdown-toggle {
  cursor: pointer;
}
.nav-dropdown .dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  padding: 8px 0;
  min-width: 160px;
  z-index: 200;
}
.nav-dropdown:hover .dropdown-menu {
  display: block;
}
.nav-dropdown .dropdown-menu a {
  display: block;
  padding: 8px 16px;
  font-size: 0.85rem;
  color: #333;
  text-decoration: none;
}
.nav-dropdown .dropdown-menu a:hover {
  background: #f0f0f0;
  color: #00796b;
}

@media (max-width: 768px) {
  .nav-dropdown .dropdown-menu {
    position: static;
    display: block;
    box-shadow: none;
    border: none;
    padding-left: 20px;
  }
  .nav-dropdown .dropdown-toggle {
    pointer-events: none;
    opacity: 0.6;
  }
}
