/* ==========================================================================
   Chart view modes (default vs. comfortable / relaxed)
   Theme-aware: uses the site CSS variables set by the user's theme.
   Default view = untouched. Comfortable view is opt-in via .view-comfortable
   on the .chart-shell wrapper. Preference is persisted in localStorage.
   ========================================================================== */

/* --- View toggle button -------------------------------------------------- */
.chart-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin: 4px 0 8px;
}
.chart-view-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  background: var(--divback);
  color: var(--text);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  line-height: 1;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.chart-view-toggle:hover { border-color: var(--main); }
.chart-view-toggle.active {
  background: var(--main);
  border-color: var(--main);
  color: #fff;
}
.chart-view-toggle svg { width: 16px; height: 16px; display: block; }
.chart-view-toggle .cvt-icon-comfortable { display: none; }
.chart-view-toggle.active .cvt-icon-default { display: none; }
.chart-view-toggle.active .cvt-icon-comfortable { display: block; }

/* --- Year-wise SEO links ------------------------------------------------- */
.chart-year-links {
  margin: 0 0 14px;
  padding: 10px 12px;
  background: var(--divback);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.chart-year-links .cyl-title {
  display: block;
  font-size: 12px;
  font-weight: 700;
  opacity: .75;
  margin-bottom: 6px;
}
.chart-year-links .cyl-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chart-year-links .cyl-item {
  display: inline-block;
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  color: var(--main);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.chart-year-links .cyl-item:hover { border-color: var(--main); }
.chart-year-links .cyl-item.active {
  background: var(--main);
  border-color: var(--main);
  color: #fff;
}

/* ==========================================================================
   COMFORTABLE / RELAXED VIEW
   ========================================================================== */
.chart-shell.view-comfortable .tbl-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: none;
  border-radius: 0;
  background: transparent;
}

.chart-shell.view-comfortable .chart-table {
  border-collapse: separate;
  border-spacing: 6px;
  width: 100%;
}

.chart-shell.view-comfortable .chart-table td,
.chart-shell.view-comfortable .chart-table th {
  border: none !important;
  border-radius: 10px;
  padding: 12px 4px !important;
  vertical-align: middle;
}

/* Header row (day names) — rendered as the first <tr> of <td> cells */
.chart-shell.view-comfortable .chart-table tr:first-child td,
.chart-shell.view-comfortable .chart-table th {
  background: var(--main) !important;
  color: #fff !important;
  font-weight: 700 !important;
  font-size: 14px !important;
  text-transform: uppercase;
  letter-spacing: .3px;
}

/* Body number cells */
.chart-shell.view-comfortable .chart-table td {
  background: color-mix(in srgb, var(--main) 6%, var(--divback));
  color: var(--text);
  font-size: 20px;
  font-weight: 800;
}

/* Alternating column tints for readability (matches reference layout) */
.chart-shell.view-comfortable .chart-table td:nth-child(2n) {
  background: color-mix(in srgb, var(--main) 10%, var(--divback));
}
.chart-shell.view-comfortable .chart-table td:nth-child(3n) {
  background: color-mix(in srgb, var(--main) 4%, var(--divback));
}

/* Date column stays compact & subtle */
.chart-shell.view-comfortable .chart-table td.date,
.chart-shell.view-comfortable .chart-table td:first-child {
  background: color-mix(in srgb, var(--main) 14%, var(--divback)) !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  line-height: 1.25;
  min-width: 64px;
}

/* Jodi (center, large) */
.chart-shell.view-comfortable .chart-table td.jodi-bold {
  font-size: 24px !important;
  font-weight: 900 !important;
}

/* Panel open/close panna digit stacks (small, beside the big jodi) */
.chart-shell[data-chart="panel"].view-comfortable .chart-table td:not(.date):not(.jodi-bold):not(:first-child) {
  font-size: 11px !important;
  font-weight: 600 !important;
  line-height: 1.15;
  opacity: .8;
  min-width: 18px;
}

/* Keep highlighted (red) numbers readable in comfortable view */
.chart-shell.view-comfortable .chart-table .red,
.chart-shell.view-comfortable .chart-table .tred {
  color: #dc143c !important;
}

/* On small screens fall back to horizontal scroll for the table only.
   Min-widths guarantee the cards never overlap or shrink fonts too much. */
@media (max-width: 768px) {
  .chart-shell.view-comfortable .chart-table { min-width: 640px; }
  .chart-shell[data-chart="panel"].view-comfortable .chart-table { min-width: 760px; }
  .chart-shell.view-comfortable .chart-table td { font-size: 18px; }
  .chart-shell.view-comfortable .chart-table td.jodi-bold { font-size: 20px !important; }
}

/* Fallback for browsers without color-mix() support */
@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .chart-shell.view-comfortable .chart-table td { background: var(--divback); }
  .chart-shell.view-comfortable .chart-table td:nth-child(2n) { background: var(--bg); }
  .chart-shell.view-comfortable .chart-table td.date,
  .chart-shell.view-comfortable .chart-table td:first-child { background: var(--bg) !important; }
}
