/* =====================================================================
   BENTO DASHBOARD + ANIMATED NUTRITION RINGS
   Chargé dynamiquement par pages/dashboard.js & pages/nutrition.js
   (index.html n'est pas modifié). Dark-mode via la classe .dark.
   ===================================================================== */

/* ---------- 1. GRILLE BENTO (Apple-style, tuiles modulaires) ---------- */
.bento {
    display: grid;
    grid-template-columns: 1fr;          /* mobile : 1 colonne */
    grid-auto-rows: minmax(120px, auto);
    gap: 1rem;
    align-items: stretch;
}

@media (min-width: 640px) {
    .bento { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
    .bento { grid-template-columns: repeat(4, 1fr); }
}

/* ---------- 2. TUILES ---------- */
.bento-tile {
    grid-column: span 1;
    grid-row: span 1;
    background: var(--bg-card, #ffffff);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 1rem;                 /* rounded-2xl */
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: box-shadow .25s ease, transform .25s ease, border-color .25s ease;
}
.bento-tile:hover {
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}
.dark .bento-tile {
    background: var(--bg-card, #1f2937);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}
.dark .bento-tile:hover {
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
}

.bento-tile__head {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-weight: 600;
    margin-bottom: .85rem;
}

/* Tailles modulaires (à partir de la 2e colonne, sinon 1 col en mobile) */
@media (min-width: 640px) {
    .bento-2x1 { grid-column: span 2; }
    .bento-2x2 { grid-column: span 2; grid-row: span 2; }
}

/* ---------- 3. MINI-STATS (tuile "quick stats") ---------- */
.bento-mini {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: .75rem;
}
@media (min-width: 640px) {
    .bento-mini { grid-template-columns: repeat(3, 1fr); }
}
.bento-mini__item {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .6rem .7rem;
    border-radius: .75rem;
    background: rgba(0, 0, 0, 0.035);
}
.dark .bento-mini__item { background: rgba(255, 255, 255, 0.05); }
.bento-mini__val { font-size: 1.35rem; line-height: 1.1; font-weight: 700; }
.bento-mini__label { font-size: .72rem; opacity: .7; }

/* ---------- 4. ANNEAUX NUTRITION (rings) ---------- */
.ring-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}
@media (min-width: 640px) {
    .ring-grid { grid-template-columns: repeat(4, 1fr); }
}
.ring-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .35rem;
}
.ring-svg { width: 100%; max-width: 116px; height: auto; }

.ring-track {
    stroke: currentColor;
    opacity: .14;
}
.ring-progress {
    stroke: currentColor;
    /* animation 0 -> valeur via transition de stroke-dashoffset */
    transition: stroke-dashoffset 1s cubic-bezier(.4, 0, .2, 1);
}
.ring-value {
    fill: currentColor;
    font-weight: 700;
    font-size: 1.5rem;
    font-variant-numeric: tabular-nums;
}
.ring-pct {
    fill: currentColor;
    opacity: .65;
    font-size: .8rem;
}
.ring-label {
    font-size: .78rem;
    font-weight: 600;
    opacity: .85;
    text-align: center;
}

/* ---------- 5. ACCESSIBILITÉ : mouvement réduit ---------- */
@media (prefers-reduced-motion: reduce) {
    .bento-tile { transition: none; }
    .bento-tile:hover { transform: none; }
    .ring-progress { transition: none !important; }
}
