/* ===================================================
   SmartPayCalc.com - Design System
   Theme Option 1: Emerald Wealth & Trust Palette
   =================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@500;600;700;800&display=swap');

:root {
  /* Dark Theme Palette - Emerald Wealth (Default) */
  --bg-color: #0b1329;
  --bg-gradient: radial-gradient(circle at 15% 15%, rgba(16, 185, 129, 0.15), transparent 45%),
                 radial-gradient(circle at 85% 75%, rgba(245, 158, 11, 0.1), transparent 45%),
                 #0b1329;
  --surface-card: rgba(15, 23, 42, 0.8);
  --surface-card-hover: rgba(30, 41, 59, 0.9);
  --surface-input: rgba(30, 41, 59, 0.7);
  --border-color: rgba(255, 255, 255, 0.1);
  --border-highlight: rgba(16, 185, 129, 0.45);
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-primary: #10b981;
  --accent-secondary: #f59e0b;
  --accent-gradient: linear-gradient(135deg, #059669 0%, #10b981 50%, #34d399 100%);
  --accent-glow: 0 0 25px rgba(16, 185, 129, 0.35);

  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 9999px;

  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.3);
  --backdrop-blur: blur(16px);

  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --bg-color: #e2e8f0;
  --bg-gradient: radial-gradient(circle at 15% 15%, rgba(16, 185, 129, 0.12), transparent 50%),
                 radial-gradient(circle at 85% 75%, rgba(245, 158, 11, 0.1), transparent 50%),
                 #e2e8f0;
  --surface-card: rgba(255, 255, 255, 0.96);
  --surface-card-hover: #ffffff;
  --surface-input: #cbd5e1;
  --border-color: rgba(15, 23, 42, 0.14);
  --border-highlight: rgba(16, 185, 129, 0.6);

  --text-primary: #0f172a;
  --text-secondary: #1e293b;
  --text-muted: #475569;

  --shadow-sm: 0 4px 6px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 15px 30px rgba(15, 23, 42, 0.12);
}

/* Base Rules */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  background: var(--bg-gradient);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  transition: background var(--transition-normal), color var(--transition-normal);
}

/* Typography & Links */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.25;
  color: var(--text-primary);
}

a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  text-decoration: underline;
}

/* Layout Elements */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Navbar */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface-card);
  backdrop-filter: var(--backdrop-blur);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 0;
}

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

.logo-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-primary);
}

.logo-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.2rem;
  box-shadow: var(--accent-glow);
}

.brand-logo-img {
  height: 44px;
  width: 44px;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: var(--accent-glow);
  border: 1px solid var(--border-highlight);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  list-style: none;
}

.nav-links a {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.95rem;
}

.nav-links a:hover {
  color: var(--text-primary);
  text-decoration: none;
}

/* Hamburger Nav Toggle (Mobile Only) */
.nav-toggle {
  display: none;
  background: var(--surface-input);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-pill);
  font-size: 1.2rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

/* Mobile Nav Drawer */
.mobile-nav {
  display: none;
  background: var(--surface-card);
  border-top: 1px solid var(--border-color);
  padding: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
}

.mobile-nav.open {
  max-height: 300px;
  padding: 0.75rem 1.5rem;
}

.mobile-nav ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.mobile-nav a {
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 1rem;
}

@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-toggle { display: flex; }
  .mobile-nav { display: block; }
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.theme-toggle-btn {
  background: var(--surface-input);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  transition: all var(--transition-fast);
}

.theme-toggle-btn:hover {
  border-color: var(--border-highlight);
  transform: translateY(-2px);
}

/* Hero Section */
.hero-section {
  padding: 4rem 0 2rem;
  text-align: center;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1rem;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-pill);
  color: #6ee7b7;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
}

[data-theme="light"] .hero-badge {
  color: #047857;
}

.hero-title {
  font-size: 2.75rem;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

.gradient-text {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 1.15rem;
  color: var(--text-secondary);
  max-width: 720px;
  margin: 0 auto;
}

/* Mode Switcher Tabs */
.mode-tab-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  background: var(--surface-input);
  padding: 0.35rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
  border: 1px solid var(--border-color);
}

.mode-tab-btn {
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.mode-tab-btn.active {
  background: var(--accent-gradient);
  color: #fff;
  box-shadow: var(--accent-glow);
}

/* Calculator Grid */
.calculator-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin: 2.5rem 0 4rem;
}

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

.glass-card {
  background: var(--surface-card);
  backdrop-filter: var(--backdrop-blur);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-lg);
  transition: border-color var(--transition-normal);
}

.glass-card:hover {
  border-color: var(--border-highlight);
}

.card-title {
  font-size: 1.35rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.card-title-icon {
  color: var(--accent-primary);
}

/* Form Controls */
.form-group {
  margin-bottom: 1.75rem;
}

.form-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.form-label {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.value-badge {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--accent-primary);
  background: rgba(16, 185, 129, 0.12);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.input-with-symbol {
  position: relative;
  display: flex;
  align-items: center;
}

.currency-symbol, .percent-symbol {
  position: absolute;
  left: 1rem;
  color: var(--text-muted);
  font-weight: 600;
  pointer-events: none;
}

.percent-symbol {
  left: auto;
  right: 1rem;
}

.custom-input {
  width: 100%;
  padding: 0.85rem 1rem;
  padding-left: 2.2rem;
  background: var(--surface-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  outline: none;
  transition: all var(--transition-fast);
}

.custom-input.no-symbol-left {
  padding-left: 1rem;
  padding-right: 2.2rem;
}

.custom-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25);
}

/* Range Slider Styling with Dynamic Fill */
.range-slider {
  width: 100%;
  height: 6px;
  background: linear-gradient(
    to right,
    var(--accent-primary) 0%,
    var(--accent-primary) var(--fill, 25%),
    var(--surface-input) var(--fill, 25%),
    var(--surface-input) 100%
  );
  border-radius: var(--radius-pill);
  outline: none;
  margin-top: 0.75rem;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-gradient);
  box-shadow: var(--accent-glow);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.range-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.term-btn-group {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.term-btn {
  background: var(--surface-input);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.6rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.term-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-highlight);
}

.term-btn.active {
  background: var(--accent-gradient);
  color: #fff;
  border-color: transparent;
  box-shadow: var(--accent-glow);
}

/* Results Display Card */
.results-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.main-payment-box {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-md);
  padding: 1.75rem;
  text-align: center;
  margin-bottom: 2rem;
  position: relative;
  overflow: hidden;
}

.main-payment-box::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--accent-gradient);
}

.payment-label {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  font-weight: 600;
}

.payment-amount {
  font-family: var(--font-heading);
  font-size: 2.85rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0.25rem 0;
}

.payment-subtext {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Summary Grid */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.summary-item {
  background: var(--surface-input);
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.summary-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.summary-val {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 0.2rem;
}

/* Visual Progress Chart Bar */
.visual-chart-wrapper {
  margin-bottom: 2rem;
}

.chart-title {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  display: flex;
  justify-content: space-between;
}

.chart-bar-container {
  height: 16px;
  width: 100%;
  background: var(--surface-input);
  border-radius: var(--radius-pill);
  overflow: hidden;
  display: flex;
}

.bar-principal {
  height: 100%;
  background: var(--accent-primary);
  transition: width 0.4s ease;
}

.bar-interest {
  height: 100%;
  background: var(--accent-secondary);
  transition: width 0.4s ease;
}

.chart-legend {
  display: flex;
  gap: 1.5rem;
  margin-top: 0.6rem;
  font-size: 0.85rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-secondary);
}

.dot-principal {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-primary);
}

.dot-interest {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-secondary);
}

/* Actions Row - 3 buttons */
.action-buttons {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.btn-primary, .btn-secondary {
  flex: 1;
  min-width: 80px;
  padding: 0.85rem 0.75rem;
  border-radius: var(--radius-md);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: all var(--transition-fast);
  border: none;
}

.btn-primary {
  background: var(--accent-gradient);
  color: #fff;
  box-shadow: var(--accent-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 30px rgba(16, 185, 129, 0.5);
}

.btn-secondary {
  background: var(--surface-input);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  border-color: var(--border-highlight);
  transform: translateY(-2px);
}

/* Interest Savings Tip Card */
.savings-tip {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-md);
  padding: 0.875rem 1rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
  line-height: 1.5;
}

.savings-tip strong {
  color: var(--accent-primary);
}

/* Amortization Table Section */
.section-title {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
}

.section-desc {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.amortization-container {
  margin: 3rem 0;
}

.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  background: var(--surface-card);
  max-height: 440px;
}

.schedule-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.schedule-table th {
  background: rgba(30, 41, 59, 0.95);
  color: var(--text-primary);
  padding: 1rem;
  font-family: var(--font-heading);
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--border-color);
}

[data-theme="light"] .schedule-table th {
  background: rgba(241, 245, 249, 0.95);
}

.schedule-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.schedule-table tbody tr:hover {
  background: rgba(16, 185, 129, 0.06);
}

/* Content Section */
.content-section {
  padding: 4rem 0;
  border-top: 1px solid var(--border-color);
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-top: 2rem;
}

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

.feature-card {
  background: var(--surface-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.75rem;
}

.feature-icon {
  font-size: 2rem;
  color: var(--accent-primary);
  margin-bottom: 1rem;
}

.feature-title {
  font-size: 1.15rem;
  margin-bottom: 0.5rem;
}

.feature-desc {
  color: var(--text-secondary);
  font-size: 0.925rem;
}

/* FAQ Accordion */
.faq-section {
  padding: 4rem 0;
  border-top: 1px solid var(--border-color);
}

.faq-list {
  max-width: 800px;
  margin: 2rem auto 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.faq-item {
  background: var(--surface-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color var(--transition-fast);
}

.faq-item:hover {
  border-color: var(--border-highlight);
}

.faq-question {
  width: 100%;
  padding: 1.25rem 1.5rem;
  background: none;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 600;
  text-align: left;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}

.faq-icon {
  font-size: 1.2rem;
  transition: transform var(--transition-fast);
}

.faq-item.active .faq-icon {
  transform: rotate(180deg);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
  padding: 0 1.5rem;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.faq-item.active .faq-answer {
  max-height: 300px;
  padding: 0 1.5rem 1.25rem 1.5rem;
}

/* Footer */
.site-footer {
  margin-top: auto;
  background: var(--surface-card);
  border-top: 1px solid var(--border-color);
  padding: 3rem 0 1.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

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

@media (max-width: 768px) {
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}

.footer-brand-desc {
  margin-top: 0.75rem;
  color: var(--text-secondary);
  max-width: 360px;
}

.footer-heading {
  font-family: var(--font-heading);
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.footer-links a {
  color: var(--text-secondary);
}

.footer-bottom {
  text-align: center;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.85rem;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--border-highlight);
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(10px);
  animation: slideIn 0.3s ease, fadeOut 0.3s 2.7s ease forwards;
}

@keyframes slideIn {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* ── Google AdSense Responsive Ad Containers ──────────────────── */
.ad-slot-wrapper {
  width: 100%;
  margin: 2.5rem 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

.ad-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
  font-weight: 600;
}

.ad-card-placeholder {
  width: 100%;
  max-width: 970px;
  min-height: 90px;
  background: var(--surface-card);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition-speed);
}

.ad-card-placeholder:hover {
  border-color: var(--border-highlight);
}

/* ── Modal Dialog ────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-content {
  max-width: 650px;
  width: 100%;
  position: relative;
  border: 1px solid var(--border-highlight);
  background: var(--surface-card);
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.75rem;
  cursor: pointer;
  line-height: 1;
  transition: color var(--transition-speed);
}

.modal-close:hover {
  color: var(--text-primary);
}


