/* Surya Siddhanta Kundali — Premium redesigned UI styles (incl. print A4). */

/* ========== ROOT & THEME ========== */
:root {
  --ia-primary: #a85200;
  --ia-primary-dark: #7a3c00;
  --ia-secondary: #b8960f;
  --ia-accent: #d4b227;
  --ia-bg: #fff8f0;
  --ia-surface: #fffdf9;
  --ia-text: #44403c;
  --ia-muted: #78716c;
  --ia-border: #f5dcc3;
  --ia-today: #fff0d9;
  --ia-holiday: #fdf2f5;
  /* North-Indian kundali reference theme. */
  --theme-primary:#7a1f1f;
  --theme-secondary:#38251c;
  --theme-accent:#b31d22;
  --theme-border:#a62d27;
  --theme-paper:#f6ebdc;
  --theme-table-head:#efe0c5;
  --theme-chart-fill:#fff8ee;
  --theme-chart-line:#8c1f24;
  --theme-chart-planet:#7a1f1f;
  --theme-chart-lagna:#7a1f1f;
  --theme-chart-emblem:#f0d58d;
  --theme-text:#2d1b15;
  --theme-gold:#d0a84b;
  --theme-muted:#5a473f;
  --theme-surface-soft:#f3e6d0;
  --theme-surface-warm:#f7efd6;
  
  /* Premium form theme */
  --maroon: #a85200;
  --gold: var(--theme-gold);
  --ink: var(--theme-text);
  --paper: var(--theme-paper);
  --green: var(--theme-border);
  --red: var(--theme-accent);
  --blue: var(--theme-secondary);
  
  /* Additional colors */
  --light-bg: #fff8f0;
  --card-shadow: 0 2px 8px rgba(168, 82, 0, 0.08);
  --card-shadow-hover: 0 4px 16px rgba(168, 82, 0, 0.12);
  --border-light: #f0dcc6;
  --text-muted: #78716c;
}

* { box-sizing: border-box; }

/* ========== BODY & BASE ========== */
html { scroll-behavior: smooth; }

body {
  font-family: "Poppins", "Noto Sans Devanagari", "Kalimati", "Mangal", sans-serif;
  margin: 0;
  background: linear-gradient(135deg, #fff8f0 0%, #fff0d9 100%);
  color: var(--ink);
  line-height: 1.6;
  min-height: 100vh;
}

.page-form { display: flex; flex-direction: column; min-height: 100vh; }
.page-form > * { flex-shrink: 0; }
.form-container { flex: 1; }

/* ========== HEADER ========== */
.topbar {
  background: linear-gradient(135deg, #a85200 0%, #e67e00 100%);
  color: #fff;
  padding: 1rem 1.5rem;
  display: flex;
  gap: 1rem;
  align-items: center;
  box-shadow: 0 4px 12px rgba(168, 82, 0, 0.18);
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand {
  font-size: 1.8rem;
  color: #fff0d9;
  line-height: 1;
  min-width: 2.2rem;
}

.brand img { display: block; width: auto; height: 38px; max-width: 190px; object-fit: contain; }

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.brand-primary {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.brand-secondary {
  font-size: 0.8rem;
  opacity: 0.9;
  font-weight: 400;
}

/* ========== HERO SECTION ========== */
.hero {
  background: linear-gradient(135deg, rgba(168, 82, 0, 0.05) 0%, rgba(184, 150, 15, 0.05) 100%);
  border-bottom: 2px solid var(--gold);
  padding: 3rem 1.5rem;
  text-align: center;
}

.hero-content {
  max-width: 800px;
  margin: 0 auto;
}

.hero h1 {
  font-size: 2.2rem;
  color: var(--maroon);
  margin: 0 0 0.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.hero-subtitle {
  font-size: 1.05rem;
  color: var(--text-muted);
  margin: 0 0 1.5rem;
  line-height: 1.7;
}

.hero-requirements {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 12px;
  border: 1px solid var(--border-light);
}

.req-item {
  font-weight: 500;
  color: var(--gold);
  font-size: 0.95rem;
}

/* ========== FORM LAYOUT ========== */
.form-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.form-section {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: var(--card-shadow);
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.form-section:hover {
  box-shadow: var(--card-shadow-hover);
  border-color: var(--gold);
}

.form-section h2 {
  color: var(--maroon);
  font-size: 1.35rem;
  margin: 0 0 0.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--gold);
  font-weight: 600;
}

.section-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin: 0.5rem 0 1.5rem;
  font-weight: 400;
}

/* ========== FORM GROUPS ========== */
.form-group {
  margin-bottom: 1.5rem;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-label {
  display: block;
  margin-bottom: 0.6rem;
  font-weight: 600;
  color: var(--ink);
  font-size: 1rem;
}

.required {
  color: var(--red);
  font-weight: 700;
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: #ffffff;
  font-family: inherit;
  font-size: 1rem;
  color: var(--ink);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--maroon);
  box-shadow: 0 0 0 3px rgba(168, 82, 0, 0.1);
}

.form-control:disabled {
  background: #f5ede1;
  color: var(--text-muted);
  cursor: not-allowed;
}

.form-error {
  color: var(--red);
  font-size: 0.9rem;
  margin-top: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.form-error::before {
  content: "⚠";
  font-weight: bold;
}

/* ========== ALERTS ========== */
.alert {
  display: flex;
  gap: 1rem;
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 1.5rem 0;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.1);
}

.alert-error {
  border-left: 4px solid var(--red);
}

.alert-icon {
  font-size: 1.5rem;
  line-height: 1;
  min-width: 1.5rem;
}

.alert-content {
  flex: 1;
}

.alert-title {
  font-weight: 600;
  color: #991b1b;
  margin-bottom: 0.5rem;
}

.alert-list {
  margin: 0;
  padding-left: 1.5rem;
  color: #7f1d1d;
  font-size: 0.95rem;
}

.alert-list li {
  margin-bottom: 0.35rem;
}

/* ========== PERSON TYPE SELECTOR ========== */
.person-type-section {
  background: linear-gradient(135deg, rgba(168, 82, 0, 0.02) 0%, rgba(184, 150, 15, 0.02) 100%);
}

.person-type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1.25rem;
  margin: 1.5rem 0;
}

.person-type-card {
  position: relative;
  background: #ffffff;
  border: 2px solid var(--border-light);
  border-radius: 12px;
  padding: 1.5rem;
  cursor: pointer;
  text-align: center;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  user-select: none;
}

.person-type-card input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.person-type-card:hover {
  border-color: var(--maroon);
  box-shadow: 0 4px 12px rgba(168, 82, 0, 0.1);
}

.person-type-card input:checked + .card-icon + .card-label + .card-description {
  /* Selector for checked state */
}

.person-type-card input:checked ~ * {
  /* General indicator that this is checked */
}

.person-type-card input:checked + .card-icon {
  transform: scale(1.15);
}

/* Apply checked styling to card */
.person-type-card input:checked {
  /* Checked marker */
}

/* Better: use attribute selector */
.person-type-card input:checked + .card-icon + .card-label + .card-description ~ label::after {
  content: "✓";
}

/* Even better approach: modify the entire card */
.person-type-card {
  position: relative;
}

.person-type-card input:checked + .card-icon {
  transform: scale(1.15);
}

.person-type-card input:checked + .card-icon + .card-label {
  color: var(--maroon);
  font-weight: 600;
}

.person-type-card input:checked + .card-icon + .card-label + .card-description {
  color: var(--text-muted);
}

/* Full card checked styling */
.person-type-card input:checked ~ div:last-child::after {
  display: none;
}

/* Actually: update the whole card styling on input:checked */
.person-type-card input:checked {
  /* Signal to style the label */
}

.person-type-card:has(input:checked) {
  border-color: var(--maroon);
  background: linear-gradient(135deg, rgba(168, 82, 0, 0.04), rgba(168, 82, 0, 0.02));
  box-shadow: 0 4px 12px rgba(168, 82, 0, 0.15), inset 0 0 0 1px var(--maroon);
}

.person-type-card:has(input:checked) .card-icon {
  transform: scale(1.15);
  animation: pulse 0.4s ease;
}

.person-type-card:has(input:checked) .card-label {
  color: var(--maroon);
  font-weight: 700;
}

.card-icon {
  font-size: 2.2rem;
  line-height: 1;
  transition: transform 0.3s ease;
}

.card-label {
  font-weight: 600;
  color: var(--ink);
  font-size: 1rem;
  transition: color 0.3s ease;
}

.card-description {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 400;
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1.15); }
}

/* ========== RELATIONSHIP FIELD ========== */
.relationship-field {
  background: linear-gradient(135deg, rgba(184, 150, 15, 0.03), rgba(184, 150, 15, 0.01));
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 1.25rem;
  margin-top: 1.5rem;
  animation: slideDown 0.3s ease;
}

.relationship-field.hidden {
  display: none;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========== GENDER OPTIONS ========== */
.gender-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}

.gender-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: #ffffff;
  border: 2px solid var(--border-light);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  user-select: none;
}

.gender-option input[type="radio"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--maroon);
}

.gender-option:hover {
  border-color: var(--maroon);
  background: #fff8f0;
}

.gender-option:has(input:checked) {
  border-color: var(--maroon);
  background: linear-gradient(135deg, rgba(168, 82, 0, 0.05), rgba(168, 82, 0, 0.02));
  font-weight: 600;
  color: var(--maroon);
}

/* ========== DATE SYSTEM ========== */
.date-system-selector {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.date-system-option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 1.2rem;
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  flex: 1;
  font-weight: 500;
}

.date-system-option input[type="radio"] {
  accent-color: var(--maroon);
}

.date-system-option:hover {
  border-color: var(--maroon);
}

.date-system-option:has(input:checked) {
  border-color: var(--maroon);
  background: rgba(168, 82, 0, 0.05);
  color: var(--maroon);
  font-weight: 600;
}

/* ========== DATE FIELDS ========== */
.date-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}

.date-fields.hidden {
  display: none;
}

.date-conversion-note {
  background: linear-gradient(135deg, #fff8f0, #faf5d5);
  border: 1px solid #edd45a;
  border-radius: 8px;
  padding: 1rem;
  margin-top: 1rem;
  font-size: 0.95rem;
  color: #725a08;
}

.date-conversion-note.hidden {
  display: none;
}

/* ========== TIME FIELDS ========== */
.time-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.time-select {
  text-align: center;
  font-weight: 500;
}

.time-display {
  background: linear-gradient(135deg, rgba(168, 82, 0, 0.05), rgba(168, 82, 0, 0.02));
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--maroon);
  margin-top: 1rem;
}

/* ========== LOCATION CASCADE ========== */
.location-cascades {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1.25rem;
  margin: 1.5rem 0;
}

.location-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 1rem;
  background: linear-gradient(135deg, #fff8f0, #fdfbf0);
  border: 1px solid #edd45a;
  border-radius: 8px;
  color: #725a08;
  font-size: 0.95rem;
  margin-top: 1rem;
}

.meta-icon {
  font-size: 1.3rem;
}

/* ========== ADVANCED OPTIONS ========== */
.advanced-options {
  margin-top: 1.5rem;
}

.advanced-toggle {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.75rem;
  border-radius: 6px;
  transition: all 0.3s ease;
  user-select: none;
}

.advanced-toggle:hover {
  color: var(--maroon);
  background: #fff8f0;
}

.advanced-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1.25rem;
  margin-top: 1rem;
  padding: 1rem;
  background: #fff8f0;
  border-radius: 8px;
}

/* ========== SUMMARY SECTION ========== */
.summary-section {
  background: linear-gradient(135deg, rgba(168, 82, 0, 0.03), rgba(184, 150, 15, 0.02));
  border: 2px solid var(--gold);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
  padding: 1.5rem;
  background: #ffffff;
  border-radius: 10px;
  border: 1px solid var(--border-light);
}

.summary-item {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.summary-label {
  font-weight: 600;
  color: var(--maroon);
  font-size: 0.9rem;
}

.summary-value {
  font-weight: 500;
  color: var(--ink);
  font-size: 1rem;
}

/* ========== BUTTONS ========== */
.btn-primary, .primary, button[type="submit"] {
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 0.8rem 1.6rem;
  background: linear-gradient(135deg, #ff9500 0%, #e67e00 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(230, 126, 0, 0.24);
  letter-spacing: 0.02em;
}

.btn-primary:hover, .primary:hover, button[type="submit"]:hover {
  transform: translateY(-2px);
  background: linear-gradient(135deg, #e67e00 0%, #cc6a00 100%);
  box-shadow: 0 6px 16px rgba(230, 126, 0, 0.34);
}

.btn-primary:active, .primary:active, button[type="submit"]:active {
  transform: translateY(0);
}

.btn-primary:disabled, .primary:disabled, button[type="submit"]:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-lg {
  width: 100%;
  padding: 1.2rem 2rem;
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
}

.btn-icon {
  font-size: 1.4rem;
}

.btn-text {
  letter-spacing: 0.03em;
}

/* ========== LOADING INDICATOR ========== */
.loading-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  padding: 2rem;
  background: linear-gradient(135deg, rgba(168, 82, 0, 0.05), rgba(184, 150, 15, 0.05));
  border-radius: 10px;
  margin-top: 1.5rem;
  text-align: center;
}

.loading-indicator.hidden {
  display: none;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(168, 82, 0, 0.2);
  border-top-color: var(--maroon);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--maroon);
}

.loading-subtext {
  font-size: 0.95rem;
  color: var(--text-muted);
}

/* ========== FOOTER ========== */
.footer {
  background: linear-gradient(135deg, rgba(168, 82, 0, 0.08), rgba(184, 150, 15, 0.08));
  border-top: 2px solid var(--gold);
  padding: 2rem 1.5rem;
  text-align: center;
  margin-top: auto;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.footer-content {
  max-width: 800px;
  margin: 0 auto;
}

.footer-content p {
  margin: 0.5rem 0;
}

.footer-link {
  color: var(--maroon);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.3s ease;
}

.footer-link:hover {
  color: var(--gold);
  text-decoration: underline;
}

/* ========== UTILITY CLASSES ========== */
.hidden {
  display: none !important;
}

/* ========== RESPONSIVE DESIGN ========== */
@media (max-width: 768px) {
  .hero {
    padding: 2rem 1.25rem;
  }

  .hero h1 {
    font-size: 1.8rem;
  }

  .form-container {
    padding: 1.5rem 0.75rem;
  }

  .form-section {
    padding: 1.5rem;
    margin-bottom: 1.5rem;
  }

  .form-section h2 {
    font-size: 1.2rem;
  }

  .person-type-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }

  .time-fields {
    grid-template-columns: repeat(2, 1fr);
  }

  .location-cascades {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .topbar {
    padding: 0.75rem 1rem;
    gap: 0.5rem;
  }

  .brand {
    font-size: 1.5rem;
  }

  .brand img { height: 32px; max-width: 155px; }

  .brand-text {
    display: none;
  }

  .hero {
    padding: 1.5rem 1rem;
  }

  .hero h1 {
    font-size: 1.5rem;
  }

  .hero-requirements {
    grid-template-columns: 1fr;
  }

  .form-section {
    padding: 1.25rem;
  }

  .form-section h2 {
    font-size: 1.1rem;
  }

  .person-type-grid {
    grid-template-columns: 1fr;
  }

  .card-label {
    font-size: 0.9rem;
  }

  .btn-lg {
    font-size: 1rem;
    padding: 1rem 1.5rem;
  }

  .footer {
    padding: 1.5rem 1rem;
  }
}

/* ========== REPORT PAGES (unchanged from original) ========== */
.ready-banner { margin:1rem; padding:.6rem 1rem; background:#eaf5e6; border:1px solid #86b06b; border-radius:8px; font-weight:bold }
.result-overview{width:min(1120px,calc(100% - 2rem));margin:1.2rem auto 0;padding:1.35rem;background:var(--theme-paper);border:1px solid color-mix(in srgb,var(--theme-border) 58%,transparent);border-radius:.8rem;box-shadow:0 .45rem 1.4rem rgba(168,82,0,.08)}
.result-overview-head{display:flex;gap:1.2rem;justify-content:space-between;align-items:flex-start}.result-overview .eyebrow{margin:0 0 .35rem;color:var(--theme-primary);font-size:.8rem;font-weight:800;letter-spacing:.08em}.result-overview h1{margin:0;color:var(--theme-primary);font-size:1.6rem}.result-overview-head p:not(.eyebrow){margin:.35rem 0 0;color:var(--theme-muted)}
.result-actions{display:flex;gap:.55rem;flex-wrap:wrap}.result-actions button,.result-actions a,.result-section-nav button{border:1px solid var(--theme-primary);border-radius:.35rem;padding:.56rem .75rem;font:inherit;font-weight:700;text-decoration:none;cursor:pointer}.result-actions button{background:var(--theme-primary);color:#fff}.result-actions a,.result-section-nav button{color:var(--theme-primary);background:transparent}.result-actions a:hover,.result-section-nav button:hover{background:rgba(168,82,0,.08)}
.result-summary-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:.7rem;margin:1.15rem 0}.result-summary-grid div{padding:.75rem;border:1px solid rgba(0,140,58,.35);border-radius:.45rem;background:#fff}.result-summary-grid dt{font-size:.82rem;color:var(--theme-muted)}.result-summary-grid dd{margin:.2rem 0 0;color:var(--theme-primary);font-weight:700}.result-section-nav{display:flex;gap:.5rem;flex-wrap:wrap;border-top:1px solid rgba(0,140,58,.3);padding-top:1rem}
.pages { display:flex; flex-wrap:wrap; gap:1.25rem; justify-content:center; padding:1rem }
.page.a4 {
  background:linear-gradient(180deg, #f8eedf 0%, #f4e9d7 100%);
  width:210mm;
  height:297mm;
  min-height:297mm;
  padding:10mm 15mm;
  box-shadow:0 2px 10px rgba(67,38,16,.15);
  overflow:hidden;
  break-after:page;
  page-break-after:always;
}
.page.a4 > * { break-inside:avoid; page-break-inside:avoid; }
.reference-frame { position:relative; border:3px solid var(--theme-chart-line); outline:1px solid rgba(120, 42, 28, 0.85); outline-offset:-9px; background:rgba(255,255,255,0.08); }
.reference-frame::before,.reference-frame::after { color:var(--theme-chart-line); font-size:19px; font-weight:bold; line-height:1.55; position:absolute; top:7mm; bottom:7mm; width:7mm; overflow:hidden; content:"卐\A 卐\A 卐\A 卐\A 卐\A 卐\A 卐\A 卐\A 卐\A 卐\A 卐\A 卐\A 卐"; white-space:pre; }
.reference-frame::before { left:2.5mm }.reference-frame::after { right:2.5mm }
.page-head { text-align:center; border-bottom:2px solid var(--theme-chart-line); padding:.2rem 0 .4rem; margin-bottom:.55rem }
.reference-chart-head { padding:0 0 .22rem; margin-bottom:.3rem; }
.reference-chart-head h1 { color:var(--theme-primary); text-decoration:underline; font-size:1.5rem; line-height:1.05; }
.reference-chart-head .sub { color:var(--theme-text); font-weight:bold; font-size:.92rem; }
.ganesh { color:var(--theme-primary); font-weight:bold }
.page-head h1 { font-size:1.45rem; color:var(--theme-primary); margin:.1em 0 } .page-head .sub { color:var(--theme-text); font-size:.78rem }
.page-footer { text-align:center; color:var(--theme-primary); font-size:.82rem; font-weight:bold; margin-top:.25rem; letter-spacing:.03em }
.birth-reference-page .devotional-head { border-bottom:1px solid var(--green); margin-bottom:1.2mm; }
.birth-reference-page .traditional-body { break-inside:avoid; page-break-inside:avoid; }
.ganesh-image { display:block; width:25mm; height:25mm; margin:0 auto 1mm; object-fit:contain; }
.birth-reference-page .ganesh { color:var(--gold); font-size:1.05rem; }
.birth-reference-page .invocation { color:var(--gold); font-size:.93rem; font-weight:700; line-height:1.25; margin:.7mm 0; }
.birth-reference-page .page-head h1 { display:none; }
.traditional-body { padding:0 6mm; color:#1e3695; font-size:.79rem; line-height:1.26; }
.traditional-body p { margin:0 0 1.1mm; break-inside:avoid; }
.traditional-body p:nth-child(2n) { color:var(--ink); }
.traditional-body br + br { display:none; }
.generated-by-sky { color:var(--gold); }
.generated-by-sky span { color:var(--ink); font-weight:400; }

.graha-table,.detail-table,.bhava-table,.dasha-table { width:100%; border-collapse:collapse; font-size:.82rem; margin:.35rem 0 .5rem }
.chart-reference-page .table-scroll,
.chart-reference-page .calc-info-strip,
.chart-reference-page .chart-grid { break-inside:avoid; page-break-inside:avoid; }
.graha-table th,.detail-table th { background:var(--theme-table-head); border:1px solid var(--green); padding:.25rem .42rem; text-align:left; color:var(--ink) }
.graha-table td,.detail-table td,.bhava-table td,.dasha-table td { border:1px solid var(--green); padding:.19rem .42rem }
.graha-table thead th { text-align:center }
.graha-table td.rashi-dms { color:var(--red); font-weight:bold }
.lagna-row td { background:#e5f1e9; font-weight:bold }
.chart-row { display:flex; gap:1rem; justify-content:center; flex-wrap:wrap }

.chart-grid.ref-grid {
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:2.5mm 4mm;
  margin:.25rem 0;
  padding:2.2mm 2.6mm;
  border:1px solid rgba(122,31,31,.5);
  background:rgba(255,255,255,0.12);
  break-inside:avoid;
  page-break-inside:avoid;
}
.chart-grid.ref-grid figure.chart {
  min-width:0;
  margin:0;
  padding:0;
  text-align:center;
  break-inside:avoid;
  page-break-inside:avoid;
}
.chart-grid.ref-grid figure.chart figcaption {
  min-height:5.2mm;
  margin:0 0 .5mm;
  color:var(--theme-primary);
  font-size:1.05rem;
  font-weight:700;
  line-height:1.1;
}
.chart-grid.ref-grid svg.north-chart {
  display:block;
  width:min(100%, 75mm);
  height:auto;
  aspect-ratio:1 / 1;
  margin:0 auto;
  overflow:hidden;
}

.calc-info-strip { width:100%; border-collapse:collapse; font-size:.82rem; margin:.25rem 0 .3rem }
.calc-info-strip td { border:1px solid var(--green); padding:.22rem .45rem; color:var(--red); font-weight:bold }
.calc-info-strip .sidhanta { text-align:center; font-weight:bold; background:#e5f1e9; color:var(--red) }
.calc-info-strip .calc-values { display:flex; justify-content:space-between; gap:.45rem; white-space:nowrap; font-size:.76rem; }
.dasham-row td { background:#edf6ef; }

figure.chart { margin:.2rem; text-align:center }
figure.chart figcaption { font-weight:bold; color:#15357a }
svg.north-chart { width:min(100%, 70mm); height:auto; aspect-ratio:1 / 1; display:block; margin:0 auto; overflow:visible }
svg.north-chart text { font-family:'Noto Sans Devanagari','Mangal','Kantipur','Arial',sans-serif }
.sign-num { font-size:13px; fill:#c41d28; font-weight:700 }
.chart-frame { fill:#fffdf5; stroke:#8b1a1a; stroke-width:2px }
.chart-house-lines { stroke:#8b1a1a; stroke-width:1px; fill:none; stroke-linecap:round; stroke-linejoin:round }
.planet-abbr { font-size:12px; fill:#15357a; font-weight:700; paint-order:stroke; stroke:#fffdf5; stroke-width:2.5px; stroke-linejoin:round }
.planet-abbr.node { fill:#8b1a1a }
.lagna-marker { font-size:15px; fill:#8b1a1a; font-weight:700; paint-order:stroke; stroke:#fffdf5; stroke-width:2.5px }
.bhava-num { font-size:13px; fill:#c41d28; font-weight:700 }
.chart-emblem-ring { fill:#f8dc6c; stroke:#c41d28; stroke-width:1.2px }
.chart-emblem { font-size:15px; fill:#c41d28; font-weight:700 }
.bhava-title,.dasha-title { color:var(--maroon); margin:.4rem 0 .2rem }
.detail-table.summary th { width:22% }

.chakra-title { color:var(--blue); text-align:center; font-size:1.15rem; margin:.5rem 0 .18rem; font-weight:700 }
.chakra-table { width:100%; border-collapse:collapse; margin:.3rem auto; font-size:.86rem }
.chakra-table th { background:#e5f1e9; border:2px solid var(--green); color:#171717; padding:.22rem .3rem; font-weight:700; text-align:center }
.chakra-table th.label, .chakra-table td.label { background:#e5f1e9; color:#171717; text-align:center; font-weight:700; white-space:nowrap }
.chakra-table td { border:2px solid var(--green); text-align:center; padding:.16rem .3rem }
.chakra-table td.num { color:var(--red); font-weight:700 }
.chakra-table td.num.running { background:#fdf3d8; }
.chakra-table tr.yoga td { background:#f4faf6 }
.chakra-table tfoot td { border:2px solid var(--green); color:#171717; font-size:.8rem; padding:.26rem .42rem; text-align:center }
.dasha-head h1 { font-size:1.35rem; color:var(--blue); font-weight:700 }
.generated-by-sky { margin-top:.85rem; text-align:center; font-size:.92rem; font-weight:700; color:#8a6d1a; letter-spacing:.02em }
.astrologer-box { margin-top:.3rem; border:2px solid var(--green); padding:.4rem .6rem; background:#f4faf6 }
.astrologer-box .astro-row { display:flex; justify-content:space-between; gap:1rem; padding:.12rem 0; font-size:.86rem; color:var(--ink) }
.astrologer-box .astro-row span { color:#556; }
.astrologer-box .astro-row b { color:var(--blue) }
.devotional-head { padding-top:.2rem }.ganesh-emblem { margin:auto; width:24mm; height:24mm; display:grid; place-items:center; border:2px solid var(--red); color:#d47a1d; font-size:2.8rem; line-height:1; background:#fff8d6 }.invocation { color:#b07a17; font-size:1rem; font-weight:bold; margin:.25rem auto; line-height:1.35 }.generated-by { margin-top:1rem; padding:.45rem .7rem; border:1px solid #b8b8b8; color:var(--blue); font-family:Georgia,serif; font-style:italic; font-size:.88rem }.generated-by span { color:#333; font-family:inherit; font-style:normal }
.footnote { font-size:.72rem; color:#666 }
.report-footer { text-align:center; color:#555; padding:1rem; font-size:.85rem }

/* ========== PRINT / PDF ========== */
@media print {
  body { background:#fff }
  .no-print, .topbar, form, footer:not(.report-footer), details, button { display:none !important }
  .pages { display:block !important; padding:0; gap:0 }
  .page.a4 { box-shadow:none; width:190mm; height:277mm; page-break-after:always; margin:0 auto }
  .hidden { display:block !important; }
}

/* ---------- Report pages ---------- */
.ready-banner { margin:1rem; padding:.6rem 1rem; background:#eaf5e6; border:1px solid #86b06b; border-radius:8px; font-weight:bold }
.pages { display:flex; flex-wrap:wrap; gap:1.25rem; justify-content:center; padding:1rem }
.page.a4 { background:#e8f4ec; width:210mm; min-height:296mm; padding:10mm 15mm; box-shadow:0 2px 10px rgba(0,0,0,.18); overflow:hidden }
.reference-frame { position:relative; border:3px solid var(--green); outline:1px solid #8cc99f; outline-offset:-9px }
.reference-frame::before,.reference-frame::after { color:var(--red); font-size:19px; font-weight:bold; line-height:1.55; position:absolute; top:7mm; bottom:7mm; width:7mm; overflow:hidden; content:"卐\A 卐\A 卐\A 卐\A 卐\A 卐\A 卐\A 卐\A 卐\A 卐\A 卐\A 卐\A 卐"; white-space:pre; }
.reference-frame::before { left:2.5mm }.reference-frame::after { right:2.5mm }
.page-head { text-align:center; border-bottom:2px solid var(--green); padding:.2rem 0 .4rem; margin-bottom:.55rem }
.reference-chart-head { padding:0 0 .22rem; margin-bottom:.3rem; }
.reference-chart-head h1 { color:var(--blue); text-decoration:underline; font-size:1.5rem; line-height:1.05; }
.reference-chart-head .sub { color:#262626; font-weight:bold; font-size:.92rem; }
.ganesh { color:var(--blue); font-weight:bold }
.page-head h1 { font-size:1.45rem; color:var(--blue); margin:.1em 0 } .page-head .sub { color:#37464a; font-size:.78rem }
.page-footer { text-align:center; color:var(--red); font-size:.82rem; font-weight:bold; margin-top:.25rem; letter-spacing:.03em }

.graha-table,.detail-table,.bhava-table,.dasha-table { width:100%; border-collapse:collapse; font-size:.82rem; margin:.35rem 0 .5rem }
.graha-table th,.detail-table th { background:var(--theme-table-head); border:1px solid var(--green); padding:.25rem .42rem; text-align:left; color:var(--ink) }
.graha-table td,.detail-table td,.bhava-table td,.dasha-table td { border:1px solid var(--green); padding:.19rem .42rem }
.graha-table thead th { text-align:center }
.graha-table td.rashi-dms { color:var(--red); font-weight:bold }
.lagna-row td { background:#e5f1e9; font-weight:bold }
.chart-row { display:flex; gap:1rem; justify-content:center; flex-wrap:wrap }

/* Traditional four-chart Kundali panel — presentation only. */
.chart-grid.ref-grid {
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:2.5mm 4mm;
  margin:.25rem 0;
  padding:2.2mm 2.6mm;
  border:1px solid color-mix(in srgb, var(--theme-border) 70%, #777);
  background:color-mix(in srgb, var(--theme-paper) 82%, #fff);
}
.chart-grid.ref-grid figure.chart {
  min-width:0;
  margin:0;
  padding:0;
  text-align:center;
}
.chart-grid.ref-grid figure.chart figcaption {
  min-height:5.2mm;
  margin:0 0 .5mm;
  color:var(--theme-secondary);
  font-size:1.05rem;
  font-weight:700;
  line-height:1.1;
}
.chart-grid.ref-grid svg.north-chart {
  display:block;
  width:min(100%, 75mm);
  height:auto;
  aspect-ratio:1 / 1;
  margin:0 auto;
  overflow:hidden;
}

/* Calc-info strip */
.calc-info-strip { width:100%; border-collapse:collapse; font-size:.82rem; margin:.25rem 0 .3rem }
.calc-info-strip td { border:1px solid var(--green); padding:.22rem .45rem; color:var(--red); font-weight:bold }
.calc-info-strip .sidhanta { text-align:center; font-weight:bold; background:#e5f1e9; color:var(--red) }
.calc-info-strip .calc-values { display:flex; justify-content:space-between; gap:.45rem; white-space:nowrap; font-size:.76rem; }
.dasham-row td { background:#edf6ef; }

figure.chart { margin:.2rem; text-align:center }
figure.chart figcaption { font-weight:bold; color:#15357a }
svg.north-chart { width:min(100%, 70mm); height:auto; aspect-ratio:1 / 1; display:block; margin:0 auto; overflow:visible }
svg.north-chart text { font-family:'Noto Sans Devanagari','Mangal','Kantipur','Arial',sans-serif }
.sign-num { font-size:13px; fill:#c41d28; font-weight:700 }
.chart-frame { fill:#fffdf5; stroke:#8b1a1a; stroke-width:2px }
.chart-house-lines { stroke:#8b1a1a; stroke-width:1px; fill:none; stroke-linecap:round; stroke-linejoin:round }
.planet-abbr { font-size:12px; fill:#15357a; font-weight:700; paint-order:stroke; stroke:#fffdf5; stroke-width:2.5px; stroke-linejoin:round }
.planet-abbr.node { fill:#8b1a1a }
.lagna-marker { font-size:15px; fill:#8b1a1a; font-weight:700; paint-order:stroke; stroke:#fffdf5; stroke-width:2.5px }
.bhava-num { font-size:13px; fill:#c41d28; font-weight:700 }
.chart-emblem-ring { fill:#f8dc6c; stroke:#c41d28; stroke-width:1.2px }
.chart-emblem { font-size:15px; fill:#c41d28; font-weight:700 }
.bhava-title,.dasha-title { color:var(--maroon); margin:.4rem 0 .2rem }
.detail-table.summary th { width:22% }
/* Dasha chakra tables (reference Page 1) — green-bordered, red numerals. */
.chakra-title { color:var(--blue); text-align:center; font-size:1.15rem; margin:.5rem 0 .18rem; font-weight:700 }
.chakra-table { width:100%; border-collapse:collapse; margin:.3rem auto; font-size:.86rem }
.chakra-table th { background:#e5f1e9; border:2px solid var(--green); color:#171717; padding:.22rem .3rem; font-weight:700; text-align:center }
.chakra-table th.label, .chakra-table td.label { background:#e5f1e9; color:#171717; text-align:center; font-weight:700; white-space:nowrap }
.chakra-table td { border:2px solid var(--green); text-align:center; padding:.16rem .3rem }
.chakra-table td.num { color:var(--red); font-weight:700 }
.chakra-table td.num.running { background:#fdf3d8; }
.chakra-table tr.yoga td { background:#f4faf6 }
.chakra-table tfoot td { border:2px solid var(--green); color:#171717; font-size:.8rem; padding:.26rem .42rem; text-align:center }
.dasha-head h1 { font-size:1.35rem; color:var(--blue); font-weight:700 }
.generated-by-sky { margin-top:.85rem; text-align:center; font-size:.92rem; font-weight:700; color:#8a6d1a; letter-spacing:.02em }
.astrologer-box { margin-top:.3rem; border:2px solid var(--green); padding:.4rem .6rem; background:#f4faf6 }
.astrologer-box .astro-row { display:flex; justify-content:space-between; gap:1rem; padding:.12rem 0; font-size:.86rem; color:var(--ink) }
.astrologer-box .astro-row span { color:#556; }
.astrologer-box .astro-row b { color:var(--blue) }
.devotional-head { padding-top:.2rem }.ganesh-emblem { margin:auto; width:24mm; height:24mm; display:grid; place-items:center; border:2px solid var(--red); color:#d47a1d; font-size:2.8rem; line-height:1; background:#fff8d6 }.invocation { color:#b07a17; font-size:1rem; font-weight:bold; margin:.25rem auto; line-height:1.35 }.generated-by { margin-top:1rem; padding:.45rem .7rem; border:1px solid #b8b8b8; color:var(--blue); font-family:Georgia,serif; font-style:italic; font-size:.88rem }.generated-by span { color:#333; font-family:inherit; font-style:normal }
.footnote { font-size:.72rem; color:#666 }
.report-footer { text-align:center; color:#555; padding:1rem; font-size:.85rem }

/* Kundali result tables: never squeeze Devanagari DMS on narrow screens. */
.table-scroll { overflow-x:auto; -webkit-overflow-scrolling:touch; }
.table-scroll table { min-width:34rem; }
.graha-table td.rashi-dms { white-space:nowrap; }

/* Mobile: one page at a time handled via JS page switching; preserve the
   internal A4 composition while scaling the sheet to the viewport. */
@media (max-width:900px){
  .pages{padding:.5rem}
  .page.a4{width:100%;height:auto;min-height:0}
  .page.a4 .traditional-body{font-size:clamp(.62rem,2.5vw,.79rem)}
  .page.a4 .chart-grid.ref-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:2mm;padding:2mm}
  .page.a4 .chart-grid.ref-grid svg.north-chart{width:min(100%,42vw)}
}
@media (max-width:650px){
  .result-overview{width:calc(100% - 1rem);padding:1rem}.result-overview-head{flex-direction:column}.result-summary-grid{grid-template-columns:1fr 1fr}.result-section-nav{display:grid;grid-template-columns:1fr}.result-section-nav button{text-align:left}
  .chart-grid.ref-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:2mm; padding:2mm; }
  .chart-grid.ref-grid figure.chart figcaption { font-size:1rem; }
  .chart-grid.ref-grid svg.north-chart { width:100%; }
  .chart-grid.ref-grid figure.chart figcaption { font-size:.78rem; }
  .planet-abbr { font-size:10px; }
  .calc-info-strip .calc-values { flex-wrap:wrap; white-space:normal; }
}

/* ---------- Print / PDF: exactly three A4 portrait pages ---------- */
@media print {
  @page { size:A4 portrait; margin:0; }
  body { background:#fff }
  .no-print, .topbar, form, footer:not(.report-footer), details, button { display:none !important }
  .pages { display:block !important; padding:0; gap:0 }
  .page.a4 {
    box-shadow:none;
    width:210mm;
    height:297mm;
    min-height:297mm;
    padding:10mm 15mm;
    margin:0;
    break-after:page;
    page-break-after:always;
  }
  .page.a4:last-child { break-after:auto; page-break-after:auto; }
  .hidden { display:block !important }   /* all three pages always print */
}

/* ---------- Page 2 fit: keep all 4 charts inside ONE A4 sheet ----------
   Scoped to .chart-reference-page (Page 2) only. This tunes the graha
   table / calc-info strip / chart grid spacing so the २×२ grid (लग्न,
   राशि, नवमांश, भाव) fits fully within the A4 height with no clipping.
   Chart geometry/SVG content is untouched. */
.chart-reference-page .reference-chart-head { padding-bottom:.18rem; margin-bottom:.2rem; }
.chart-reference-page .reference-chart-head h1 { font-size:1.28rem; line-height:1.05; }
.chart-reference-page .reference-chart-head .sub { font-size:.85rem; line-height:1.25; }
.chart-reference-page .graha-table,
.chart-reference-page .calc-info-strip { font-size:.76rem; margin:.25rem 0 .35rem; }
.chart-reference-page .graha-table th,
.chart-reference-page .graha-table td { padding:.12rem .5rem; }
.chart-reference-page .calc-info-strip td { padding:.14rem .45rem; }
.chart-reference-page .calc-info-strip .calc-values { font-size:.7rem; }
.page.a4.chart-reference-page .chart-grid.ref-grid { gap:2.2mm 4mm; padding:1.8mm 2.6mm; }
.page.a4.chart-reference-page .chart-grid.ref-grid figure.chart figcaption { min-height:4.6mm; margin:0 0 .4mm; font-size:.95rem; line-height:1.05; }
.page.a4.chart-reference-page .chart-grid.ref-grid svg.north-chart { width:min(100%, 60mm); }

/* ========== COUNTRY SELECTOR & LOCATION PANELS ========== */
.country-toggle {
  display: flex;
  gap: 1rem;
  margin: 1rem 0;
  flex-wrap: wrap;
}

.toggle-option {
  flex: 1;
  min-width: 140px;
  position: relative;
  cursor: pointer;
}

.toggle-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-option .toggle-label {
  display: block;
  padding: 0.75rem 1.25rem;
  border: 2px solid var(--border-light);
  border-radius: 8px;
  text-align: center;
  background: #ffffff;
  transition: all 0.3s ease;
  font-weight: 500;
  cursor: pointer;
}

.toggle-option input[type="radio"]:checked + .toggle-label {
  border-color: var(--maroon);
  background: linear-gradient(135deg, rgba(168, 82, 0, 0.05) 0%, rgba(168, 82, 0, 0.02) 100%);
  color: var(--maroon);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(168, 82, 0, 0.1);
}

.toggle-option:hover .toggle-label {
  border-color: var(--maroon);
}

/* Location panels */
.location-panel {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 1.25rem;
  margin: 1rem 0;
  transition: opacity 0.3s ease, max-height 0.3s ease;
  max-height: 1000px;
  overflow: hidden;
}

.location-panel.hidden {
  display: none;
  max-height: 0;
  opacity: 0;
  padding: 0;
  margin: 0;
  border: none;
}

.location-panel .form-group {
  margin-bottom: 1rem;
}

.location-panel .form-group:last-child {
  margin-bottom: 0;
}

/* Advanced options hint */
.advanced-hint {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  font-style: italic;
}

.form-hint {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Report colour bindings. Components consume shared tokens rather than
   carrying their own branding colours, so a future theme is one edit. */
.reference-frame { outline-color:color-mix(in srgb, var(--theme-border) 45%, var(--theme-paper)); }
.page-head .sub { color:var(--theme-muted); }
.generated-by-sky { color:var(--theme-gold); }
.calc-info-strip .sidhanta,
.lagna-row td,
.chakra-table th,
.chakra-table th.label,
.chakra-table td.label { background:var(--theme-surface-soft); }
.chakra-table tr.yoga td { background:color-mix(in srgb, var(--theme-surface-soft) 48%, var(--theme-paper)); }
.chakra-table td.num.running { background:var(--theme-surface-warm); }
.chart-frame { fill:var(--theme-chart-fill); stroke:var(--theme-chart-line); stroke-width:2.4px; }
.chart-house-lines { stroke:var(--theme-chart-line); stroke-width:1.4px; }
.sign-num,
.bhava-num { fill:var(--theme-accent); font-weight:700; }
.planet-abbr { fill:var(--theme-chart-planet); stroke:var(--theme-chart-fill); stroke-width:2.2px; }
.planet-abbr.node,
.lagna-marker { fill:var(--theme-chart-lagna); stroke:var(--theme-chart-fill); stroke-width:2.2px; }
.chart-emblem-ring { fill:var(--theme-chart-emblem); stroke:var(--theme-chart-line); stroke-width:1.5px; }
.chart-emblem { fill:var(--theme-chart-line); font-size:18px; }
.chakra-table th,
.chakra-table th.label,
.chakra-table td.label,
.chakra-table tfoot td { color:var(--theme-text); }
