/* ============ Fynx — Global Styles with 3 Themes ============ */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { overflow-x: clip; }

/* ============ THEME 1: DEFAULT (Purple-Pink) ============ */
:root, [data-theme="default"] {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --secondary: #10b981;
  --accent: #f59e0b;
  --bg: #f8fafc;
  --bg-card: #ffffff;
  --bg-nav: #ffffff;
  --bg-input: #ffffff;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.06), 0 2px 4px -1px rgba(0,0,0,0.03);
  --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.08), 0 10px 10px -5px rgba(0,0,0,0.02);
  --gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
  --result-bg: linear-gradient(135deg, #f0fdf4 0%, #ecfeff 100%);
  --info-bg: #fef3c7;
  --footer-bg: #0f172a;
  --footer-text: #cbd5e1;
}

/* ============ THEME 2: DARK MODE ============ */
[data-theme="dark"] {
  --primary: #818cf8;
  --primary-dark: #6366f1;
  --secondary: #34d399;
  --accent: #fbbf24;
  --bg: #0f172a;
  --bg-card: #1e293b;
  --bg-nav: #1e293b;
  --bg-input: #0f172a;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --border: #334155;
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.4), 0 2px 4px -1px rgba(0,0,0,0.2);
  --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.5), 0 10px 10px -5px rgba(0,0,0,0.3);
  --gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #db2777 100%);
  --result-bg: linear-gradient(135deg, #064e3b 0%, #0c4a6e 100%);
  --info-bg: #422006;
  --footer-bg: #020617;
  --footer-text: #94a3b8;
}

/* ============ THEME 3: SAFFRON INDIA 🇮🇳 ============ */
[data-theme="saffron"] {
  --primary: #ea580c;
  --primary-dark: #c2410c;
  --secondary: #15803d;
  --accent: #facc15;
  --bg: #fffbeb;
  --bg-card: #ffffff;
  --bg-nav: #ffffff;
  --bg-input: #ffffff;
  --text: #1c1917;
  --text-muted: #78716c;
  --border: #fed7aa;
  --shadow: 0 4px 6px -1px rgba(234,88,12,0.1), 0 2px 4px -1px rgba(0,0,0,0.03);
  --shadow-lg: 0 20px 25px -5px rgba(234,88,12,0.15), 0 10px 10px -5px rgba(0,0,0,0.02);
  --gradient: linear-gradient(135deg, #ea580c 0%, #ffffff 50%, #15803d 100%);
  --result-bg: linear-gradient(135deg, #f0fdf4 0%, #fef3c7 100%);
  --info-bg: #fef3c7;
  --footer-bg: #1c1917;
  --footer-text: #fed7aa;
}

html, body {
  overflow-x: hidden;
  max-width: 100vw;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  transition: background 0.3s, color 0.3s;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* ============ ADVANCED NAVBAR ============ */
.navbar {
  background: var(--bg-nav);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
  transition: background 0.3s;
}
.nav-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.logo {
  font-size: 1.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  flex-shrink: 0;
  cursor: pointer;
  white-space: nowrap;
}
/* Dark theme — use BRIGHT gradient so logo stays visible */
[data-theme="dark"] .logo {
  background: linear-gradient(135deg, #a5b4fc 0%, #d8b4fe 50%, #f9a8d4 100%);
  -webkit-background-clip: text;
  background-clip: text;
}
/* Saffron theme — drop the white middle so it's readable on white navbar */
[data-theme="saffron"] .logo {
  background: linear-gradient(135deg, #ea580c 0%, #c2410c 50%, #15803d 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

/* ============ MODERN SEARCH (Command-Palette Style) ============ */
/* Compact button in navbar that opens a beautiful modal */
.search-wrapper {
  flex-shrink: 0;
  position: relative;
}
.search-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.9rem 0.55rem 0.85rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text-muted);
  font-size: 0.92rem;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
  min-width: 200px;
}
.search-trigger:hover {
  border-color: var(--primary);
  color: var(--text);
  background: var(--bg-card);
}
.search-trigger .st-icon { font-size: 1rem; }
.search-trigger .st-text { flex: 1; text-align: left; }
.search-trigger .st-kbd {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 2px 7px;
  font-size: 0.75rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--text-muted);
  font-weight: 600;
}

/* Modal Overlay */
.search-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
  animation: fadeIn 0.18s ease-out;
}
.search-modal.active { display: flex; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideDown { from { transform: translateY(-10px); opacity: 0.7; } to { transform: translateY(0); opacity: 1; } }

.search-modal-box {
  background: var(--bg-card);
  width: 92%;
  max-width: 640px;
  border-radius: 16px;
  box-shadow: 0 25px 60px rgba(0,0,0,0.35), 0 0 0 1px var(--border);
  overflow: hidden;
  animation: slideDown 0.22s ease-out;
}
.search-modal-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.search-modal-header .smh-icon { font-size: 1.25rem; color: var(--text-muted); }
.search-modal-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 1.1rem;
  color: var(--text);
  font-family: inherit;
}
.search-modal-input::placeholder { color: var(--text-muted); }
.search-modal-close {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.75rem;
  color: var(--text-muted);
  cursor: pointer;
  font-family: ui-monospace, monospace;
  font-weight: 600;
}
.search-modal-close:hover { background: var(--border); }

.search-modal-results {
  max-height: 60vh;
  overflow-y: auto;
  padding: 0.5rem;
}
.search-modal-footer {
  padding: 0.65rem 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 1rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg);
}
.search-modal-footer span { display: inline-flex; align-items: center; gap: 0.35rem; }
.search-modal-footer kbd {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  font-family: ui-monospace, monospace;
  font-size: 0.7rem;
}

/* Result items inside modal */
.search-result-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  border-radius: 8px;
  margin-bottom: 2px;
  transition: background 0.15s;
}
.search-result-item:hover,
.search-result-item.highlighted {
  background: var(--bg);
}
.search-result-icon { font-size: 1.5rem; flex-shrink: 0; }
.search-result-content { flex: 1; min-width: 0; }
.search-result-title { font-weight: 600; font-size: 0.95rem; color: var(--text); }
.search-result-cat { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }
.search-result-arrow { color: var(--text-muted); flex-shrink: 0; }
.search-no-results {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.95rem;
}
.search-no-results small { display: block; margin-top: 0.5rem; opacity: 0.7; }

/* Empty state when no query typed */
.search-modal-results:empty::before {
  content: "💡 Try: emi, sip, bmi, gst, age, tax, currency";
  display: block;
  padding: 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.92rem;
}

/* NAV LINKS WITH DROPDOWN */
.nav-links {
  display: flex;
  gap: 0.5rem;
  list-style: none;
  align-items: center;
  flex-shrink: 0;
}
.nav-links > li { position: relative; }
.nav-links > li > a {
  color: var(--text);
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.5rem 0.85rem;
  border-radius: 8px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
}
.nav-links > li > a:hover {
  color: var(--primary);
  background: var(--bg);
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  min-width: 280px;
  padding: 0.5rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s;
  z-index: 200;
}
.nav-links > li:hover .dropdown-menu,
.nav-links > li.open .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.dropdown-menu a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 0.85rem;
  color: var(--text);
  border-radius: 8px;
  font-size: 0.92rem;
  transition: all 0.15s;
}
.dropdown-menu a:hover {
  background: var(--bg);
  color: var(--primary);
}
.dropdown-icon { font-size: 1.1rem; }

/* THEME SWITCHER */
.theme-switcher {
  position: relative;
}
.theme-btn {
  background: var(--bg);
  border: 2px solid var(--border);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.theme-btn:hover {
  border-color: var(--primary);
  transform: rotate(20deg);
}
.theme-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  min-width: 180px;
  padding: 0.5rem;
  display: none;
  z-index: 200;
}
.theme-dropdown.active { display: block; }
.theme-option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 0.85rem;
  cursor: pointer;
  border-radius: 8px;
  color: var(--text);
  font-size: 0.92rem;
  transition: background 0.15s;
}
.theme-option:hover { background: var(--bg); }
.theme-option.active { background: var(--bg); font-weight: 600; }
.theme-color {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border);
}
.tc-default { background: linear-gradient(135deg, #6366f1, #ec4899); }
.tc-dark { background: #1e293b; border-color: #475569; }
.tc-saffron { background: linear-gradient(135deg, #ea580c, #15803d); }

.menu-toggle { display: none; background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--text); }

/* ============ HERO ============ */
.hero {
  background: var(--gradient);
  color: white;
  padding: 4rem 1.5rem;
  text-align: center;
}
[data-theme="saffron"] .hero {
  background: linear-gradient(135deg, #ea580c 0%, #f97316 50%, #15803d 100%);
  color: #ffffff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
[data-theme="saffron"] .hero p { color: #ffffff; opacity: 0.97; }
.hero h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  margin-bottom: 1rem;
  line-height: 1.2;
}
.hero p {
  font-size: 1.15rem;
  opacity: 0.95;
  max-width: 700px;
  margin: 0 auto 2rem;
}
.hero-stats {
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
  margin-top: 2rem;
}
.stat {
  background: rgba(255,255,255,0.15);
  padding: 1rem 1.5rem;
  border-radius: 12px;
  backdrop-filter: blur(10px);
}
[data-theme="saffron"] .stat { background: rgba(0,0,0,0.18); color: #ffffff; }
.stat-num { font-size: 1.75rem; font-weight: 800; display: block; }
.stat-label { font-size: 0.9rem; opacity: 0.9; }

/* ============ MAIN CONTENT ============ */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}
.section-title {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  text-align: center;
}
.section-subtitle {
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 2.5rem;
}

/* ============ CALCULATOR GRID ============ */
.calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.5rem;
}
.calc-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.75rem;
  transition: all 0.3s;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  color: var(--text);
}
.calc-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--gradient);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s;
}
.calc-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}
.calc-card:hover::before { transform: scaleX(1); }
.calc-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  display: block;
}
.calc-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text);
}
.calc-desc {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ============ CALCULATOR PAGE ============ */
.calc-wrapper {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}
.breadcrumb {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}
.breadcrumb a { color: var(--primary); }
.calc-page-title {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}
.calc-page-desc {
  color: var(--text-muted);
  margin-bottom: 2rem;
}
.calc-box {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}
.form-group { margin-bottom: 1.25rem; }
.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
  color: var(--text);
}
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  transition: border 0.2s;
  font-family: inherit;
  background: var(--bg-input);
  color: var(--text);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
}
.input-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.btn {
  background: var(--gradient);
  color: white;
  border: none;
  padding: 0.9rem 2rem;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  width: 100%;
  margin-top: 0.5rem;
}
[data-theme="saffron"] .btn { color: #1c1917; font-weight: 700; }
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

/* ============ RESULTS ============ */
.result-box {
  margin-top: 2rem;
  padding: 1.75rem;
  background: var(--result-bg);
  border: 2px solid var(--secondary);
  border-radius: 14px;
}
.result-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text);
}
.result-row {
  display: flex;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 1px dashed var(--border);
}
.result-row:last-child { border-bottom: none; }
.result-label { color: var(--text-muted); font-weight: 500; }
.result-value { font-weight: 700; color: var(--text); font-size: 1.1rem; }
.result-value.highlight { color: var(--secondary); font-size: 1.4rem; }

/* ============ INFO BOX ============ */
.info-box {
  margin-top: 2rem;
  padding: 1.5rem;
  background: var(--info-bg);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  color: var(--text);
}
.info-box h3 { font-size: 1.1rem; margin-bottom: 0.5rem; color: var(--text); }
.info-box p { color: var(--text); font-size: 0.95rem; }

/* ============ AD SPACE ============ */
.ad-space {
  margin: 2rem auto;
  max-width: 1200px;
  padding: 1rem 1.5rem;
}
.ad-placeholder {
  background: var(--bg-card);
  border: 2px dashed var(--border);
  padding: 2rem;
  text-align: center;
  border-radius: 12px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ============ FOOTER ============ */
.footer {
  background: var(--footer-bg);
  color: var(--footer-text);
  padding: 3rem 1.5rem 1.5rem;
  margin-top: 4rem;
}
.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}
.footer-col h4 {
  color: white;
  margin-bottom: 1rem;
  font-size: 1.05rem;
}
.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 0.5rem; }
.footer-col a { color: var(--footer-text); font-size: 0.95rem; }
.footer-col a:hover { color: white; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 1.5rem;
  text-align: center;
  font-size: 0.9rem;
  opacity: 0.8;
}

/* ============ STATIC PAGES ============ */
.content-page {
  max-width: 800px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}
.content-page h1 {
  font-size: 2.25rem;
  margin-bottom: 1.5rem;
  font-weight: 800;
}
.content-page h2 {
  font-size: 1.5rem;
  margin: 2rem 0 1rem;
  font-weight: 700;
}
.content-page p { margin-bottom: 1rem; color: var(--text); }
.content-page ul { margin: 1rem 0 1rem 1.5rem; }
.content-page li { margin-bottom: 0.5rem; }

/* ============ RESPONSIVE ============ */
@media (max-width: 1100px) {
  .search-trigger { min-width: auto; padding: 0.55rem 0.7rem; }
  .search-trigger .st-text { display: none; }
  .search-trigger .st-kbd { display: none; }
}
@media (max-width: 900px) {
  .nav-links > li > a { padding: 0.5rem 0.6rem; font-size: 0.9rem; }
}
@media (max-width: 768px) {
  .menu-toggle { display: block; order: 1; margin-left: auto; }
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-nav);
    flex-direction: column;
    align-items: stretch;
    padding: 1rem;
    box-shadow: var(--shadow-lg);
    gap: 0.25rem;
    order: 4;
    flex-basis: 100%;
    max-height: calc(100vh - 70px);
    overflow-y: auto;
  }
  .nav-links.active { display: flex; }
  .nav-links > li > a { padding: 0.75rem 1rem; }
  .dropdown-menu {
    position: static;
    box-shadow: none;
    border: none;
    opacity: 1;
    visibility: visible;
    transform: none;
    padding: 0 0 0 1rem;
    min-width: auto;
    display: none;
    background: transparent;
    max-height: none !important;
  }
  .nav-links > li.open .dropdown-menu { display: block; }

  /* THEME SWITCHER on mobile — make it a full-width row like other nav items */
  .theme-switcher {
    width: 100%;
    border-top: 1px solid var(--border);
    margin-top: 0.5rem;
    padding-top: 0.75rem;
  }
  .theme-btn {
    width: 100%;
    height: auto;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    justify-content: flex-start;
    gap: 0.6rem;
    font-size: 0.95rem;
    font-weight: 500;
    background: transparent;
    border: none;
    color: var(--text);
  }
  .theme-btn::after {
    content: " Theme ▾";
    font-weight: 500;
  }
  .theme-btn:hover { transform: none; }
  .theme-dropdown {
    position: static;
    box-shadow: none;
    border: none;
    margin-top: 0.25rem;
    padding: 0 0 0 1rem;
    background: transparent;
    min-width: auto;
    width: 100%;
  }

  .input-group { grid-template-columns: 1fr; }
  .hero { padding: 3rem 1rem; }
  .container { padding: 2rem 1rem; }
  .calc-box { padding: 1.5rem; }
}
