/* ============================================
   DAILY INTEREST CALCULATOR — style.css
   Aesthetic: Clean / modern financial
   Fonts: Inter (Sans-Serif) + Tabular Nums
   ============================================ */

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

:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface2: #f0f0f5;
  --border: #d2d2d7;
  --border-hover: #86868b;
  --accent: #ff9933;       /* Indian Saffron */
  --accent2: #128807;      /* Indian Green */
  --accent-blue: #000080;  /* Ashoka Chakra Blue */
  --text: #1d1d1f;
  --text-muted: #6e6e73;
  --text-dim: #a1a1a6;
  --error: #ff3b30;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --radius: 12px;
  --radius-lg: 20px;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-variant-numeric: tabular-nums;
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px 80px;
  overflow-x: hidden;
  position: relative;
}

/* Background decorations */
.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: 0.15;
  pointer-events: none;
  z-index: 0;
}

.bg-glow {
  position: fixed;
  top: -200px;
  left: 50%;
  transform: translateX(-50%);
  width: 700px;
  height: 500px;
  background: radial-gradient(ellipse, rgba(255, 153, 51, 0.12) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* Wrapper */
.wrapper {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 680px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* ── Header ─────────────────────────────────────── */
.header {
  text-align: center;
  animation: fadeDown 0.6s ease both;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.logo-img {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  object-fit: contain;
  flex-shrink: 0;
}

.logo-text {
  font-family: var(--font);
  font-size: 26px;
  letter-spacing: -0.5px;
  color: var(--text);
}

.logo-text em {
  color: var(--accent);
  font-style: normal;
}

.hero-headline {
  font-family: var(--font);
  font-size: 42px;
  line-height: 1.1;
  color: var(--text);
  margin-bottom: 10px;
  letter-spacing: -0.02em;
}

.hero-sub {
  font-family: var(--font);
  font-variant-numeric: tabular-nums;
  font-size: 15px;
  color: var(--accent);
  letter-spacing: 0.04em;
  margin-bottom: 14px;
  opacity: 0.9;
}

.tagline {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

@media (max-width: 680px) {
  .hero-headline { font-size: 32px; }
}

/* ── Main Card ──────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
  animation: fadeUp 0.7s ease 0.1s both;
}

.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), var(--accent2), transparent);
}

.card-label {
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 20px;
}

/* ── Mode Toggle ────────────────────────────────── */
.mode-toggle {
  display: flex;
  gap: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 28px;
}

.mode-btn {
  flex: 1;
  padding: 10px 16px;
  background: transparent;
  border: none;
  border-radius: 7px;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
  letter-spacing: 0.02em;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.mode-btn.active {
  background: var(--accent);
  color: #ffffff;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(255, 153, 51, 0.3);
}

.mode-btn:not(.active):hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.5);
}

/* ── Inputs Grid ────────────────────────────────── */
.inputs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-self: flex-start;
}

.field.full-width {
  grid-column: 1 / -1;
}

.field label {
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  text-transform: uppercase;
  display: block;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
}

.input-prefix,
.input-suffix {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: var(--text-muted);
  pointer-events: none;
  z-index: 1;
}

.input-prefix { left: 14px; }
.input-suffix { right: 14px; }

.input-wrap input,
.input-wrap select {
  width: 100%;
  height: 48px;
  box-sizing: border-box;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-variant-numeric: tabular-nums;
  font-size: 15px;
  padding: 0 14px;
  margin: 0;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none;
}

/* CSS FIX 7: focus ring was rgba(200,242,80,0.1) — near-invisible lime at 10%.
   Changed to saffron accent at visible opacity, meeting WCAG 2.4.11 */
.input-wrap input:focus,
.input-wrap select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 153, 51, 0.25);
}

.input-wrap input::placeholder { color: var(--text-dim); }

.input-wrap:has(.input-suffix) input { padding-right: 40px; }
.input-wrap:has(.input-prefix) input { padding-left: 34px; }

.select-wrap { position: relative; }
.select-wrap select { padding-right: 36px; cursor: pointer; }

.select-arrow {
  position: absolute;
  top: 50%;
  right: 14px;
  transform: translateY(-50%);
  font-size: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

/* ── Days Section ───────────────────────────────── */
.days-section {
  margin-bottom: 20px;
}

.days-mode-toggle {
  display: flex;
  gap: 6px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 12px;
}

.days-mode-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 14px;
  background: transparent;
  border: none;
  border-radius: 7px;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 12px;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: var(--transition);
}

.days-mode-btn svg { flex-shrink: 0; transition: var(--transition); }

.days-mode-btn.active {
  background: var(--accent);
  color: #ffffff;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(255, 153, 51, 0.3);
}

.days-mode-btn:not(.active):hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.5);
}

/* WCAG: visible focus on tab buttons */
.days-mode-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.days-panel { animation: fadeUp 0.22s ease both; }
.days-panel.hidden { display: none; }

/* Date range row */
.date-custom-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  animation: fadeUp 0.2s ease both;
}

.date-custom-row.hidden { display: none; }

.date-custom-row input[type="date"] {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  padding: 8px 12px;
  outline: none;
  cursor: pointer;
  color-scheme: light;
  flex: 1;
  min-width: 130px;
  height: 40px;
  transition: border-color var(--transition);
}

.date-custom-row input[type="date"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 153, 51, 0.25);
}

.date-sep {
  color: var(--accent);
  font-size: 16px;
  flex-shrink: 0;
}

.date-apply {
  background: transparent;
  border: 1px solid var(--border-hover);
  border-radius: 8px;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 12px;
  padding: 8px 14px;
  cursor: pointer;
  letter-spacing: 0.05em;
  transition: var(--transition);
  flex-shrink: 0;
  height: 40px;
}

.date-apply:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Calculate Button ───────────────────────────── */
.calc-btn {
  width: 100%;
  background: var(--accent);
  color: #ffffff;
  border: none;
  border-radius: var(--radius);
  padding: 16px 24px;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.05em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.calc-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0);
  transition: var(--transition);
}

.calc-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 30px rgba(255, 153, 51, 0.4);
}

.calc-btn:hover::before { background: rgba(255, 255, 255, 0.1); }
.calc-btn:active { transform: translateY(0); }

.calc-btn.calculating {
  opacity: 0.75;
  cursor: wait;
}

.calc-btn svg { transition: transform var(--transition); }
.calc-btn:hover svg { transform: translateX(4px); }

/* ── Results ────────────────────────────────────── */
.results { margin-top: 28px; }
.results.hidden { display: none; }

.results-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.results-divider::before,
.results-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.results-divider span {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

/* CSS FIX 8: 5 result cards in a 3-col grid leaves 2 orphaned on row 2.
   Fixed with a 3-col grid where the last 2 cards each span 1.5 cols using
   a subgrid trick: 6-column base, first 3 cards span 2 cols each,
   last 2 cards span 3 cols each = 3+3 = balanced two-row layout. */
.results-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.results-grid .result-card:nth-child(1),
.results-grid .result-card:nth-child(2),
.results-grid .result-card:nth-child(3) {
  grid-column: span 2;
}

.results-grid .result-card:nth-child(4),
.results-grid .result-card:nth-child(5) {
  grid-column: span 3;
}

.result-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: border-color var(--transition);
}

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

.result-card.accent {
  background: var(--accent2);
  border-color: var(--accent2);
}

.result-label {
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.result-card.accent .result-label { color: rgba(255, 255, 255, 0.9); }

.result-value {
  font-family: var(--font);
  font-size: 24px;
  color: var(--text);
  letter-spacing: -0.5px;
}

.result-card.accent .result-value { color: #ffffff; }

/* ── Interest Bar ───────────────────────────────── */
.interest-bar {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

.bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.bar-track {
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  background: var(--surface);
  margin-bottom: 8px;
}

.bar-principal {
  height: 100%;
  background: var(--accent2);
  border-radius: 4px 0 0 4px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.bar-principal.full { border-radius: 4px; }

.bar-interest {
  height: 100%;
  background: var(--accent);
  border-radius: 0 4px 4px 0;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.1s;
}

.bar-pcts {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* ── Reset Button ───────────────────────────────── */
.reset-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 13px;
  padding: 10px 20px;
  cursor: pointer;
  letter-spacing: 0.05em;
  transition: var(--transition);
  width: 100%;
  margin-top: 12px;
}

.reset-btn:hover {
  border-color: var(--error);
  color: var(--error);
}

/* ── Detailed Schedule Table ────────────────────── */
.detailed-schedule {
  margin-top: 32px;
  animation: fadeUp 0.3s ease both;
}

.detailed-schedule.hidden { display: none; }

.schedule-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.schedule-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.csv-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.csv-btn:hover {
  background: var(--surface);
  border-color: var(--accent);
  color: var(--accent);
}

.csv-btn svg { color: var(--accent); }

.schedule-table-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.schedule-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: var(--surface2);
}

.schedule-table th {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  font-weight: 500;
  text-align: left;
  padding: 12px 16px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}

.schedule-table td {
  padding: 10px 16px;
  border-bottom: 1px solid rgba(210, 210, 215, 0.4);
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

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

.schedule-table tr:hover td {
  background: rgba(255, 153, 51, 0.02);
}

.table-scroll {
  max-height: 400px;
  overflow-y: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface2);
}

/* Custom scrollbar */
.table-scroll::-webkit-scrollbar { width: 8px; }
.table-scroll::-webkit-scrollbar-track { background: transparent; }
.table-scroll::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 10px;
}
.table-scroll::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Content Cards ──────────────────────────────── */
.content-wrapper {
  display: flex;
  flex-direction: column;
  gap: 32px;
  margin-top: 40px;
  padding-bottom: 80px;
}

.content-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.content-card:hover {
  box-shadow: 0 8px 30px rgba(255, 153, 51, 0.04);
  transform: translateY(-2px);
  border-color: rgba(255, 153, 51, 0.3);
}

.content-card h2 {
  font-family: var(--font);
  font-size: 24px;
  color: var(--text);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.content-card h3 {
  font-size: 18px;
  color: var(--text);
  margin: 24px 0 16px 0;
}

.content-card p {
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1.7;
  margin-bottom: 18px;
}

.content-card strong { color: var(--text); font-weight: 600; }

.premium-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 24px 0;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.premium-table th {
  background: rgba(255, 153, 51, 0.1);
  color: var(--accent);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.05em;
  padding: 16px;
  text-align: left;
}

.premium-table td {
  padding: 16px;
  background: var(--surface2);
  color: var(--text);
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

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

.premium-table td:nth-child(4), .premium-table td:nth-child(5) {
  font-family: var(--mono);
}

.highlight-box {
  background: rgba(255, 153, 51, 0.05);
  border-left: 4px solid var(--accent);
  padding: 20px;
  border-radius: 0 12px 12px 0;
  margin: 24px 0;
}

.highlight-box p { margin: 0; color: var(--text); font-size: 15px; }

.modern-list {
  list-style: none;
  padding: 0;
  margin: 24px 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modern-list li {
  position: relative;
  padding-left: 48px;
  color: var(--text-muted);
  line-height: 1.6;
  font-size: 15px;
}

.modern-list li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: -2px;
  width: 28px;
  height: 28px;
  background: rgba(255, 153, 51, 0.1);
  color: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 12px;
}

.formula {
  background: var(--surface2);
  padding: 12px;
  border-radius: 8px;
  font-weight: 500;
  margin: 16px 0;
  border-left: 4px solid var(--accent);
}

.inline-link {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dotted var(--accent);
  font-weight: 500;
  transition: var(--transition);
}

.inline-link:hover {
  color: var(--accent2);
  border-bottom-style: solid;
}

/* ── FAQ Accordion ──────────────────────────────── */
.faq-accordion details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
}

.faq-accordion summary {
  padding: 16px;
  font-weight: 500;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq-accordion summary::after {
  content: '▾';
  color: var(--text-dim);
}

.faq-accordion details[open] summary::after { content: '▴'; }

.faq-accordion p {
  padding: 0 16px 16px;
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-muted);
}

/* ── Footer ─────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border);
  padding-top: 40px;
  padding-bottom: 60px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.footer-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 24px;
  margin-bottom: 8px;
}

.footer-links a {
  color: var(--text-muted);
  font-size: 11px;
  text-decoration: none;
  transition: var(--transition);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

.footer p {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.6;
  max-width: 680px;
  margin: 0 auto;
}

/* ── Error Messages ─────────────────────────────── */
.error-msg {
  font-size: 11px;
  color: var(--error);
  margin-top: 4px;
  min-height: 16px;
  display: block;
  letter-spacing: 0.02em;
}

.input-wrap.error input,
.input-wrap.error select {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(255, 59, 48, 0.12);
}

/* ── Animations ─────────────────────────────────── */
@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes countUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.result-value.animating {
  animation: countUp 0.4s ease both;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-8px); }
  40%       { transform: translateX(8px); }
  60%       { transform: translateX(-6px); }
  80%       { transform: translateX(6px); }
}

/* A11Y FIX: respect user's reduced-motion OS preference */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}

/* ── Responsive ─────────────────────────────────── */
@media (max-width: 540px) {
  .card { padding: 24px 18px; }

  /* On small screens, stack all result cards to single column */
  .results-grid {
    grid-template-columns: 1fr;
  }
  .results-grid .result-card:nth-child(n) {
    grid-column: span 1;
  }

  .schedule-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .csv-btn {
    width: 100%;
    justify-content: center;
  }

  .date-custom-row {
    flex-direction: column;
    align-items: stretch;
  }

  .date-sep { text-align: center; }
}

@media (max-width: 600px) {
  .content-card { padding: 24px; }
}
