/* ============================================================
   charts.css — chart wrappers, progress/distribution bars, calendar heatmap
   Migrated verbatim from styles.css — see README.
   ============================================================ */

/* ─── Charts ──────────────────────────────────────────── */
.chart-wrap { position: relative; }
.chart-wrap canvas { max-width: 100% !important; }
/* A canvas must never define layout: Chart.js writes inline sizes measured
   against the container of the moment; if that was wider (pre-collapse grid),
   the stale width would otherwise force the card past the viewport. */
canvas { max-width: 100%; }


/* ─── Progress bars ───────────────────────────────────── */
.progress-bar {
  height: 5px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 4px;
}
.progress-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--accent-blue);
  transition: width 0.6s ease;
}


/* ─── Distribution bars ───────────────────────────────── */
/* Breakdown column fills the card height and stays vertically centred so it
   lines up with the chart beside it instead of bunching at the top. */
.dist-bars {
  display: flex; flex-direction: column; justify-content: center;
  gap: 4px; min-height: 440px;
}
.dist-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.dist-row:last-child { border-bottom: none; }
.dist-label { width: 188px; font-size: 14px; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dist-track { flex: 1; height: 6px; background: var(--border-subtle); border-radius: 3px; overflow: hidden; }
.dist-fill { height: 100%; border-radius: 3px; transition: width 0.7s ease; }
.dist-pct { width: 56px; text-align: right; font-size: 15.5px; font-weight: 400; color: var(--text-primary); flex-shrink: 0; font-variant-numeric: tabular-nums; }
.dist-val { width: 96px; text-align: right; font-family: var(--font-data); font-size: 0.8125rem; color: var(--text-muted); flex-shrink: 0; }


/* ─── Calendar ────────────────────────────────────────── */
.cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.cal-month-label {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: 26px;
  letter-spacing: 0.01em;
  color: var(--text-primary);
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}

.cal-day-header {
  text-align: center;
  font-family: var(--font-data);
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--text-tertiary);
  padding: 4px 2px 8px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
}

.cal-day {
  position: relative;
  min-height: 92px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 3px;
  padding: 8px 7px 7px;
  transition: transform 0.18s cubic-bezier(0.22,0.61,0.36,1), border-color 0.18s ease, background 0.18s ease;
  overflow: hidden;
}

.cal-day:not(.empty):not(.adjacent):hover { border-color: var(--border-default); transform: translateY(-2px); background: var(--bg-elevated); }
/* Days that carry events get a faint warm lift so the month reads at a glance. */
.cal-day.has-events { background: linear-gradient(180deg, rgba(200,169,126,0.05), rgba(200,169,126,0) 60%); }
.cal-day.empty { background: transparent; border: 1px dashed var(--border-subtle); opacity: 0.5; }
/* Adjacent-month days: present but clearly not in play — dimmed number, no
   hover lift, no events. A calendar, not a grid with holes. */
.cal-day.adjacent { background: transparent; border-color: transparent; }
.cal-day.adjacent .day-num { color: var(--text-tertiary); opacity: 0.45; }
.cal-day.weekend:not(.today) { background: rgba(255,255,255,0.012); }
.cal-day.weekend .day-num { color: var(--text-tertiary); }

/* Today: gold ring + the date set in a filled gold chip. */
.cal-day.today {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent), 0 8px 24px -14px rgba(200,169,126,0.5);
}
.day-num {
  font-family: var(--font-data);
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--text-secondary);
  margin-bottom: 5px;
  line-height: 1;
}
.cal-day.today .day-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px; height: 20px;
  padding: 0 5px;
  background: var(--accent);
  color: var(--bg-base);
  border-radius: 10px;
  font-weight: 500;
}

.cal-event {
  font-family: var(--font-data);
  font-size: 0.8125rem;
  letter-spacing: 0.02em;
  padding: 2px 6px 2px 7px;
  border-radius: 2px;
  border-left: 2px solid transparent;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: default;
  transition: filter 0.15s ease;
}
.cal-event:hover { filter: brightness(1.25); }

.ev-earnings { background: rgba(122,155,181,0.16); color: #A6C3D8; border-left-color: var(--ev-earnings); }
.ev-exdiv    { background: rgba(99,192,136,0.15);  color: #84CFA6; border-left-color: var(--ev-exdiv); }
.ev-paydiv   { background: rgba(200,169,126,0.16); color: #D8BC93; border-left-color: var(--ev-paydiv); }

/* ── Phone calendar: a month of ticker chips can't fit 7 columns on a
   390px screen. Cells compress and each event becomes a colour-coded dot;
   the Upcoming Events list right below carries the detail. The legend
   chips (.cal-event-sm) keep their text so the dots stay decipherable. ── */
@media (max-width: 640px) {
  .cal-grid { gap: 3px; }
  .cal-day { min-height: 46px; padding: 5px 5px 3px; border-radius: 2px; }
  .day-num { font-size: 0.8125rem; margin-bottom: 4px; }
  .cal-day.today .day-num { min-width: 16px; height: 16px; border-radius: 8px; padding: 0 4px; }
  .cal-event:not(.cal-event-sm) {
    display: inline-block; width: 7px; height: 7px; padding: 0;
    border-radius: 50%; border-left: none;
    margin: 0 3px 3px 0; font-size: 0; line-height: 0; vertical-align: top;
  }
  .ev-earnings:not(.cal-event-sm) { background: var(--ev-earnings); }
  .ev-exdiv:not(.cal-event-sm)    { background: var(--ev-exdiv); }
  .ev-paydiv:not(.cal-event-sm)   { background: var(--ev-paydiv); }
  .cal-month-label { font-size: 21px; }
}

