/* ============================================================
   Jyotish — shared design system ("ink & paper" brand language)
   Derived from the landing page: monospace micro-labels, heavy
   letter-spacing, squared corners, flat surfaces, gold accents.
   Two themes: light (default) and dark, switched by
   <html data-theme="dark"> (see /js/theme.js).
   Page-specific styles stay inline in each template.
   ============================================================ */

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

:root {
  /* paper (light) theme — default */
  --bg:       #f4f1e8;
  --surface:  #fdfbf4;
  --card:     #fdfbf4;
  --border:   rgba(23,20,42,0.14);
  --border-h: rgba(23,20,42,0.34);
  --gold:     #9a6c10;
  --gold-dim: #c9a227;
  --text:     #17142a;
  --muted:    #6f6890;
  --accent:   #5533aa;
  --green:    #1d8a5c;
  --red:      #c0304a;
  --blue:     #3b4fc8;
  --orange:   #b45309;
  --purple:   #7c3aed;
  --cyan:     #0e7490;
  --hover:    rgba(23,20,42,0.04);
  --header-bg: rgba(244,241,232,0.9);
  --btn-ink:  #fdfbf4;
  --shadow:   none;
  --radius:   2px;
  --radius-lg: 2px;
  --transition: 0.16s ease;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

html[data-theme="dark"] {
  --bg:       #100e1b;
  --surface:  #17142a;
  --card:     #17142a;
  --border:   rgba(239,232,214,0.14);
  --border-h: rgba(239,232,214,0.4);
  --gold:     #c9a227;
  --gold-dim: #9a6c10;
  --text:     #efe8d6;
  --muted:    #6f6890;
  --green:    #3dbb84;
  --red:      #e05a74;
  --cyan:     #4fb3cd;
  --hover:    rgba(239,232,214,0.05);
  --header-bg: rgba(16,14,27,0.9);
  --btn-ink:  #100e1b;
}

html { scroll-behavior: smooth; }

body {
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.618;
}

.mono {
  font-family: var(--mono);
}

/* ── Shared app shell ── */
.site-shell {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--header-bg);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.strip {
  display: flex;
  align-items: baseline;
  gap: 18px;
  flex-wrap: wrap;
  padding: 18px 0 10px;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.strip .om {
  color: var(--gold);
  font-size: 15px;
  letter-spacing: 0;
}

.strip .right {
  margin-left: auto;
  display: flex;
  gap: 18px;
  align-items: center;
}

.strip a {
  color: inherit;
  text-decoration: none;
}

.strip a:hover { color: var(--gold); }

.strip-home { font-weight: 700; }

.site-nav {
  display: flex;
  gap: 2px;
  align-items: center;
  flex-wrap: wrap;
  padding: 0 0 14px;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 6px 9px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  border-bottom: 2px solid transparent;
  transition: color var(--transition), background var(--transition), border-color var(--transition);
}

.site-nav a:hover { color: var(--text); background: var(--hover); }
.site-nav a.active { color: var(--gold); border-bottom-color: var(--gold); }

.foot {
  display: flex;
  gap: 10px 24px;
  flex-wrap: wrap;
  align-items: baseline;
  margin-top: 26px;
  padding: 14px 0 28px;
  border-top: 1px solid var(--border);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.foot a {
  color: inherit;
  text-decoration: none;
}

.foot a:hover { color: var(--gold); }

.foot .fine {
  margin-left: auto;
  letter-spacing: 0.04em;
  text-transform: none;
}

@media (max-width: 600px) {
  .strip { gap: 12px; padding-top: 14px; }
  .site-nav { padding-bottom: 12px; }
  .foot { gap: 8px 14px; }
}

/* ── Metro hero ── */
.metro-hero {
  --hero-accent: var(--gold);
  position: relative;
  display: block;
  margin: 6px 0 10px;
}

.metro-hero-copy,
.metro-hero-stack {
  min-width: 0;
}

.metro-hero-copy {
  position: relative;
  overflow: hidden;
  max-height: 150px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(16px, 3vh, 32px) 16px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.metro-hero-copy::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, transparent 0 76%, color-mix(in srgb, var(--hero-accent) 12%, transparent) 76% 100%);
  opacity: 0.7;
  pointer-events: none;
}

.metro-hero-copy::after {
  content: attr(data-glyph);
  position: absolute;
  right: -0.08em;
  bottom: -0.16em;
  font-size: clamp(54px, 9vw, 92px);
  line-height: 1;
  font-weight: 900;
  color: color-mix(in srgb, var(--hero-accent) 14%, transparent);
  pointer-events: none;
}

.metro-kicker {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: baseline;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.metro-kicker strong {
  color: var(--hero-accent);
  font-weight: 700;
}

.metro-headline {
  position: relative;
  z-index: 1;
  margin-top: 7px;
  max-width: none;
  font-size: clamp(22px, 3.6vw, 40px);
  line-height: 0.88;
  letter-spacing: -0.05em;
  font-weight: 900;
  text-transform: uppercase;
  color: transparent;
  -webkit-text-stroke: 1px var(--text);
}

.metro-headline .solid {
  color: var(--text);
  -webkit-text-stroke: 0;
}

.metro-copy {
  position: relative;
  z-index: 1;
  max-width: 162ch;
  margin-top: 16px;
  font-size: 10.5px;
  line-height: 1.4;
  color: var(--muted);
}

.metro-actions {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.metro-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: all var(--transition);
}

.metro-btn:hover {
  border-color: var(--hero-accent);
  color: var(--hero-accent);
  background: color-mix(in srgb, var(--hero-accent) 7%, transparent);
}

.metro-btn.primary {
  background: var(--hero-accent);
  border-color: var(--hero-accent);
  color: var(--btn-ink);
}

.metro-btn.primary:hover {
  filter: brightness(0.95);
  color: var(--btn-ink);
}


.brand {
  font-size: 19px;
  font-weight: 900;
  color: var(--gold);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  text-decoration: none;
}

header nav { display: flex; gap: 2px; align-items: center; flex-wrap: wrap; }
header nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 6px 9px;
  border-radius: 0;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  transition: color var(--transition), background var(--transition);
}
header nav a:hover { color: var(--text); background: var(--hover); }
header nav a.active { color: var(--gold); border-bottom: 2px solid var(--gold); }

/* theme toggle injected by /js/theme.js */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
  padding: 5px 9px;
  margin-left: 8px;
  cursor: pointer;
  border-radius: 0;
  transition: all var(--transition);
}
.theme-toggle:hover { color: var(--gold); border-color: var(--gold); }

/* ── Layout ── */
.container { max-width: 1340px; margin: 0 auto; padding: 0 21px; }

.dash-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 13px;
  padding: 21px 0 16px;
}

.results-title-area h2 {
  font-size: 23px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--gold);
}
.results-meta { font-size: 12px; color: var(--muted); margin-top: 2px; font-family: var(--mono); }
.results-actions { display: flex; gap: 8px; }

.dash-top {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.95fr) minmax(0, 0.72fr);
  gap: 16px;
  align-items: start;
  margin-bottom: 16px;
}
@media (max-width: 1080px) {
  .dash-top { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .dash-top .panchanga-card { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  .dash-top { grid-template-columns: minmax(0, 1fr); }
  .dash-top .form-card { order: -1; }
}

.dash-charts {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}
@media (max-width: 720px) { .dash-charts { grid-template-columns: minmax(0, 1fr); } }

.dash-data {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  margin-bottom: 16px;
}
@media (max-width: 980px) { .dash-data { grid-template-columns: minmax(0, 1fr); } }

/* Generic main + sidebar grid (muhurta and other tool pages) */
.dash-main {
  display: grid;
  grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  margin-bottom: 16px;
}
@media (max-width: 900px) { .dash-main { grid-template-columns: minmax(0, 1fr); } }

.dash-top > *, .dash-charts > *, .dash-data > *, .dash-main > * { min-width: 0; }

/* ── Cards — flat tiles ── */
.panel-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: border-color var(--transition);
}
.panel-card:hover { border-color: var(--border-h); }

.panel-card-header {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
}

.chart-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}

/* ── Key/value side panel (pañcāṅga style) ── */
.pc-list { display: flex; flex-direction: column; }
.pc-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 13px;
  padding: 7px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
}
.pc-row:last-child { border-bottom: none; }
.pc-label {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}
.pc-value { font-weight: 600; color: var(--text); text-align: right; }
.pc-value .pc-sub { display: block; font-weight: 400; font-size: 11px; color: var(--muted); }
.pc-value .pc-left { color: var(--gold); font-size: 11px; font-weight: 600; }
.nak-lord { color: var(--gold); font-weight: 600; font-size: 11px; }

/* ── Forms ── */
.form-card form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 13px;
  padding: 13px 16px 16px;
}
.form-card .form-actions { gap: 8px; }
.form-card .btn { padding: 9px 16px; font-size: 13px; }

.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.form-row { display: flex; gap: 8px; }
.form-row input, .form-row select { flex: 1; min-width: 0; }

input, select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 8px 13px;
  font-size: 14px;
  width: 100%;
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none;
  -webkit-appearance: none;
  box-shadow: none;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,162,39,0.16);
}
input::placeholder { color: var(--muted); opacity: 0.7; }

/* appearance:none above removes the native arrow — draw our own so
   selects don't look like plain text inputs */
select {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5'%3E%3Cpath d='M0 0l4 5 4-5z' fill='%236f6890'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  padding-right: 30px;
}
select option { background: var(--card); color: var(--text); }

input[type="checkbox"] {
  /* restore native rendering — the generic rule's appearance:none would
     otherwise hide the checkmark entirely */
  appearance: auto;
  -webkit-appearance: auto;
  width: 14px; height: 14px;
  padding: 0;
  border: 1px solid var(--border-h);
  background: var(--surface);
  cursor: pointer;
  accent-color: var(--gold);
  flex-shrink: 0;
  box-shadow: none;
}

.form-actions { display: flex; gap: 13px; align-items: flex-end; grid-column: 1 / -1; }

/* ── Buttons — squared, mono, flood on hover ── */
.btn {
  padding: 10px 21px;
  border-radius: 0;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  text-decoration: none;
}
.btn-primary {
  background: var(--gold);
  color: var(--btn-ink);
  box-shadow: none;
}
.btn-primary:hover { background: var(--text); color: var(--bg); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--gold); color: var(--gold); }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 8px 16px;
  font-size: 10.5px;
}
.btn-ghost:hover { color: var(--text); border-color: var(--border-h); }

/* ── Loading ── */
.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(201,162,39,0.25);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Tables ── */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  padding: 8px 13px;
  text-align: left;
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  background: var(--surface);
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--hover); }

tbody td {
  padding: 8px 13px;
  vertical-align: middle;
}

/* ── Location search / suggestions ── */
.location-search-group { position: relative; }
.location-search-wrap { display: flex; gap: 8px; }
.location-search-wrap input { flex: 1; }
.suggestions-dropdown {
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border-h);
  border-radius: 0;
  margin-top: 4px;
  max-height: 200px;
  overflow-y: auto;
  position: absolute;
  z-index: 200;
  left: 0; right: 0;
  box-shadow: 0 8px 21px rgba(0,0,0,0.18);
}
.suggestion-item {
  padding: 8px 13px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.suggestion-item:last-child { border-bottom: none; }
.suggestion-item:hover { background: var(--hover); color: var(--gold); }
.tz-auto-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 21px;
  right: 21px;
  background: var(--surface);
  border: 1px solid var(--border-h);
  border-left: 3px solid var(--gold);
  color: var(--text);
  padding: 13px 21px;
  border-radius: 0;
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.25s ease;
  pointer-events: none;
  z-index: 9999;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* ── Error banner ── */
.error-banner {
  background: rgba(192,48,74,0.08);
  border: 1px solid rgba(192,48,74,0.35);
  border-radius: 0;
  padding: 13px 21px;
  color: var(--red);
  font-size: 13px;
  margin-top: 13px;
  display: none;
}
.error-banner.show { display: block; }

/* ── Footer ── */
footer {
  border-top: 1px solid var(--border);
  padding: 34px;
  text-align: center;
  color: var(--muted);
  font-size: 11px;
  font-family: var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
footer a { color: var(--gold-dim); text-decoration: none; }
footer a:hover { color: var(--gold); }

/* ── Utilities ── */
.hidden { display: none !important; }
.text-gold { color: var(--gold); }
.text-muted { color: var(--muted); }
