/* Indian Income Tax Calculator — Stylesheet */

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: Inter, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: #f5f6f8;
  color: #1a1a2e;
  line-height: 1.6;
  min-height: 100vh;
}

/* Container */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

/* Header */
.header {
  text-align: center;
  padding: 32px 0 24px;
}

.header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: #1a1a2e;
  letter-spacing: -0.02em;
}

.subtitle {
  color: #64748b;
  font-size: 0.95rem;
  margin-top: 4px;
}

.fy-selector {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  background: #fff;
  padding: 8px 16px;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.fy-selector label {
  font-weight: 600;
  font-size: 0.9rem;
  color: #475569;
}

.fy-selector select {
  padding: 6px 12px;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #2563eb;
  background: #f8fafc;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s;
}

.fy-selector select:focus {
  border-color: #2563eb;
}

/* Cards */
.card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06), 0 2px 12px rgba(0,0,0,0.04);
  margin-bottom: 16px;
  overflow: hidden;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 650;
  padding: 16px 20px;
  color: #1a1a2e;
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
}

.card-body {
  padding: 0 20px 20px;
  display: none;
}

.card-body.expanded {
  display: block;
}

/* Collapsible toggle */
.toggle-btn {
  cursor: pointer;
  transition: background-color 0.15s;
  border-radius: 12px 12px 0 0;
}

.toggle-btn:hover {
  background: #f8fafc;
}

.chevron {
  margin-left: auto;
  font-size: 0.8rem;
  color: #94a3b8;
  transition: transform 0.25s ease;
  flex-shrink: 0;
}

.toggle-btn.open .chevron {
  transform: rotate(180deg);
}

.section-sum {
  font-size: 0.85rem;
  font-weight: 600;
  color: #2563eb;
  margin-left: auto;
  margin-right: 8px;
}

/* Forms */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 550;
  color: #475569;
}

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

.rupee {
  position: absolute;
  left: 12px;
  font-size: 0.9rem;
  color: #94a3b8;
  font-weight: 500;
  pointer-events: none;
  z-index: 1;
}

.input-wrap input[type="text"] {
  width: 100%;
  padding: 9px 12px 9px 30px;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: inherit;
  color: #1a1a2e;
  background: #fafbfc;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-wrap input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
  background: #fff;
}

.input-wrap input::placeholder {
  color: #cbd5e1;
}

select {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: inherit;
  color: #1a1a2e;
  background: #fafbfc;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
}

select:focus {
  border-color: #2563eb;
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #2563eb;
  vertical-align: middle;
  margin-right: 6px;
  cursor: pointer;
}

.hint {
  font-size: 0.75rem;
  color: #94a3b8;
  line-height: 1.3;
}

.info-note {
  font-size: 0.82rem;
  color: #64748b;
  background: #f0f9ff;
  border-left: 3px solid #2563eb;
  padding: 10px 14px;
  border-radius: 0 8px 8px 0;
  margin-bottom: 16px;
}

.info-box {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.85rem;
  color: #166534;
  margin-top: 8px;
}

.info-box.hidden {
  display: none;
}

/* Deductions */
.deduction-group {
  border-top: 1px solid #f1f5f9;
  padding-top: 14px;
  margin-top: 14px;
}

.deduction-group:first-child {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

.deduction-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: #334155;
  padding: 8px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.deduction-limit {
  font-weight: 400;
  color: #94a3b8;
  font-size: 0.82rem;
}

.deduction-details {
  display: none;
  padding-top: 10px;
}

.deduction-details.expanded {
  display: block;
}

.total-80c {
  font-size: 0.88rem;
  color: #475569;
  padding: 10px 0;
  display: flex;
  align-items: center;
  gap: 4px;
}

.total-80c strong {
  color: #2563eb;
}

/* Results / Comparison */
.results-card {
  border: 2px solid #e2e8f0;
}

.results-card .card-title {
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.comparison-table-wrap {
  overflow-x: auto;
  padding: 0 20px;
}

.comparison-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.comparison-table th {
  text-align: left;
  padding: 10px 14px;
  font-weight: 650;
  color: #475569;
  border-bottom: 2px solid #e2e8f0;
  white-space: nowrap;
}

.comparison-table th:not(:first-child) {
  text-align: right;
  min-width: 130px;
}

.comparison-table td {
  padding: 9px 14px;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
}

.comparison-table td:not(:first-child) {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  white-space: nowrap;
}

.comparison-table .row-highlight td {
  background: #f8fafc;
  font-weight: 600;
}

.comparison-table .row-total td {
  background: #1a1a2e;
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  border-bottom: none;
}

.comparison-table .row-total td:first-child {
  border-radius: 0 0 0 8px;
}

.comparison-table .row-total td:last-child {
  border-radius: 0 0 8px 0;
}

/* Savings banner */
.savings-banner {
  margin: 16px 20px 20px;
  padding: 14px 18px;
  border-radius: 10px;
  font-size: 0.92rem;
  font-weight: 600;
  text-align: center;
  background: #f8fafc;
  color: #64748b;
  border: 1.5px dashed #e2e8f0;
}

.savings-banner.save-old {
  background: #f0fdf4;
  color: #166534;
  border: 1.5px solid #86efac;
}

.savings-banner.save-new {
  background: #eff6ff;
  color: #1e40af;
  border: 1.5px solid #93c5fd;
}

.savings-banner.save-equal {
  background: #fefce8;
  color: #854d0e;
  border: 1.5px solid #fde047;
}

/* Slab Breakdown */
.breakdown-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.breakdown-col h3 {
  font-size: 0.92rem;
  font-weight: 650;
  color: #475569;
  margin-bottom: 10px;
}

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

.slab-table th {
  text-align: left;
  padding: 6px 8px;
  font-weight: 600;
  color: #64748b;
  border-bottom: 1.5px solid #e2e8f0;
  white-space: nowrap;
}

.slab-table th:last-child {
  text-align: right;
}

.slab-table td {
  padding: 5px 8px;
  color: #334155;
  border-bottom: 1px solid #f1f5f9;
}

.slab-table td:last-child {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

.slab-table tr:last-child td {
  font-weight: 700;
  border-bottom: none;
  border-top: 1.5px solid #e2e8f0;
}

/* ITR Recommendation */
.itr-recommendation {
  padding: 16px 20px 20px;
}

.itr-form-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: #2563eb;
  margin-bottom: 4px;
}

.itr-description {
  font-size: 0.88rem;
  color: #475569;
  margin-bottom: 8px;
}

.itr-reason {
  font-size: 0.82rem;
  color: #64748b;
  background: #f8fafc;
  padding: 10px 14px;
  border-radius: 8px;
  line-height: 1.5;
}

.itr-reason:empty {
  display: none;
}

/* Footer */
.footer {
  text-align: center;
  padding: 24px 16px;
  font-size: 0.8rem;
  color: #94a3b8;
  line-height: 1.6;
}

.footer strong {
  color: #64748b;
}

.footer-links {
  margin-top: 4px;
  font-size: 0.75rem;
}

.footer-brand {
  margin-top: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #475569;
}

.footer-brand a {
  color: #2563eb;
  text-decoration: none;
}

.footer-brand a:hover {
  text-decoration: underline;
}

/* Hidden utility */
.hidden {
  display: none !important;
}

/* Responsive */
@media (max-width: 640px) {
  .container {
    padding: 12px 10px 36px;
  }

  .header h1 {
    font-size: 1.35rem;
  }

  .subtitle {
    font-size: 0.85rem;
  }

  .fy-selector {
    flex-direction: column;
    gap: 6px;
    width: 100%;
  }

  .fy-selector select {
    width: 100%;
  }

  .card-title {
    padding: 14px 16px;
    font-size: 0.95rem;
  }

  .card-body {
    padding: 0 16px 16px;
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 12px;
  }

  .comparison-table th,
  .comparison-table td {
    padding: 8px 10px;
    font-size: 0.82rem;
  }

  .comparison-table th:not(:first-child),
  .comparison-table td:not(:first-child) {
    min-width: 100px;
  }

  .breakdown-columns {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .savings-banner {
    margin: 12px 16px 16px;
    font-size: 0.85rem;
  }

  .itr-recommendation {
    padding: 12px 16px 16px;
  }
}

/* Animation for expand/collapse */
.card-body,
.deduction-details {
  transition: none;
}

/* Accent colors for amounts */
.amount-positive {
  color: #16a34a;
}

.amount-negative {
  color: #dc2626;
}

/* Highlight winning regime in table */
.winner-cell {
  color: #16a34a !important;
  position: relative;
}

.loser-cell {
  color: #dc2626 !important;
}
