/* ================================================================
   BetaCalculators.com – Unified Design System CSS
   Covers: layout, calculator card forms, results, sidebar,
   amortization tables, SEO faq sections & all existing pages.
================================================================ */

/* ---------------------------------------------------------------
   CSS Custom Properties (Design Tokens)
--------------------------------------------------------------- */
:root {
  --primary: #6c63ff;
  --primary-hover: #5a52e0;
  --primary-light: rgba(108, 99, 255, 0.12);
  --primary-gradient: linear-gradient(135deg, #6c63ff 0%, #38bdf8 100%);
  --accent-cyan: #38bdf8;
  --accent-pink: #f472b6;
  --success: #22d3a5;
  --warning: #f59e0b;
  --danger: #ef4444;

  /* Background layers */
  --bg-main: #f4f4fb;
  --bg-card: #ffffff;
  --bg-header: rgba(244, 244, 251, 0.88);
  --bg-card2: #f0f0fc;

  /* Borders */
  --border-color: rgba(108, 99, 255, 0.12);
  --border-glow: rgba(108, 99, 255, 0.3);

  /* Text */
  --text-primary: #1a1a2e;
  --text-secondary: #4a4a6a;
  --text-muted: #9090b0;

  /* Shadows */
  --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 32px rgba(108, 99, 255, 0.1);
  --shadow-glow: 0 0 24px rgba(108, 99, 255, 0.18);

  /* Radii */
  --radius-xl: 20px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

[data-theme="dark"] {
  --bg-main: #0a0a14;
  --bg-card: #13131f;
  --bg-card2: #1a1a2e;
  --bg-header: rgba(10, 10, 20, 0.88);

  --border-color: rgba(255, 255, 255, 0.07);
  --border-glow: rgba(108, 99, 255, 0.35);

  --text-primary: #f0f0ff;
  --text-secondary: #a0a0c0;
  --text-muted: #5a5a7a;

  --bg-main: #0a0a14;
  --primary-light: rgba(108, 99, 255, 0.15);

  --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 30px rgba(108, 99, 255, 0.22);
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--primary-hover);
}

/* ---------------------------------------------------------------
   Calculator Page Layout Container
--------------------------------------------------------------- */
.calc-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 1.5rem;
  padding: 1rem;
}

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

/* ---------------------------------------------------------------
   Page Hero (used on individual calculator pages)
--------------------------------------------------------------- */
.page-hero {
  padding: 1.25rem 0 1rem;
  margin-bottom: 1rem;
  position: relative;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.25);
  padding: 4px 10px;
  border-radius: 20px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

.hero-title {
  font-size: 1.7rem;
  font-weight: 900;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  line-height: 1.2;
  margin-bottom: 0.5rem;
}

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

.hero-subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.55;
  max-width: 680px;
}

/* Hero search */
.hero-search-wrapper {
  position: relative;
  margin-top: 1rem;
  margin-bottom: 0.85rem;
}

.hero-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

.hero-search-input {
  width: 100%;
  padding: 0.85rem 1rem 0.85rem 42px;
  background: var(--bg-card);
  border: 1.5px solid var(--border-color);
  border-radius: 14px;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: all 0.2s;
}

.hero-search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.15);
}

.hero-search-input::placeholder {
  color: var(--text-muted);
}

/* Quick Pills */
.hero-pills {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 0.75rem;
}

.hero-pill-lbl {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

.hero-pill-btn {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Inter', sans-serif;
}

.hero-pill-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Category Filter */
.category-filter-bar {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.25rem 0 0.5rem;
  margin-bottom: 1rem;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.category-filter-bar::-webkit-scrollbar {
  display: none;
}

.cat-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 1rem;
  border-radius: 25px;
  border: 1.5px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Inter', sans-serif;
}

.cat-tab-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.cat-tab-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(108, 99, 255, 0.3);
}

/* Section Header */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.9rem;
}

.section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

/* ---------------------------------------------------------------
   Tools Grid & Tool Cards
--------------------------------------------------------------- */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .tools-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1024px) {
  .tools-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  text-decoration: none !important;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.tool-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--primary-gradient);
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
}

.tool-card:hover::before,
.tool-card:active::before {
  opacity: 0.06;
}

.tool-card:hover {
  border-color: rgba(108, 99, 255, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(108, 99, 255, 0.12);
}

.tool-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tool-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--primary-light);
  border: 1px solid rgba(108, 99, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  flex-shrink: 0;
}

.tool-card-icon svg {
  width: 20px;
  height: 20px;
}

.tool-card-badge {
  font-size: 0.58rem;
  font-weight: 700;
  color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.2);
  padding: 2px 6px;
  border-radius: 20px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  line-height: 1.3;
  max-width: 70px;
  text-align: center;
}

.tool-card-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.tool-card-desc {
  font-size: 0.72rem;
  color: var(--text-secondary);
  line-height: 1.4;
  flex: 1;
}

.tool-card-footer {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--primary);
  margin-top: 0.2rem;
}

.tool-card-arrow {
  transition: transform 0.2s ease;
}

.tool-card:hover .tool-card-arrow {
  transform: translateX(3px);
}

/* ---------------------------------------------------------------
   Calculator Card (Form Area)
--------------------------------------------------------------- */
.calculator-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.25rem;
}

.calc-form-group {
  margin-bottom: 1rem;
}

.calc-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.45rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.calc-input,
.calc-select {
  width: 100%;
  padding: 0.8rem 1rem;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-color);
  background: var(--bg-card2);
  color: var(--text-primary);
  font-size: 1rem;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: all 0.2s ease;
}

.calc-input:focus,
.calc-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.12);
}

.calc-input::placeholder {
  color: var(--text-muted);
}

.calc-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.calc-btn {
  background: var(--primary-gradient);
  color: white;
  border: none;
  padding: 0.95rem 1.5rem;
  font-size: 1rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  cursor: pointer;
  width: 100%;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: 'Inter', sans-serif;
  box-shadow: 0 4px 16px rgba(108, 99, 255, 0.3);
}

.calc-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(108, 99, 255, 0.4);
}

.calc-btn:active {
  transform: scale(0.98);
}

/* ---------------------------------------------------------------
   Result Box
--------------------------------------------------------------- */
.result-box {
  background: var(--primary-light);
  border: 1.5px solid rgba(108, 99, 255, 0.3);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-top: 1.25rem;
  display: none;
  animation: fadeIn 0.3s ease-in-out forwards;
}

.result-box.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.result-header {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 0.35rem;
}

.result-main-val {
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--text-primary);
  margin-bottom: 1rem;
  letter-spacing: -0.03em;
  word-break: break-word;
  overflow-wrap: break-word;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
  padding-top: 1rem;
  border-top: 1px dashed rgba(108, 99, 255, 0.25);
}

.result-item {
  background: var(--bg-card);
  padding: 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.result-item-lbl {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
  font-weight: 600;
}

.result-item-val {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  word-break: break-word;
  overflow-wrap: break-word;
}

/* ---------------------------------------------------------------
   Tabs (inside calculators)
--------------------------------------------------------------- */
.calc-tabs {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 0.4rem;
  overflow-x: auto;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.calc-tabs::-webkit-scrollbar {
  display: none;
}

.calc-tab {
  padding: 0.55rem 1rem;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  font-family: 'Inter', sans-serif;
}

.calc-tab.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
}

/* ---------------------------------------------------------------
   Table Styles (amortization etc.)
--------------------------------------------------------------- */
.calc-table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  margin-top: 1rem;
}

.calc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.calc-table th {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
  padding: 0.65rem 0.85rem;
  text-align: left;
  white-space: nowrap;
}

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

.calc-table tr:last-child td {
  border-bottom: none;
}

.calc-table tr:hover td {
  background: var(--primary-light);
}

/* ---------------------------------------------------------------
   SEO / FAQ Content
--------------------------------------------------------------- */
.seo-content {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  margin-top: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.seo-title {
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.faq-item {
  border-bottom: 1px solid var(--border-color);
  padding: 0.85rem 0;
}

.faq-item:last-child {
  border-bottom: none;
}

.faq-question {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-primary);
  margin-bottom: 0.3rem;
}

.faq-answer {
  color: var(--text-secondary);
  font-size: 0.83rem;
  line-height: 1.6;
}

/* ---------------------------------------------------------------
   Sidebar
--------------------------------------------------------------- */
.sidebar-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1rem;
}

.sidebar-title {
  font-size: 0.95rem;
  font-weight: 800;
  margin-bottom: 0.85rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--primary);
  color: var(--text-primary);
}

.tool-list-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.5rem;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.82rem;
  transition: all 0.2s ease;
}

.tool-list-link:hover {
  background: var(--primary-light);
  color: var(--primary);
  transform: translateX(3px);
}

/* ---------------------------------------------------------------
   Stats / Badges
--------------------------------------------------------------- */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  padding: 0 1rem;
  margin-bottom: 0.75rem;
}

.stat-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 0.85rem 0.75rem;
  text-align: center;
}

.stat-val {
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--primary);
}

.stat-lbl {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 2px;
}

/* Info cards */
.info-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.1rem;
  margin-bottom: 1rem;
}

.info-card h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.6rem;
}

.info-card p,
.info-card li {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.info-card ul {
  padding-left: 1.1rem;
}

/* ---------------------------------------------------------------
   Region switcher (legacy compat)
--------------------------------------------------------------- */
.region-switcher {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  background: var(--bg-main);
  padding: 3px;
  border-radius: 30px;
  border: 1px solid var(--border-color);
}

.region-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  padding: 0.3rem 0.65rem;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  transition: all 0.2s ease;
  font-family: 'Inter', sans-serif;
}

.region-btn.active {
  background: var(--primary-gradient);
  color: white;
  box-shadow: 0 2px 8px rgba(108, 99, 255, 0.3);
}

/* theme toggle (legacy) */
.theme-toggle-btn {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 38px;
  height: 38px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.theme-toggle-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* ---------------------------------------------------------------
   Main Layout (desktop compat)
--------------------------------------------------------------- */
.main-layout {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0;
  width: 100%;
  flex: 1;
}

/* ---------------------------------------------------------------
   Footer (legacy)
--------------------------------------------------------------- */
.footer {
  display: none;
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
  padding: 2rem 1.5rem;
}

@media (min-width: 1024px) {
  .footer {
    display: block;
  }
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2rem;
}

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

.footer-links a {
  font-size: 0.82rem;
  color: var(--text-muted);
  transition: color 0.2s;
}

.footer-links a:hover {
  color: var(--primary);
}

.footer-brand-text {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-top: 0.75rem;
}

.footer-bottom {
  max-width: 1100px;
  margin: 1.25rem auto 0;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
}

/* ---------------------------------------------------------------
   Utility classes
--------------------------------------------------------------- */
.text-gradient {
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

select option {
  background: var(--bg-card2);
  color: var(--text-primary);
}

/* ---------------------------------------------------------------
   Mobile Responsiveness & Scroll Safe Area
--------------------------------------------------------------- */
@media (max-width: 1023px) {
  body {
    padding-bottom: 68px;
  }
}

@media (max-width: 640px) {
  .calc-grid {
    padding: 0.75rem 0.5rem;
    gap: 1rem;
  }
  .calculator-card {
    padding: 1.25rem 0.9rem;
    border-radius: var(--radius-lg);
  }
  .page-hero {
    padding: 0.75rem 0 0.5rem;
  }
  .hero-title {
    font-size: 1.45rem;
    word-break: break-word;
  }
  .result-main-val {
    font-size: 1.75rem;
  }
  .calc-row {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  .seo-content {
    padding: 1.25rem 0.9rem;
    border-radius: var(--radius-lg);
  }
  .smr-content-section {
    padding: 1.25rem 0.9rem !important;
  }
  .calc-table th, .calc-table td {
    padding: 0.5rem 0.6rem;
    font-size: 0.78rem;
  }
}

@media (max-width: 420px) {
  .hero-title {
    font-size: 1.3rem;
  }
  .result-grid {
    grid-template-columns: 1fr;
  }
  .result-main-val {
    font-size: 1.55rem;
  }
  .calc-btn {
    padding: 0.85rem 1rem;
    font-size: 0.925rem;
  }
}