/* ═══════════════════════════════════════════════════
   Sol°Arch — Suivi de mon usage
   Theme-aware: uses --primary / --secondary vars (cf. app.css, gv-settings.css)
   ═══════════════════════════════════════════════════ */

/* ── Header : titre + bouton refresh discret ── */
.gv-usage__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.gv-usage__refresh {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--secondary-color);
  opacity: .55;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity .15s ease, background .15s ease;
}

.gv-usage__refresh:hover {
  opacity: 1;
  background: color-mix(in srgb, var(--secondary-color) 8%, transparent);
}

.gv-usage__refresh svg {
  width: 16px;
  height: 16px;
  display: block;
}

.gv-usage__refresh.is-loading {
  opacity: 1;
  pointer-events: none;
}

.gv-usage__refresh.is-loading svg {
  animation: gv-usage-spin .8s linear infinite;
}

@keyframes gv-usage-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .gv-usage__refresh.is-loading svg {
    animation: none;
  }
}

/* ── Jauges principales (hors carte, mise en avant) ── */
.gv-usage__principal {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 32px;
}

.gv-usage__empty {
  color: var(--secondary-color);
  font-size: 14px;
  opacity: .55;
  font-style: italic;
  margin: 0;
}

/* ── Groupes (dans la carte rétractable) ── */
.gv-usage__group + .gv-usage__group {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid color-mix(in srgb, var(--primary-color) 18%, transparent);
}

.gv-usage__group-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  opacity: .7;
  margin: 0 0 12px 0;
}

/* Hors carte (bloc principal + en-tête), aucun ancêtre ne fixe `color` : sans cette règle
   le texte retombe sur le noir navigateur, illisible sur fond bordeaux en thème sombre. */
.gv-usage__header,
.gv-usage__principal {
  color: var(--secondary-color);
}

/* ── Item : label + fenêtre + jauge + valeurs ── */
.gv-usage__item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.gv-usage__item + .gv-usage__item {
  margin-top: 14px;
}

.gv-usage__item-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.gv-usage__item-label {
  font-size: 13px;
  font-weight: 600;
}

.gv-usage__item-window {
  font-size: 11.5px;
  opacity: .6;
  flex-shrink: 0;
}

.gv-usage__item-scope {
  font-size: 11.5px;
  font-weight: 400;
  opacity: .6;
}

.gv-usage__item-values {
  align-self: flex-end;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  opacity: .75;
}

/* ── Jauge (track + fill), états ok / warn / reached ── */
.gv-usage__gauge {
  position: relative;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: color-mix(in srgb, var(--secondary-color) 20%, var(--primary-color));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--secondary-color) 12%, transparent);
}

.gv-usage__gauge-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  border-radius: 999px;
  background: var(--secondary-color);
  transition: width .3s ease, background-color .3s ease;
}

.gv-usage__gauge.is-warn .gv-usage__gauge-fill {
  background: #d18a2f;
}

.gv-usage__gauge.is-reached .gv-usage__gauge-fill {
  background: #d13a2f;
}

/* Colors inside a card have inverted contrast (card bg = --secondary-color) */
.sa-settings__card .gv-usage__gauge {
  background: color-mix(in srgb, var(--primary-color) 20%, var(--secondary-color));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary-color) 12%, transparent);
}

.sa-settings__card .gv-usage__gauge .gv-usage__gauge-fill {
  background: var(--primary-color);
}

.sa-settings__card .gv-usage__gauge.is-warn .gv-usage__gauge-fill {
  background: #e0a94f;
}

.sa-settings__card .gv-usage__gauge.is-reached .gv-usage__gauge-fill {
  background: #e2685c;
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .gv-usage__item-head {
    flex-wrap: wrap;
  }

  .gv-usage__item-values {
    align-self: flex-start;
  }
}
