:root {
  --primary: #1a5276;
  --primary-light: #2980b9;
  --accent: #27ae60;
  --accent-dark: #1e8449;
  --bg: #f8f9fa;
  --card-bg: #ffffff;
  --text: #212529;
  --text-muted: #6c757d;
  --border: #dee2e6;
  --result-bg: #eaf4fb;
  --danger: #e74c3c;
  --warning: #f39c12;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  font-size: 16px;
  line-height: 1.5;
}

/* ── Navbar ── */
.navbar { background: var(--primary); padding: 0.75rem 1rem; position: sticky; top: 0; z-index: 100; }
.navbar-inner { max-width: 900px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; }
.navbar-brand { color: #fff; font-weight: 700; font-size: 1.25rem; text-decoration: none; }
.navbar-brand span { color: #f1c40f; }
.nav-links { display: flex; gap: 1rem; list-style: none; margin: 0; padding: 0; align-items: center; }
.nav-links a { color: rgba(255,255,255,0.85); text-decoration: none; font-size: 0.9rem; }
.nav-links a:hover { color: #fff; }
.hamburger { display: none; background: none; border: none; cursor: pointer; color: #fff; font-size: 1.5rem; }

/* ── More ▾ dropdown ── */
.nav-dropdown { position: relative; }
.nav-dropdown > a { cursor: pointer; display: flex; align-items: center; gap: .25rem; }
.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: #0e3251;
  border-radius: 8px;
  min-width: 190px;
  padding: .4rem 0;
  z-index: 200;
  box-shadow: 0 6px 20px rgba(0,0,0,.3);
  list-style: none;
}
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown.open .nav-dropdown-menu { display: block; }
.nav-dropdown-menu li a {
  display: block;
  padding: .5rem 1.1rem;
  color: rgba(255,255,255,.85);
  text-decoration: none;
  font-size: .88rem;
  white-space: nowrap;
}
.nav-dropdown-menu li a:hover { color: #fff; background: rgba(255,255,255,.08); }

/* ── Layout ── */
.container { max-width: 900px; margin: 0 auto; padding: 1rem; }
.page-header { padding: 2rem 0 1.5rem; }
.page-header h1 { font-size: 1.8rem; font-weight: 700; margin: 0 0 0.5rem; color: var(--primary); }
.page-header p { color: var(--text-muted); margin: 0; font-size: 1rem; }

/* ── Calculator Card ── */
.calc-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.calc-card h2 { font-size: 1.1rem; font-weight: 600; margin: 0 0 1.25rem; color: var(--primary); border-bottom: 2px solid var(--primary-light); padding-bottom: 0.5rem; }

/* ── Form Controls ── */
.form-group { margin-bottom: 1rem; }
label { display: block; font-size: 0.875rem; font-weight: 600; margin-bottom: 0.35rem; color: var(--text); }
input[type=number], input[type=text], select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  color: var(--text);
  background: #fff;
  transition: border-color 0.15s;
  -webkit-appearance: none;
}
input:focus, select:focus { outline: none; border-color: var(--primary-light); }
.input-hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.2rem; }

.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.65rem 1.4rem; border-radius: 8px; border: none; cursor: pointer; font-size: 1rem; font-weight: 600; transition: all 0.15s; text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-light); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-dark); }
.btn-outline { background: transparent; color: var(--primary); border: 2px solid var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-sm { padding: 0.4rem 0.9rem; font-size: 0.875rem; }
.btn-block { width: 100%; justify-content: center; }

/* ── Result Box ── */
.result-box {
  background: var(--result-bg);
  border: 1.5px solid var(--primary-light);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-top: 1.25rem;
  display: none;
}
.result-box.show { display: block; }
.result-title { font-size: 0.85rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.5rem; }
.result-main { font-size: 2rem; font-weight: 700; color: var(--primary); }
.result-main .currency { font-size: 1.1rem; color: var(--text-muted); font-weight: 400; }

.breakdown-table { width: 100%; border-collapse: collapse; margin-top: 1rem; font-size: 0.9rem; }
.breakdown-table td { padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--border); }
.breakdown-table td:last-child { text-align: right; font-weight: 600; }
.breakdown-table tr.total td { font-weight: 700; color: var(--primary); border-top: 2px solid var(--primary); border-bottom: none; }
.breakdown-table tr.deduction td { color: var(--danger); }
.breakdown-table tr.highlight td { background: rgba(39,174,96,0.07); }

/* ── Share bar ── */
.share-bar { display: flex; gap: 0.5rem; margin-top: 1rem; flex-wrap: wrap; }
.btn-whatsapp { background: #25d366; color: #fff; }
.btn-whatsapp:hover { background: #1aad52; }
.btn-copy { background: #7f8c8d; color: #fff; }
.btn-copy:hover { background: #636e72; }

/* ── Hero grid (home) ── */
.tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; }
.tool-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1rem;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.15s, box-shadow 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}
.tool-card:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(0,0,0,0.12); }
.tool-card .icon { font-size: 2rem; }
.tool-card .name { font-weight: 600; font-size: 0.9rem; color: var(--primary); }
.tool-card .desc { font-size: 0.78rem; color: var(--text-muted); }
.tool-card.featured { border: 2px solid var(--accent); }

/* ── SEO content ── */
.seo-section { background: var(--card-bg); border-radius: var(--radius); padding: 1.5rem; margin-top: 1.5rem; box-shadow: var(--shadow); }
.seo-section h2 { font-size: 1.2rem; color: var(--primary); margin-top: 0; }
.faq details { border-bottom: 1px solid var(--border); }
.faq summary { padding: 0.75rem 0; cursor: pointer; font-weight: 600; font-size: 0.95rem; }
.faq details p { color: var(--text-muted); margin: 0 0 0.75rem; font-size: 0.9rem; }

/* ── Tabs ── */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 1.25rem; overflow-x: auto; }
.tab { padding: 0.6rem 1.2rem; cursor: pointer; border-bottom: 2.5px solid transparent; margin-bottom: -2px; font-size: 0.9rem; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Autocomplete ── */
.autocomplete-wrap { position: relative; }
.autocomplete-list { position: absolute; top: 100%; left: 0; right: 0; background: #fff; border: 1.5px solid var(--border); border-top: none; border-radius: 0 0 8px 8px; max-height: 220px; overflow-y: auto; z-index: 50; display: none; box-shadow: var(--shadow); }
.autocomplete-list.show { display: block; }
.autocomplete-item { padding: 0.55rem 0.75rem; cursor: pointer; font-size: 0.9rem; }
.autocomplete-item:hover, .autocomplete-item.selected { background: var(--result-bg); }

/* ── Progress bar ── */
.progress-wrap { background: var(--border); border-radius: 99px; height: 8px; margin-top: 0.5rem; }
.progress-bar { height: 8px; border-radius: 99px; background: linear-gradient(90deg, var(--primary-light), var(--accent)); transition: width 0.4s; }

/* ── Toast ── */
.toast { position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%); background: #222; color: #fff; padding: 0.65rem 1.4rem; border-radius: 99px; font-size: 0.9rem; z-index: 999; display: none; animation: fadeup 0.2s; }
@keyframes fadeup { from { opacity:0; transform: translateX(-50%) translateY(8px); } to { opacity:1; transform: translateX(-50%) translateY(0); } }

/* ── Footer ── */
footer { background: var(--primary); color: rgba(255,255,255,0.75); padding: 2rem 1rem; margin-top: 3rem; font-size: 0.85rem; }
footer a { color: rgba(255,255,255,0.85); }
.footer-inner { max-width: 900px; margin: 0 auto; display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1.5rem; }
.footer-col h4 { color: #fff; margin: 0 0 0.75rem; font-size: 0.9rem; }
.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col li { margin-bottom: 0.4rem; }
.footer-bottom { max-width: 900px; margin: 1.5rem auto 0; padding-top: 1rem; border-top: 1px solid rgba(255,255,255,0.2); display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.5rem; }

/* ── Responsive ── */
@media (max-width: 600px) {
  .row-2, .row-3 { grid-template-columns: 1fr; }
  .tools-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .nav-links { display: none; }
  .hamburger { display: block; }
  .nav-links.open { display: flex; flex-direction: column; position: absolute; top: 100%; left: 0; right: 0; background: var(--primary); padding: 1rem; gap: 0.75rem; }
  /* Dropdown items appear flat in mobile hamburger menu */
  .nav-dropdown-menu { position: static; display: block !important; box-shadow: none; border-radius: 0; background: rgba(0,0,0,.2); padding: .25rem 0; min-width: 0; margin-top: .25rem; }
  .nav-dropdown-menu li a { padding: .4rem 1.5rem; font-size: .9rem; }
  .result-main { font-size: 1.6rem; }
  .page-header h1 { font-size: 1.4rem; }
}

/* ── PWA install banner ── */
#install-banner { display: none; position: fixed; bottom: 0; left: 0; right: 0; background: var(--primary); color: #fff; padding: 0.75rem 1rem; display: none; align-items: center; justify-content: space-between; z-index: 200; gap: 1rem; }
#install-banner.show { display: flex; }
