/* ═══════════════════════════════════════════════════════════════
   UPSC Eligibility Calculator
═══════════════════════════════════════════════════════════════ */

.calc-page {
  padding: var(--space-6) 0 var(--space-12);
}

.calc-layout {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  gap: var(--space-6);
  align-items: start;
}

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


/* ── FORM PANEL ─────────────────────────────────────────────── */
.calc-form-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: 14px;
  padding: var(--space-5);
  position: sticky;
  top: 80px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}

@media (max-width: 900px) {
  .calc-form-panel { position: static; }
}

.calc-form__title {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: 600;
  margin-bottom: var(--space-4);
  color: var(--color-brand);
  display: flex;
  align-items: center;
  gap: 8px;
}

.calc-form__title::before {
  content: '';
  width: 4px; height: 22px;
  background: var(--color-accent);
  border-radius: 2px;
}

.calc-field {
  margin-bottom: var(--space-4);
}

.calc-field__label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--color-text);
  margin-bottom: 6px;
}

.calc-field__hint {
  font-weight: normal;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-left: 4px;
}

.calc-field__input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  background: var(--color-bg);
  color: var(--color-text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.calc-field__input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(212,160,23,0.15);
}

.calc-radio-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.calc-radio {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--color-border-light);
  border-radius: 7px;
  cursor: pointer;
  font-size: var(--text-sm);
  transition: background 0.12s, border-color 0.12s;
}

.calc-radio:hover {
  background: var(--color-bg-alt);
  border-color: var(--color-border);
}

.calc-radio input[type="radio"] {
  accent-color: var(--color-accent);
  flex-shrink: 0;
}

.calc-radio input[type="radio"]:checked + span {
  font-weight: var(--font-semibold);
  color: var(--color-brand);
}

.calc-radio:has(input:checked) {
  background: rgba(212,160,23,0.06);
  border-color: var(--color-accent);
}

.calc-btn {
  width: 100%;
  padding: 11px 18px;
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  margin-bottom: var(--space-2);
  font-family: var(--font-body);
}

.calc-btn--primary {
  background: var(--color-brand);
  color: #fff;
  box-shadow: 0 2px 6px rgba(15,76,58,0.15);
}

.calc-btn--primary:hover {
  background: #0d4031;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(15,76,58,0.22);
}

.calc-btn--ghost {
  background: transparent;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}

.calc-btn--ghost:hover {
  background: var(--color-bg-alt);
  color: var(--color-text);
}

.calc-form__error {
  padding: 10px 12px;
  background: #fef2f2;
  border: 1px solid #fca5a5;
  color: var(--color-error);
  border-radius: 7px;
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  margin-bottom: 12px;
  line-height: 1.4;
}

.calc-form__note {
  margin-top: var(--space-4);
  padding: 10px 12px;
  background: rgba(212,160,23,0.08);
  border-left: 3px solid var(--color-accent);
  border-radius: 4px;
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  line-height: 1.5;
}

/* ── RESULTS PANEL ──────────────────────────────────────────── */
.calc-results-panel {
  min-height: 500px;
}

.calc-empty-state {
  background: var(--color-surface);
  border: 2px dashed var(--color-border-light);
  border-radius: 14px;
  padding: var(--space-8) var(--space-6);
  text-align: center;
  min-height: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.calc-empty__icon {
  font-size: 48px;
  margin-bottom: var(--space-3);
  opacity: 0.6;
}

.calc-empty-state h3 {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  color: var(--color-text);
  margin-bottom: 8px;
}

.calc-empty-state > p {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  margin-bottom: var(--space-6);
}

.calc-empty__features {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
  max-width: 500px;
  margin: 0 auto;
}

.calc-empty__feature {
  display: flex;
  gap: 10px;
  padding: 12px;
  background: var(--color-bg);
  border-radius: 8px;
  text-align: left;
  align-items: flex-start;
}

.calc-empty__feat-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.calc-empty__feature strong {
  display: block;
  font-size: var(--text-sm);
  color: var(--color-text);
  margin-bottom: 2px;
}

.calc-empty__feature span {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* ── RESULT CARDS ───────────────────────────────────────────── */
.calc-result {
  animation: calcFadeIn 0.4s ease;
}

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

.calc-verdict {
  border-radius: 14px;
  padding: var(--space-5);
  margin-bottom: var(--space-4);
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}

.calc-verdict--eligible {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border: 1px solid #86efac;
}

.calc-verdict--ineligible {
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  border: 1px solid #fca5a5;
}

.calc-verdict__icon {
  width: 60px; height: 60px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
  flex-shrink: 0;
}

.calc-verdict--eligible .calc-verdict__icon {
  background: #22c55e;
  color: #fff;
}

.calc-verdict--ineligible .calc-verdict__icon {
  background: #ef4444;
  color: #fff;
}

.calc-verdict__text h2 {
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--color-text);
}

.calc-verdict__text p {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: 1.5;
}

/* Stat grid */
.calc-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

@media (max-width: 600px) {
  .calc-stats { grid-template-columns: repeat(2, 1fr); }
}

.calc-stat {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: 10px;
  padding: var(--space-4) var(--space-3);
  text-align: center;
}

.calc-stat__value {
  font-family: var(--font-heading);
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--color-brand);
  line-height: 1;
  margin-bottom: 4px;
}

.calc-stat__value--warn { color: #d97706; }
.calc-stat__value--danger { color: #dc2626; }
.calc-stat__value--ok { color: #16a34a; }

.calc-stat__label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: var(--font-semibold);
}

/* Detail rows */
.calc-detail-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: 12px;
  margin-bottom: var(--space-3);
  overflow: hidden;
}

.calc-detail-card__header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  background: var(--color-bg-alt);
  border-bottom: 1px solid var(--color-border-light);
  font-weight: var(--font-semibold);
  font-size: var(--text-sm);
}

.calc-detail-card__header::before {
  content: '';
  width: 3px;
  height: 18px;
  background: var(--color-accent);
  border-radius: 2px;
}

.calc-detail-card__body {
  padding: 14px 18px;
}

.calc-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 8px 0;
  border-bottom: 1px solid var(--color-border-light);
  font-size: var(--text-sm);
  gap: 16px;
}

.calc-detail-row:last-child { border-bottom: none; }

.calc-detail-row__label {
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.calc-detail-row__value {
  color: var(--color-text);
  font-weight: var(--font-semibold);
  text-align: right;
}

.calc-detail-row__value--success { color: #16a34a; }
.calc-detail-row__value--warn { color: #d97706; }
.calc-detail-row__value--danger { color: #dc2626; }

/* Roadmap table */
.calc-roadmap {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  margin-top: 8px;
}

.calc-roadmap th {
  background: var(--color-bg-alt);
  padding: 10px 12px;
  text-align: left;
  font-weight: var(--font-semibold);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
}

.calc-roadmap td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-border-light);
}

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

.calc-roadmap-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
}

.calc-roadmap-badge--ok {
  background: #dcfce7;
  color: #15803d;
}

.calc-roadmap-badge--last {
  background: #fef9c3;
  color: #a16207;
}

.calc-roadmap-badge--no {
  background: #fee2e2;
  color: #b91c1c;
}

.calc-roadmap tr.last-eligible td {
  background: rgba(212,160,23,0.05);
  font-weight: var(--font-semibold);
}

/* Warnings / notes block */
.calc-notes {
  background: rgba(59,130,246,0.06);
  border: 1px solid rgba(59,130,246,0.2);
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: var(--space-3);
}

.calc-notes h4 {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: #1e40af;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.calc-notes ul {
  margin: 0;
  padding-left: 20px;
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: 1.6;
}

.calc-notes li { margin-bottom: 4px; }

/* Share / print actions */
.calc-actions {
  display: flex;
  gap: 10px;
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border-light);
  flex-wrap: wrap;
}

.calc-action-btn {
  flex: 1;
  min-width: 140px;
  padding: 10px 14px;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border-light);
  border-radius: 7px;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--color-text);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
  font-family: var(--font-body);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.calc-action-btn:hover {
  background: var(--color-bg);
  border-color: var(--color-border);
}

/* ── REFERENCE SECTION ──────────────────────────────────────── */
.calc-reference {
  margin-top: var(--space-12);
  padding-top: var(--space-8);
  border-top: 1px solid var(--color-border-light);
}

.calc-ref__title {
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  font-weight: 600;
  color: var(--color-brand);
  margin-bottom: 6px;
}

.calc-ref__sub {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-6);
}

.calc-ref__sub a {
  color: var(--color-accent);
  text-decoration: none;
}

.calc-ref__sub a:hover { text-decoration: underline; }

.calc-ref-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
}

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

.calc-ref-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: 12px;
  padding: var(--space-5);
}

.calc-ref-card__title {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-3);
}

.calc-table-wrap {
  overflow-x: auto;
  border-radius: 7px;
  border: 1px solid var(--color-border-light);
}

.calc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.calc-table th {
  background: var(--color-bg-alt);
  padding: 8px 12px;
  text-align: left;
  font-weight: var(--font-semibold);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
}

.calc-table td {
  padding: 8px 12px;
  border-top: 1px solid var(--color-border-light);
}

.calc-table tbody tr:hover { background: var(--color-bg-alt); }

.calc-ref-list {
  margin: 0;
  padding-left: 18px;
  font-size: var(--text-sm);
  line-height: 1.7;
  color: var(--color-text-secondary);
}

.calc-ref-list li { margin-bottom: 8px; }

.calc-ref-list strong { color: var(--color-text); }

.calc-ref-note {
  margin-top: var(--space-3);
  padding: 10px 12px;
  background: var(--color-bg-alt);
  border-radius: 7px;
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  line-height: 1.5;
}

/* ── FAQ ────────────────────────────────────────────────────── */
.calc-faq {
  margin-top: var(--space-10);
  max-width: 900px;
}

.calc-faq__item {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: 10px;
  margin-bottom: 10px;
  overflow: hidden;
}

.calc-faq__item summary {
  padding: 14px 18px;
  font-weight: var(--font-semibold);
  font-size: var(--text-sm);
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--color-text);
  transition: background 0.12s;
}

.calc-faq__item summary:hover {
  background: var(--color-bg-alt);
}

.calc-faq__item summary::-webkit-details-marker { display: none; }

.calc-faq__item summary::after {
  content: '+';
  font-size: 20px;
  color: var(--color-accent);
  font-weight: 400;
  transition: transform 0.2s;
}

.calc-faq__item[open] summary::after {
  content: '−';
}

.calc-faq__item p {
  padding: 0 18px 14px;
  margin: 0;
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: 1.6;
}

.calc-faq__item strong {
  color: var(--color-text);
}

/* ── Stat sub-labels + progress bars ───────────────────────── */
.calc-stat__sub {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-top: 4px;
  font-weight: var(--font-medium);
}

.calc-stat__bar {
  height: 4px;
  background: var(--color-bg-alt);
  border-radius: 2px;
  margin-top: 8px;
  overflow: hidden;
}

.calc-stat__bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #22c55e 0%, #16a34a 100%);
  border-radius: 2px;
  transition: width 0.8s ease;
}

.calc-stat__bar-fill--used {
  background: linear-gradient(90deg, #f59e0b 0%, #d97706 100%);
}

/* ── Strategy block ────────────────────────────────────────── */
.calc-strategy {
  border-radius: 12px;
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-3);
  border-left: 4px solid;
}

.calc-strategy--success {
  background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
  border-left-color: #22c55e;
}

.calc-strategy--warn {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border-left-color: #f59e0b;
}

.calc-strategy--danger {
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  border-left-color: #ef4444;
}

.calc-strategy__title {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--color-text);
}

.calc-strategy__list {
  margin: 0;
  padding-left: 18px;
  font-size: var(--text-sm);
  line-height: 1.7;
  color: var(--color-text-secondary);
}

.calc-strategy__list li {
  margin-bottom: 8px;
}

.calc-strategy__list strong {
  color: var(--color-text);
}

.calc-strategy__list a {
  color: var(--color-accent);
  text-decoration: none;
  font-weight: var(--font-semibold);
}

.calc-strategy__list a:hover { text-decoration: underline; }

/* ── Timeline ──────────────────────────────────────────────── */
.calc-timeline {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
}

.calc-timeline::before {
  content: '';
  position: absolute;
  left: 13px;
  top: 0; bottom: 0;
  width: 2px;
  background: var(--color-border-light);
}

.calc-timeline__item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  position: relative;
}

.calc-timeline__dot {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--color-accent);
  color: #fff;
  font-size: 12px;
  font-weight: var(--font-semibold);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  z-index: 1;
  box-shadow: 0 0 0 3px var(--color-surface);
}

.calc-timeline__content {
  padding-top: 3px;
}

.calc-timeline__stage {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--color-text);
  margin-bottom: 2px;
}

.calc-timeline__when {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* ── Resource grid ─────────────────────────────────────────── */
.calc-resource-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.calc-resource-card {
  display: block;
  padding: 14px;
  background: var(--color-bg);
  border: 1px solid var(--color-border-light);
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}

.calc-resource-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
  border-color: var(--color-accent);
}

.calc-resource-card__icon {
  font-size: 22px;
  margin-bottom: 6px;
}

.calc-resource-card__title {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--color-brand);
  margin-bottom: 4px;
}

.calc-resource-card__desc {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.5;
}

/* ── How-to list ───────────────────────────────────────────── */
.calc-howto-list {
  margin: 0;
  padding-left: 22px;
  font-size: var(--text-sm);
  line-height: 1.7;
  color: var(--color-text-secondary);
  counter-reset: howto;
}

.calc-howto-list li {
  margin-bottom: 10px;
}

.calc-howto-list strong { color: var(--color-text); }

.calc-howto-list a {
  color: var(--color-accent);
  text-decoration: none;
  font-weight: var(--font-medium);
}

.calc-howto-list a:hover { text-decoration: underline; }

/* Action button that is also a link */
a.calc-action-btn {
  text-decoration: none;
  color: var(--color-text);
}

/* ═══════════════════════════════════════════════════════════════
   LARGE-SCREEN / DESKTOP FIXES — prevent overstretch on wide screens
═══════════════════════════════════════════════════════════════ */

/* Layout grid — let the container handle max-width, just set columns */
@media (min-width: 1200px) {
  .calc-layout {
    grid-template-columns: 360px minmax(0, 1fr);
  }
}

/* Results panel — cap inner content width for readability */
.calc-results-panel { min-width: 0; max-width: 100%; }
.calc-result { max-width: 100%; }

/* Verdict card — don't stretch full width on wide screens */
.calc-verdict {
  max-width: 100%;
}

/* Stats grid — fill available width evenly (4 equal columns on desktop) */
.calc-stats { max-width: 100%; }

/* Resource grid — auto-fit fills available width with equal columns */
.calc-resource-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  max-width: 100%;
}

/* Reference + FAQ flow full container width, not capped/centered.
   This keeps them aligned with the .calc-layout grid above. */
.calc-reference, .calc-faq {
  max-width: 100%;
}

/* Empty state features — cap so they don't spread too wide */
.calc-empty__features {
  max-width: 540px;
  margin-left: auto;
  margin-right: auto;
}

/* Detail card — cap rows readable width */
.calc-detail-card { max-width: 100%; }
.calc-detail-card__body { max-width: 100%; }

/* Tables — full width inside card but card has its own bounds */
.calc-table-wrap { max-width: 100%; overflow-x: auto; }

/* ── Fix overlapping element issues on large screens ────── */

/* Form panel: when results panel is shorter, sticky form overflowed
   on the bottom — fix by limiting sticky height with max-height + scroll */
@media (min-width: 901px) {
  .calc-form-panel {
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    overflow-x: hidden;
  }
  /* Custom scrollbar for the sticky form panel */
  .calc-form-panel::-webkit-scrollbar { width: 4px; }
  .calc-form-panel::-webkit-scrollbar-track { background: transparent; }
  .calc-form-panel::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 2px; }
}

/* Verdict cards — prevent flex children from overflowing */
.calc-verdict__text {
  min-width: 0;
  flex: 1;
}
.calc-verdict__text h2,
.calc-verdict__text p {
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Stat cards — prevent value/label overflow */
.calc-stat__value { word-break: break-word; }

/* Detail row — flex children min-width fix */
.calc-detail-row__label,
.calc-detail-row__value {
  min-width: 0;
  word-wrap: break-word;
}

/* Roadmap table cells — prevent overflow */
.calc-roadmap td {
  word-wrap: break-word;
  max-width: 240px;
}

/* Notes blocks — proper width */
.calc-notes,
.prelims-tips,
.calc-strategy {
  max-width: 100%;
  word-wrap: break-word;
}

/* Resource cards — flex content fix */
.calc-resource-card { min-width: 0; }
.calc-resource-card__title,
.calc-resource-card__desc { word-wrap: break-word; }

/* FAQ items — content overflow fix */
.calc-faq__item p {
  word-wrap: break-word;
  max-width: 100%;
}

/* Reference card — prevent ul overflow */
.calc-ref-card ul, .calc-ref-list {
  word-wrap: break-word;
}

/* ═══════════════════════════════════════════════════════════════
   UI/UX IMPROVEMENTS — Shared across all calculator tools
═══════════════════════════════════════════════════════════════ */

/* ── Tablet responsive (501-900px) — improve form panel ── */
@media (min-width: 501px) and (max-width: 900px) {
  .calc-form-panel { padding: var(--space-4); }
  .calc-field__input { font-size: 16px; /* prevents iOS zoom on focus */ }
}

/* ── Mobile responsive (under 500px) — critical fixes ── */
@media (max-width: 500px) {
  .calc-page { padding: var(--space-4) 0 var(--space-8); }
  .calc-layout { gap: var(--space-4); }
  .calc-form-panel { padding: var(--space-4); border-radius: 10px; }
  .calc-form__title { font-size: var(--text-lg); }
  .calc-field__input { font-size: 16px; padding: 11px 12px; } /* iOS no-zoom */
  .calc-field { margin-bottom: var(--space-3); }
  .calc-btn { padding: 13px 18px; font-size: var(--text-sm); }

  /* Empty state — smaller on mobile */
  .calc-empty-state { padding: var(--space-5) var(--space-3); }
  .calc-empty__icon { font-size: 36px; }
  .calc-empty-state h3 { font-size: var(--text-lg); }
  .calc-empty__features { grid-template-columns: 1fr; gap: var(--space-2); }

  /* Verdict card — smaller on mobile */
  .calc-verdict { padding: var(--space-3); gap: 10px; }
  .calc-verdict__icon { width: 44px; height: 44px; font-size: 22px; }
  .calc-verdict__text h2 { font-size: var(--text-lg); }

  /* Stats grid — 2 columns on mobile, not 4 */
  .calc-stats { grid-template-columns: repeat(2, 1fr); gap: var(--space-2); }
  .calc-stat { padding: var(--space-3) var(--space-2); }
  .calc-stat__value { font-size: var(--text-2xl); }
  .calc-stat__label { font-size: 10px; }

  /* Reference grid — single column on mobile */
  .calc-ref-grid { grid-template-columns: 1fr !important; }

  /* Actions — stack vertically */
  .calc-actions { flex-direction: column; }
  .calc-action-btn { width: 100%; }

  /* Detail rows — wrap properly */
  .calc-detail-row { flex-direction: column; align-items: flex-start; gap: 4px; }
  .calc-detail-row__value { text-align: left; }

  /* Tables — horizontal scroll with shadow indicator */
  .calc-table-wrap {
    position: relative;
    border-radius: 7px;
  }
  .calc-table-wrap::after {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: 24px;
    background: linear-gradient(90deg, transparent, rgba(0,0,0,0.08));
    pointer-events: none;
    border-radius: 0 7px 7px 0;
  }
  .calc-table th, .calc-table td { padding: 8px 10px; font-size: 12px; white-space: nowrap; }

  /* FAQ — smaller padding */
  .calc-faq__item summary { padding: 12px 14px; font-size: var(--text-sm); }
  .calc-faq__item p { padding: 0 14px 12px; font-size: var(--text-sm); }
}

/* ── Loading states (smoother UX) ─────────────────────── */
.calc-btn--primary:active {
  transform: translateY(0);
  box-shadow: 0 0 0 4px rgba(212,160,23,0.18);
}

.calc-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  filter: grayscale(0.3);
}

/* Loading spinner option for buttons */
.calc-btn--loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}
.calc-btn--loading::after {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  top: 50%; left: 50%;
  margin: -8px 0 0 -8px;
  border: 2px solid #fff;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Form field improvements ─────────────────────────── */
.calc-field__input:hover:not(:focus) {
  border-color: var(--color-text-muted);
}

.calc-field__input::placeholder {
  color: var(--color-text-muted);
  opacity: 0.7;
}

/* Number input — hide spinner on Firefox; tighter on WebKit */
input[type="number"].calc-field__input {
  appearance: textfield;
  -moz-appearance: textfield;
}
input[type="number"].calc-field__input::-webkit-outer-spin-button,
input[type="number"].calc-field__input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Date input — better alignment */
input[type="date"].calc-field__input {
  position: relative;
  padding-right: 8px;
}
input[type="date"].calc-field__input::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.6;
}
input[type="date"].calc-field__input::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

/* Select arrow customisation */
select.calc-field__input {
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='3'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px;
  padding-right: 36px;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  cursor: pointer;
}

/* ── Focus indicators — accessibility ──────────────── */
.calc-btn:focus-visible,
.calc-field__input:focus-visible,
.calc-radio:focus-within {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* ── Print styles — for printable reports ──────────── */
@media print {
  .page-header, .calc-form-panel, .calc-faq, .calc-reference, .calc-actions,
  .primary-nav, .footer-copy, #toast-container, button {
    display: none !important;
  }
  .calc-page { padding: 0; }
  .calc-layout { display: block; }
  .calc-result { page-break-inside: avoid; }
  .calc-detail-card { box-shadow: none; border: 1px solid #ddd; page-break-inside: avoid; }
  .calc-verdict { box-shadow: none; }
  body { font-size: 11pt; }
  a { color: inherit; text-decoration: none; }
}

/* ── Improved scroll behaviour ──────────────────────── */
html { scroll-behavior: smooth; }

/* Smooth fade-in for result blocks */
.calc-result > * {
  animation: calcResultFadeIn 0.35s ease both;
}
.calc-result > *:nth-child(2) { animation-delay: 0.05s; }
.calc-result > *:nth-child(3) { animation-delay: 0.10s; }
.calc-result > *:nth-child(4) { animation-delay: 0.15s; }
.calc-result > *:nth-child(5) { animation-delay: 0.20s; }
.calc-result > *:nth-child(6) { animation-delay: 0.25s; }
.calc-result > *:nth-child(7) { animation-delay: 0.30s; }

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

/* ── Resource cards — better hover state ────────────── */
.calc-resource-card {
  position: relative;
  overflow: hidden;
}
.calc-resource-card::after {
  content: '→';
  position: absolute;
  right: 14px; top: 14px;
  opacity: 0;
  color: var(--color-accent);
  font-size: 14px;
  transition: opacity 0.15s, transform 0.15s;
}
.calc-resource-card:hover::after {
  opacity: 1;
  transform: translateX(2px);
}

/* ── Skip-link for keyboard accessibility ──────────── */
.skip-to-results {
  position: absolute;
  left: -9999px;
  top: 0;
}
.skip-to-results:focus {
  left: var(--space-3);
  top: var(--space-3);
  z-index: 100;
  padding: 8px 14px;
  background: var(--color-brand);
  color: #fff;
  border-radius: 6px;
}

/* ═══════════════════════════════════════════════════════════════
   SHARED COMPONENTS — used across all calculator tools
   (Moved here from prelims.css / sap.css so all tools render correctly
   without needing to import every other tool's stylesheet)
═══════════════════════════════════════════════════════════════ */

/* Tips / Insights / Recommendations block (blue info card) */
.prelims-tips {
  background: rgba(59,130,246,0.06);
  border: 1px solid rgba(59,130,246,0.2);
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: var(--space-3);
}

.prelims-tips h4 {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: #1e40af;
  margin-bottom: 8px;
}

.prelims-tips ul {
  margin: 0;
  padding-left: 18px;
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: 1.7;
}

.prelims-tips li { margin-bottom: 4px; }

.prelims-tips strong { color: var(--color-text); }

.prelims-tips a {
  color: var(--color-accent);
  text-decoration: none;
  font-weight: var(--font-semibold);
}

.prelims-tips a:hover { text-decoration: underline; }

@media (max-width: 500px) {
  .prelims-tips { padding: 10px 14px; }
  .prelims-tips ul { padding-left: 14px; font-size: 12px; }
  .prelims-tips h4 { font-size: 12px; }
}

/* Zone / context hint (also blue info card with slightly different padding) */
.sap-zone-hint {
  background: rgba(59,130,246,0.06);
  border: 1px solid rgba(59,130,246,0.2);
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: var(--space-3);
}

.sap-zone-hint h4 {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: #1e40af;
  margin-bottom: 6px;
}

.sap-zone-hint p {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: 1.6;
  margin: 0;
}

.sap-zone-hint strong { color: var(--color-text); }

.sap-zone-hint a {
  color: var(--color-accent);
  font-weight: var(--font-semibold);
  text-decoration: none;
}

.sap-zone-hint a:hover { text-decoration: underline; }

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