/* Jyotishi: chart grid, lede text and print layout. Shell styles come from hegde-ui app.css. */

.lede {
  font-size: 1.05rem;
  margin: 0 0 1rem;
}

.flash.warn {
  border-color: #ecd9a8;
  background: #fbf6e6;
  color: #7a5a14;
}

/* Summary cards: the label sits above the value. */
.stat .label { display: block; }

/* Birth-time "unknown" checkbox under the time input. */
.check {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.35rem;
  font-size: 0.9rem;
}

ul.plain {
  list-style: none;
  margin: 0.5rem 0;
  padding: 0;
}

/* Vimshottari dasha: one collapsible block per Mahadasha. */
details.dasha-md {
  border: 1px solid #d9e0ea;
  border-radius: 4px;
  margin: 0.5rem 0;
  padding: 0.5rem 0.75rem;
  background: #fff;
}

details.dasha-md > summary {
  cursor: pointer;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: baseline;
}

details.dasha-md.is-current {
  border-color: var(--amber, #D97706);
}

.data tr.is-current td,
.data tr.is-current th {
  background: #fbf6e6;
  font-weight: 600;
}

form.inline {
  display: inline;
  margin: 0;
}

/* Place search box on the birth-chart and panchang forms. */
.place-search .search-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.place-search .search-row input {
  flex: 1 1 auto;
  min-width: 0;
}

.place-results {
  list-style: none;
  margin: 0.4rem 0 0;
  padding: 0;
  border: 1px solid #c9d2df;
  border-radius: 4px;
  background: #fff;
  max-height: 16rem;
  overflow-y: auto;
}

.place-results li + li {
  border-top: 1px solid #e5eaf1;
}

.place-results .place-option {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.65rem;
  background: none;
  border: 0;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.place-results .place-option:hover,
.place-results .place-option:focus {
  background: var(--cream, #FBFAF5);
}

.place-results .place-msg {
  padding: 0.5rem 0.65rem;
  color: #5b6777;
}

/* South Indian rasi chart: fixed Rashi positions in a 4x4 grid. */
.rasi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(4, minmax(7.5rem, auto));
  gap: 0;
  border: 2px solid var(--navy, #1F3A5F);
  max-width: 44rem;
  margin: 0 auto;
  background: #fff;
}

.rasi-cell {
  border: 1px solid #c9d2df;
  padding: 0.45rem 0.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
  font-size: 0.9rem;
}

.rasi-sign {
  font-weight: 600;
  color: var(--navy, #1F3A5F);
  font-size: 0.85rem;
}

.rasi-lagna {
  display: inline-block;
  margin-left: 0.25rem;
  padding: 0 0.3rem;
  border-radius: 3px;
  background: var(--amber, #D97706);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  vertical-align: middle;
}

.rasi-planets {
  font-size: 1rem;
  font-weight: 600;
  word-break: break-word;
}

.rasi-center {
  grid-row: 2 / span 2;
  grid-column: 2 / span 2;
  border: 1px solid #c9d2df;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1rem;
  background: var(--cream, #FBFAF5);
}

.chart-head .chart-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 0.75rem 1.5rem;
}

.chart-head .chart-facts > div {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.legal h3 { margin: 1.1rem 0 0.2rem; font-size: 1rem; }
.legal p { margin: 0.2rem 0; max-width: 70ch; }
.check { align-items: flex-start; }
.check input { margin-top: 0.25rem; }

@media print {
  .sidebar,
  .nav-toggle,
  .no-print,
  .main-actions,
  .app-footer .dpdp-links {
    display: none !important;
  }
  .app-shell {
    display: block !important;
  }
  .main {
    margin-left: 0 !important;
    width: 100% !important;
  }
  .panel {
    box-shadow: none !important;
    border: none !important;
    break-inside: avoid;
  }
  .rasi-grid {
    max-width: 16cm;
  }
}

/* Plans page: one card per plan. */
.plans {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.plan {
  border: 1px solid #e3ddd0;
  border-radius: 8px;
  padding: 1rem;
  background: #fff;
}

.plan h3 {
  margin: 0 0 0.25rem;
}

.plan .price {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0.25rem 0 0.5rem;
}

.plan form {
  margin-top: 0.75rem;
}

/* Language menu in the page header. */
.lang-form {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin: 0;
}

.lang-form select {
  min-width: 7.5rem;
}

/* Indian scripts: use a system font that draws the script. No web font files are loaded (CSP font-src 'self'). */
html:lang(hi) body, html:lang(hi) body * { font-family: "Noto Sans Devanagari", "Nirmala UI", "Mangal", "Kohinoor Devanagari", sans-serif; }
html:lang(mr) body, html:lang(mr) body * { font-family: "Noto Sans Devanagari", "Nirmala UI", "Mangal", "Kohinoor Devanagari", sans-serif; }
html:lang(ta) body, html:lang(ta) body * { font-family: "Noto Sans Tamil", "Nirmala UI", "Latha", "Tamil Sangam MN", sans-serif; }
html:lang(te) body, html:lang(te) body * { font-family: "Noto Sans Telugu", "Nirmala UI", "Gautami", "Kohinoor Telugu", sans-serif; }
html:lang(ml) body, html:lang(ml) body * { font-family: "Noto Sans Malayalam", "Nirmala UI", "Kartika", sans-serif; }
html:lang(bn) body, html:lang(bn) body * { font-family: "Noto Sans Bengali", "Nirmala UI", "Vrinda", "Kohinoor Bangla", sans-serif; }
html:lang(gu) body, html:lang(gu) body * { font-family: "Noto Sans Gujarati", "Nirmala UI", "Shruti", sans-serif; }
html:lang(pa) body, html:lang(pa) body * { font-family: "Noto Sans Gurmukhi", "Nirmala UI", "Raavi", sans-serif; }

.lang-bar {
  display: flex;
  justify-content: flex-end;
  margin: 0 0 0.75rem;
}

/* ---- Phones and small tablets ---- */

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

/* The main column is a grid item. Without this, a wide table stretches the whole page sideways. */
.app-shell > .main { min-width: 0; }

.lang-form select {
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--line, #d7dee8);
  background: #fff;
  font: inherit;
  font-size: 0.9rem;
  max-width: 100%;
}

.plans { grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); }

img, svg { max-width: 100%; height: auto; }

@media (max-width: 720px) {
  .main { padding: 1rem 0.85rem 2rem; }

  /* Row 1: menu button and title. Row 2: the page buttons and the language menu. */
  .main-top { flex-wrap: wrap; align-items: center; gap: 0.6rem 0.75rem; margin-bottom: 1rem; }
  .main-top-left { flex: 1 1 10rem; }
  .main-top h1 { font-size: 1.4rem; overflow-wrap: anywhere; }
  .signed-in { overflow-wrap: anywhere; }
  .signed-in-email { display: none; }
  .main-actions { width: 100%; align-items: center; }
  .main-actions .lang-form { margin-left: auto; }

  .panel { padding: 1rem; }
  .panel h2 { font-size: 1.05rem; }

  /* Tap targets about 44px, and 16px text in fields so iOS does not zoom when a field is focused. */
  .btn, .btn-sm { min-height: 2.5rem; }
  .panel input, .panel select, .panel textarea,
  .auth-card input, .auth-card select, .auth-card textarea,
  .lang-form select { font-size: 1rem; min-height: 2.5rem; }
  .panel input[type="checkbox"], .panel input[type="radio"] { min-height: 1.05rem; }
  details > summary { min-height: 2.5rem; }
  .sidebar nav a, .sidebar-foot a { padding-top: 0.6rem; padding-bottom: 0.6rem; }

  /* Wide tables scroll inside .table-wrap (shell rule) instead of widening the page. */
  table.data th, table.data td { padding: 0.55rem 0.45rem; }
  table.data { font-size: 0.9rem; }

  /* The chart list becomes one card per chart. */
  table.data.stack, .stack thead, .stack tbody, .stack tr, .stack td { display: block; width: 100%; }
  .stack thead { display: none; }
  .stack tr { padding: 0.6rem 0; border-bottom: 1px solid var(--line, #d7dee8); }
  .stack tr:last-child { border-bottom: 0; }
  .stack td { border: 0; padding: 0.15rem 0; }
  .stack td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted, #5b6777);
  }
  .stack td.row-actions { display: flex; gap: 0.5rem; margin-top: 0.5rem; }

  .place-search .search-row { flex-wrap: wrap; }
  .place-search .search-row input { flex: 1 1 12rem; }
  .place-results { max-height: 12rem; }

  .chart-head .chart-facts { grid-template-columns: 1fr 1fr; gap: 0.6rem 1rem; }
  .row-actions { flex-wrap: wrap; }

  details.dasha-md { padding: 0.4rem 0.55rem; }
}

@media (max-width: 560px) {
  .auth-body { padding: 1rem; }
  .auth-card { padding: 1.25rem; }

  /* South Indian chart: smaller text so all twelve houses fit a phone screen. */
  .rasi-grid { grid-template-rows: repeat(4, minmax(5.4rem, auto)); }
  .rasi-cell { padding: 0.25rem 0.3rem; font-size: 0.72rem; }
  .rasi-sign { font-size: 0.66rem; overflow-wrap: anywhere; }
  .rasi-lagna { margin-left: 0.15rem; padding: 0 0.2rem; font-size: 0.6rem; }
  .rasi-planets { font-size: 0.78rem; line-height: 1.25; }
  .rasi-center { padding: 0.35rem; font-size: 0.78rem; }

  .chart-head .chart-facts { grid-template-columns: 1fr; }
}

/* Name and tagline above the sign-in and register cards. */
.auth-brand-block { text-align: center; margin: 0 0 1rem; }
.auth-brand {
  margin: 0;
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 2rem;
  color: var(--navy, #1F3A5F);
}
.auth-brand-block .hint { margin: 0.25rem 0 0; }

/* North Indian chart and the chart style switch. */
.north-chart { display: block; width: 100%; max-width: 26rem; height: auto; margin: 0.5rem auto; }
.style-switch { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 0 0 0.75rem; }
@media print { .north-chart { max-width: 14cm; } }

/* Sign-in security page. */
.recovery-codes { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: 0.4rem; padding: 0; list-style: none; }
.recovery-codes code, .totp-secret { font-size: 1rem; letter-spacing: 0.06em; overflow-wrap: anywhere; }
.totp-qr { display: block; background: #fff; padding: 0.25rem; border: 1px solid #d9e0ea; border-radius: 6px; }

/* Sidebar footer: the links wrap inside the 260px column, so Sign out is never clipped. */
.sidebar-foot-actions { flex-wrap: wrap; }
.sidebar-email { flex: 1 1 100%; }
.sidebar-foot-links { flex: 1 1 100%; flex-wrap: wrap; gap: 0.45rem 0.9rem; min-width: 0; }
.sidebar-foot a[href="logout.php"] {
  order: -1;
  width: 100%;
  text-align: center;
  padding: 0.45rem 0.7rem;
  border: 1px solid rgba(217,119,6,0.6);
  border-radius: 4px;
  color: #f0c98a;
  background: rgba(217,119,6,0.12);
}
.sidebar-foot a[href="logout.php"]:hover { background: rgba(217,119,6,0.25); color: #fff; }

/* Desktop sidebar: on a short screen the whole menu scrolls, so no section or link is cut off. */
@media (min-width: 961px) {
  .sidebar { overflow-y: auto; scrollbar-width: thin; }
  .sidebar nav { flex: 0 0 auto; overflow: visible; }
}

/* Captcha (sign-in, sign-up) */
.captcha-box { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.9rem; margin-bottom: 0.4rem; }
.captcha-img { display: inline-block; line-height: 0; border: 1px solid rgba(0,0,0,0.15); border-radius: 6px; overflow: hidden; }
.captcha-svg { display: block; max-width: 100%; height: auto; }
.captcha-refresh { font-size: 0.85rem; }
.captcha input[name="captcha"] { text-transform: uppercase; letter-spacing: 0.15em; }
.captcha-audio { font-size: 0.85rem; }

/* Panchang calendar: today and festival rows, the list of special days. */
table.cal tr.cal-festival td { background: rgba(245, 158, 11, 0.12); }
table.cal tr.cal-today td { box-shadow: inset 0 2px 0 #d97706, inset 0 -2px 0 #d97706; }
table.cal tr.cal-today td:first-child { box-shadow: inset 2px 2px 0 #d97706, inset 0 -2px 0 #d97706; }
.cal-highlights { margin: 0.25rem 0 0; padding-left: 1.2rem; line-height: 1.7; }

/* Chart reading: the short list above the planet table. */
.reading { margin: 0.25rem 0 0.75rem; padding-left: 1.2rem; line-height: 1.7; }

/* Share link shown once after it is made. */
.share-url { width: 100%; margin-top: 0.35rem; font-family: ui-monospace, monospace; font-size: 0.85rem; }
