/* =====================================================================
   Vedic Star Birthday - Royal Vedic Astral theme
   --------------------------------------------------------------------
   Palette inspired by Brahma Muhurta (the deep navy hours before dawn)
   with gold accents and cream text. Typography pairs Playfair Display
   (serif headlines) with Inter (utility body & forms).
   ===================================================================== */

:root {
  /* Surfaces */
  --surface: #16130b;
  --surface-low: #1f1b13;
  --surface-lowest: #110e07;
  --surface-container: #231f17;
  --surface-high: #2d2a21;
  --surface-highest: #38342b;

  /* Card glass effect */
  --card-bg: rgba(30, 31, 75, 0.88);
  --card-border: rgba(212, 175, 55, 0.22);

  /* Gold (primary) */
  --gold: #f2ca50;
  --gold-deep: #d4af37;
  --gold-soft: #ffe088;
  --on-gold: #3c2f00;

  /* Indigo / lavender (secondary) */
  --indigo: #c2c2f2;
  --indigo-deep: #44456e;

  /* Cream text */
  --on-surface: #eae1d4;
  --on-surface-variant: #d0c5af;
  --outline: #99907c;
  --outline-variant: #4d4635;

  /* Semantic */
  --error: #ffb4ab;
  --warn: #ffd584;
  --info: #c2c2f2;

  /* Radii */
  --r-sm: 0.25rem;
  --r:    0.5rem;
  --r-lg: 0.75rem;
  --r-xl: 1.25rem;

  /* Type ramp */
  --font-serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-sans:  'Inter', system-ui, -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;

  /* Spacing */
  --gutter: 24px;
  --container: 800px;
  --stack-sm: 8px;
  --stack-md: 24px;
  --stack-lg: 48px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: var(--font-sans);
  color: var(--on-surface);
  /* Reference cosmic-gradient: radial deep navy → near-black */
  background: radial-gradient(circle at top, #1E1F4B 0%, #0D0E15 100%);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.55;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 16px;
  position: relative;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }

/* =====================================================================
   Material symbols
   ===================================================================== */
.material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-weight: 300;
  font-style: normal;
  font-size: 24px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'liga';
  font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 24;
}

/* =====================================================================
   Top App Bar
   ===================================================================== */
.topbar {
  width: 100%;
  max-width: var(--container);
  padding: 24px var(--gutter);
}
.topbar-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--gold);
  transition: color 0.2s;
}
.brand:hover { color: var(--gold-soft); }
.brand-icon {
  font-size: 32px !important;
  font-variation-settings: 'FILL' 1;
}
.brand-name {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 24px;
  letter-spacing: 0.01em;
}
@media (max-width: 540px) {
  .brand-name { display: none; }
}
.nav-links {
  display: flex;
  gap: 24px;
  list-style: none;
}
.nav-links a {
  color: var(--on-surface-variant);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.05em;
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--gold); }

/* =====================================================================
   Main
   ===================================================================== */
.main {
  width: 100%;
  max-width: var(--container);
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-grow: 1;
  padding-bottom: var(--stack-lg);
}

/* =====================================================================
   Hero
   ===================================================================== */
.hero {
  text-align: center;
  margin: 24px 0 40px;
  padding: 0 16px;
}
.hero-icon {
  font-size: 56px !important;
  color: var(--gold);
  opacity: 0.85;
  margin-bottom: 12px;
  filter: drop-shadow(0 0 24px rgba(242, 202, 80, 0.35));
  font-variation-settings: 'FILL' 1;
}
.hero-title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: clamp(28px, 5vw, 36px);
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--on-surface);
  margin-bottom: 12px;
}
.hero-sub {
  font-size: 16px;
  color: var(--on-surface-variant);
  max-width: 560px;
  margin: 0 auto 20px;
  line-height: 1.6;
}
/* Live backend status pill */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(242, 202, 80, 0.25);
  background: rgba(242, 202, 80, 0.05);
  transition: border-color 0.3s, background 0.3s;
}
.status-pill[data-state="online"] {
  border-color: rgba(74, 222, 128, 0.35);
  background: rgba(74, 222, 128, 0.06);
}
.status-pill[data-state="offline"] {
  border-color: rgba(255, 100, 100, 0.35);
  background: rgba(255, 100, 100, 0.06);
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fbbf24;
  box-shadow: 0 0 8px #fbbf24;
  animation: dotPulse 1.4s ease-in-out infinite;
}
.status-pill[data-state="online"] .status-dot {
  background: #4ade80;
  box-shadow: 0 0 8px #4ade80;
  animation: none;
}
.status-pill[data-state="offline"] .status-dot {
  background: #f87171;
  box-shadow: 0 0 8px #f87171;
  animation: none;
}
@keyframes dotPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.5; transform: scale(0.85); }
}
.status-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--gold);
  text-transform: uppercase;
}
.status-pill[data-state="online"] .status-label  { color: #86efac; }
.status-pill[data-state="offline"] .status-label { color: #fda4a4; }

/* =====================================================================
   The Soul Card (glass panel)
   ===================================================================== */
.card {
  position: relative;
  width: 100%;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--r-xl);
  padding: 32px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 10px 40px rgba(212, 175, 55, 0.12),
              0 2px 10px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}
@media (min-width: 720px) {
  .card { padding: 40px; }
}
.card-lotus {
  position: absolute;
  right: -40px;
  bottom: -60px;
  font-size: 280px !important;
  color: var(--gold);
  opacity: 0.04;
  pointer-events: none;
  transform: rotate(-12deg);
}

/* =====================================================================
   Notice / info banner
   ===================================================================== */
.notice {
  display: flex;
  gap: 12px;
  padding: 16px 18px;
  margin-bottom: 28px;
  background: rgba(194, 194, 242, 0.06);
  border: 1px solid rgba(194, 194, 242, 0.18);
  border-radius: var(--r-lg);
  position: relative;
  z-index: 1;
}
.notice-icon {
  font-size: 22px !important;
  color: var(--indigo);
  flex-shrink: 0;
  margin-top: 2px;
}
.notice p {
  font-size: 15px;
  color: var(--on-surface);
  line-height: 1.55;
}
.notice strong { color: var(--indigo); font-weight: 600; }

/* =====================================================================
   Form
   ===================================================================== */
form {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.label {
  display: block;
  color: var(--on-surface-variant);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.label-sm {
  display: block;
  color: var(--outline);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.req { color: var(--error); margin-left: 2px; }

.control {
  width: 100%;
  background: var(--surface-lowest);
  border: 1px solid var(--outline-variant);
  border-radius: var(--r-lg);
  color: var(--on-surface);
  padding: 13px 16px;
  font-size: 15px;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  -webkit-appearance: none;
  appearance: none;
}
.control:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(242, 202, 80, 0.18);
  background: rgba(30, 25, 10, 0.9);
}
input[type="number"].control::-webkit-inner-spin-button,
input[type="number"].control::-webkit-outer-spin-button {
  -webkit-appearance: none; margin: 0;
}

.select-wrap { position: relative; }
.select-wrap .select-chevron {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--on-surface-variant);
  font-size: 22px !important;
}
.select-wrap .control {
  padding-right: 44px;
}

.hint {
  font-size: 12px;
  color: var(--outline);
  margin-top: 8px;
  line-height: 1.5;
}
.hint.callout {
  background: rgba(212, 175, 55, 0.08);
  border-left: 3px solid var(--gold-deep);
  color: var(--on-surface-variant);
  padding: 10px 12px;
  border-radius: var(--r);
  margin-top: 10px;
}

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: 1fr; }
.grid-3 { grid-template-columns: 1fr; }
@media (min-width: 600px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr 1fr; }
}

/* Ornamental divider */
.divider {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 0;
}
.divider::before, .divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--outline-variant), transparent);
}
.divider-glyph {
  color: var(--gold);
  font-size: 18px !important;
  opacity: 0.7;
}

/* Custom location panel */
.custom-location {
  display: none;
  margin-top: 4px;
  padding: 16px;
  background: var(--surface-lowest);
  border: 1px dashed var(--outline-variant);
  border-radius: var(--r-lg);
}
.custom-location.show { display: block; }

/* =====================================================================
   Primary button - Calculate
   ===================================================================== */
.submit-wrap { padding-top: 8px; }

.btn-primary {
  position: relative;
  width: 100%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 24px;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 20px;
  color: var(--on-gold);
  background: linear-gradient(90deg, #d4af37 0%, #f2ca50 50%, #d4af37 100%);
  background-size: 200% 100%;
  border: none;
  border-radius: var(--r-lg);
  box-shadow: 0 10px 30px rgba(212, 175, 55, 0.22),
              inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: transform 0.2s, box-shadow 0.25s, background-position 0.4s;
  letter-spacing: 0.01em;
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 38px rgba(212, 175, 55, 0.34),
              inset 0 1px 0 rgba(255, 255, 255, 0.4);
  background-position: 100% 0;
}
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.btn-icon {
  font-size: 22px !important;
  font-variation-settings: 'FILL' 1;
}
.btn-shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.35) 50%, transparent 100%);
  transform: translateX(-100%);
  transition: transform 1s ease-in-out;
  pointer-events: none;
}
.btn-primary:hover .btn-shine { transform: translateX(100%); }

/* =====================================================================
   Loader
   ===================================================================== */
.loader {
  display: none;
  text-align: center;
  margin-top: 28px;
  color: var(--on-surface-variant);
  position: relative;
  z-index: 1;
}
.loader.show { display: block; }
.spinner {
  width: 40px; height: 40px;
  border: 3px solid rgba(212, 175, 55, 0.18);
  border-top-color: var(--gold);
  border-radius: 50%;
  margin: 0 auto 12px;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* =====================================================================
   Results
   ===================================================================== */
.results {
  display: none;
  margin-top: 32px;
  position: relative;
  z-index: 1;
}
.results.show { display: block; animation: fadeUp 0.45s ease; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.result-card {
  background: linear-gradient(180deg, #f8e9b8 0%, #f2ca50 100%);
  color: #2a200a;
  padding: 28px 28px 24px;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  text-align: center;
  position: relative;
}
.result-eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.75;
  margin-bottom: 8px;
}
.result-date {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: clamp(28px, 5vw, 40px);
  line-height: 1.1;
  letter-spacing: -0.01em;
}
.result-day {
  margin-top: 8px;
  font-size: 16px;
  font-weight: 500;
  opacity: 0.85;
}

.result-body {
  background: var(--surface-lowest);
  border: 1px solid var(--outline-variant);
  border-top: none;
  border-radius: 0 0 var(--r-xl) var(--r-xl);
  padding: 20px 24px 24px;
  color: var(--on-surface-variant);
}
.rule-summary { font-size: 14px; line-height: 1.6; margin-bottom: 10px; }
.rule-summary strong { color: var(--on-surface); }

.occurrences {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed var(--outline-variant);
}
.occurrences h4 {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--outline);
  margin-bottom: 10px;
}
.occurrences ul {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}
.occurrences li {
  background: var(--surface);
  border: 1px solid var(--outline-variant);
  padding: 10px 12px;
  border-radius: var(--r);
  font-size: 14px;
  color: var(--on-surface);
}
.occurrences li .day {
  display: block;
  color: var(--outline);
  font-size: 11px;
  margin-top: 2px;
}
.occurrences li.adhika {
  background: rgba(212, 175, 55, 0.12);
  border-color: rgba(212, 175, 55, 0.5);
}
.occurrences li.adhika .badge-tag {
  display: inline-block;
  font-size: 9px;
  background: var(--gold-deep);
  color: var(--on-gold);
  padding: 2px 6px;
  border-radius: 3px;
  margin-left: 6px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.alert {
  border-radius: var(--r);
  padding: 12px 14px;
  margin-top: 14px;
  font-size: 14px;
  line-height: 1.55;
  border-left-width: 4px;
  border-left-style: solid;
}
.alert.warn  { background: rgba(255, 213, 132, 0.08); border-left-color: var(--warn);  color: var(--warn); }
.alert.error { background: rgba(255, 180, 171, 0.08); border-left-color: var(--error); color: var(--error); }
.alert .title { font-weight: 700; margin-bottom: 4px; }

.note {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px dashed var(--outline-variant);
  font-size: 12px;
  line-height: 1.6;
  color: var(--outline);
}
.note a { color: var(--gold); }

/* =====================================================================
   About / Technical details section
   ===================================================================== */
.about {
  width: 100%;
  margin-top: var(--stack-lg);
}
.about-title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: clamp(22px, 3vw, 28px);
  color: var(--on-surface);
  text-align: center;
  margin-bottom: 28px;
  letter-spacing: -0.01em;
}
.about-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 720px) {
  .about-grid { grid-template-columns: 1fr 1fr; }
  .about-card.span-2 { grid-column: span 2; }
}
.about-card {
  background: rgba(30, 31, 75, 0.55);
  border: 1px solid var(--card-border);
  border-radius: var(--r-lg);
  padding: 20px 22px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.about-card:hover {
  transform: translateY(-2px);
  border-color: rgba(242, 202, 80, 0.4);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}
.about-icon {
  font-size: 28px !important;
  color: var(--gold);
  opacity: 0.85;
  margin-bottom: 10px;
}
.about-card h3 {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 18px;
  color: var(--on-surface);
  margin-bottom: 8px;
}
.about-card p {
  font-size: 14px;
  line-height: 1.65;
  color: var(--on-surface-variant);
}
.about-card p strong { color: var(--on-surface); font-weight: 600; }
.about-card p em { color: var(--gold); font-style: normal; }

/* =====================================================================
   Footer
   ===================================================================== */
.footer {
  width: 100%;
  max-width: var(--container);
  padding: 32px var(--gutter) 40px;
  margin-top: var(--stack-lg);
  text-align: center;
  border-top: 1px solid rgba(153, 144, 124, 0.18);
}
.footer-brand {
  font-family: var(--font-serif);
  color: var(--gold);
  font-weight: 600;
  font-size: 16px;
  opacity: 0.9;
  margin-bottom: 10px;
}
.footer-meta {
  font-size: 12px;
  color: var(--outline);
  letter-spacing: 0.04em;
}
.footer-meta a {
  color: var(--on-surface-variant);
  transition: color 0.2s;
}
.footer-meta a:hover { color: var(--gold); }

/* =====================================================================
   Print
   ===================================================================== */
@media print {
  body { background: #fff; color: #000; }
  .topbar, .footer, .btn-primary, .badge, .card-lotus { display: none !important; }
  .card { box-shadow: none; border: 1px solid #999; padding: 0; }
  .result-card { background: #fff; color: #000; border-bottom: 2px solid #000; }
}
