/* charts.css - styles for assets/js/charts.js.
 *
 * Shared by the admin dashboard and the customer account page, which have
 * separate palettes: admin.css names its colours --accent and --border and
 * swaps them for dark mode, forms.css names them --blue and --line and has
 * no dark mode at all.
 *
 * Rather than keep two copies of these rules, each colour is written as
 * var(--accent, var(--gf-blue)): the admin variable if it exists, and the
 * shared token from tokens.css otherwise. Admin keeps its theme switching,
 * the customer side gets the right light colours, and there is one file.
 *
 * Load tokens.css before this.
 */

/* ============================================================
   CHARTS  (assets/js/charts.js)
   ============================================================
   Colours come from the same variables as the rest of the dashboard, so a
   chart follows the theme toggle without charts.js knowing a theme exists.
   ============================================================ */

.chart-card { padding: var(--sp-4, 16px); }
/* The chart card carries its own heading. .card-title exists in admin.css
   only, and borrowing it left this text unstyled on the customer side. */
.chart-title {
  font-size: 14px; font-weight: 600; line-height: 1.3;
  color: var(--text-primary, var(--gf-text));
}
.chart-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--sp-3, 12px); flex-wrap: wrap; margin-bottom: var(--sp-3, 12px);
}
.chart-sub  { font-size: 11.5px; color: var(--text-muted, var(--gf-text-3)); }
.chart-host { width: 100%; min-height: 60px; }

.gfc { display: block; overflow: visible; }

/* Grid and axis. The baseline is stronger than the guides above it: one is
   the floor a bar stands on, the others are only there to read a height. */
.gfc-grid { stroke: var(--border, var(--gf-border)); stroke-width: 1; opacity: .55; }
.gfc-axis { stroke: var(--border, var(--gf-border)); stroke-width: 1; }

.gfc-tick {
  font-family: var(--font, var(--gf-font)); font-size: 10.5px; font-weight: 500;
  fill: var(--text-muted, var(--gf-text-3));
}
.gfc-rank-label {
  font-family: var(--font, var(--gf-font)); font-size: 12px; font-weight: 500;
  fill: var(--text-secondary, var(--gf-text-2));
}
.gfc-rank-value {
  font-family: var(--font, var(--gf-font)); font-size: 12px; font-weight: 700;
  fill: var(--text-primary, var(--gf-text)); font-variant-numeric: tabular-nums;
}

.gfc-bar   { fill: var(--accent, var(--gf-blue)); }
.gfc-track { fill: var(--border, var(--gf-border)); opacity: .35; }

/* An invisible column owns the hover, so the tooltip and the highlight do
   not depend on the pointer finding a thin bar. */
.gfc-hit { fill: transparent; }
.gfc-col:hover .gfc-hit { fill: var(--surface-hover, var(--gf-surface-2)); opacity: .5; }
.gfc-col:hover .gfc-bar { filter: brightness(1.14); }

.gfc-line {
  fill: none; stroke-width: 2.25;
  stroke-linecap: round; stroke-linejoin: round;
}
.gfc-dot { stroke: var(--surface, var(--gf-white)); stroke-width: 1.5; }

/* Tones. Stroke for lines and dots, fill for bars. */
.gfc-accent { stroke: var(--accent, var(--gf-blue)); }
.gfc-green  { stroke: var(--green, var(--gf-green)); }
.gfc-red    { stroke: var(--red, var(--gf-red)); }
.gfc-orange { stroke: var(--orange, var(--gf-orange)); }
.gfc-blue   { stroke: var(--blue, var(--gf-blue)); }
circle.gfc-accent { fill: var(--accent, var(--gf-blue)); }
circle.gfc-green  { fill: var(--green, var(--gf-green)); }
circle.gfc-red    { fill: var(--red, var(--gf-red)); }
circle.gfc-orange { fill: var(--orange, var(--gf-orange)); }
circle.gfc-blue   { fill: var(--blue, var(--gf-blue)); }
rect.gfc-green  { fill: var(--green, var(--gf-green));  stroke: none; }
rect.gfc-red    { fill: var(--red, var(--gf-red));    stroke: none; }
rect.gfc-orange { fill: var(--orange, var(--gf-orange)); stroke: none; }
rect.gfc-blue   { fill: var(--blue, var(--gf-blue));   stroke: none; }

.gfc-legend {
  display: flex; gap: var(--sp-4, 16px); flex-wrap: wrap;
  margin-top: var(--sp-2, 8px); font-size: 11.5px; color: var(--text-secondary, var(--gf-text-2));
}
.gfc-key { display: inline-flex; align-items: center; gap: 6px; }
.gfc-key i {
  width: 12px; height: 3px; border-radius: 2px;
  background: currentColor; color: var(--accent, var(--gf-blue));
}
.gfc-key i.gfc-green  { color: var(--green, var(--gf-green)); }
.gfc-key i.gfc-red    { color: var(--red, var(--gf-red)); }
.gfc-key i.gfc-orange { color: var(--orange, var(--gf-orange)); }
.gfc-key i.gfc-blue   { color: var(--blue, var(--gf-blue)); }
.gfc-key i.gfc-accent { color: var(--accent, var(--gf-blue)); }

/* Empty, not broken. A chart with no data says which data would fill it. */
.gfc-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--sp-2, 8px); text-align: center;
  min-height: 150px; padding: var(--sp-4, 16px);
  color: var(--text-muted, var(--gf-text-3)); font-size: 12.5px; line-height: 1.5;
}
.gfc-empty svg  { opacity: .4; }
.gfc-empty span { max-width: 30ch; }

/* The shape of the chart that is coming, not a spinner. Settled heights
   rather than random ones, so the block does not jitter while it waits. */
/* One shimmer, defined here rather than borrowed from admin.css, because
   the customer dashboard does not load admin.css. */
.gfc-sk, .chart-skeleton i {
  background: linear-gradient(90deg,
    var(--surface-raised, var(--gf-surface))   25%,
    var(--surface-hover,  var(--gf-surface-2)) 50%,
    var(--surface-raised, var(--gf-surface))   75%);
  background-size: 200% 100%;
  animation: gfc-shimmer 1.4s infinite;
  border-radius: var(--gf-r-sm);
}
@keyframes gfc-shimmer {
  0%   { background-position:  200% 0; }
  100% { background-position: -200% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .gfc-sk, .chart-skeleton i { animation: none; }
}

.chart-skeleton {
  display: flex; align-items: flex-end; gap: 5%;
  height: 190px; padding: 14px 0 24px;
}
.chart-skeleton i { flex: 1; border-radius: 3px 3px 0 0; }
.chart-skeleton i:nth-child(1) { height: 42%; }
.chart-skeleton i:nth-child(2) { height: 68%; }
.chart-skeleton i:nth-child(3) { height: 55%; }
.chart-skeleton i:nth-child(4) { height: 84%; }
.chart-skeleton i:nth-child(5) { height: 61%; }
.chart-skeleton i:nth-child(6) { height: 92%; }
.chart-skeleton i:nth-child(7) { height: 48%; }

/* Placeholder delivery cards for the customer dashboard. The point is that
   the list occupies its final height while it loads, so nothing jumps. */
.sk-card {
  border: 1px solid var(--line, var(--gf-border));
  border-radius: 12px; padding: 15px; margin-bottom: 10px;
  background: var(--card, var(--gf-white));
}
.sk-card i { display: block; height: 13px; }
.sk-card i + i { margin-top: 9px; }
.sk-card i:nth-child(1) { width: 38%; height: 15px; }
.sk-card i:nth-child(2) { width: 72%; }
.sk-card i:nth-child(3) { width: 54%; }
