/* CSS DE TEST */

/* ============================================
   VARIABLES GLOBALES
============================================ */
:root {
    --bg: #F9F1EA;
    --panel: #fff7f0;
    --card: #f8efe8;
    --ink: #1f1f1f;
    --muted: #6b6b6b;
    --accent: #ef4444;
    --white: #ffffff;

    --radius: 18px;
    --shadow: 0 10px 25px rgba(0, 0, 0, 0.06);
}

* {
    box-sizing: border-box;
}

/* ============================================
   GLOBAL
============================================ */
body {
    margin: 0;
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
    background: var(--bg);
    color: var(--ink);
}

.container {
    max-width: 1060px;
    margin: 24px auto;
    padding: 16px;
}

/* ============================================
   HEADER
============================================ */
.header {
    text-align: center;
    background: var(--panel);
    border-radius: var(--radius);
    padding: 22px 16px;
    box-shadow: var(--shadow);
}

.header small {
    color: var(--muted);
}

.controls {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: center;
    margin-top: 16px;
}

select {
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid #ddd;
    background: #fff;
    min-width: 180px;
}

/* ============================================
   STATS
============================================ */
.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
    width: 100%;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--card);
    border-radius: 14px;
    padding: 24px;
    height: 140px;
}

.stat h3 {
    margin: 0 0 6px 0;
    color: var(--muted);
    font-weight: 600;
    font-size: 14px;
}

.stat .value {
    font-weight: 800;
    font-size: 28px;
}

.muted {
    color: var(--muted);
    font-size: 18px;
}

/* ============================================
   PROGRESSION GÉNÉRALE
============================================ */
h2 {
    font-size: 18px;
    margin: 6px 0 14px 0;
}

.row {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    gap: 30px;
}

/* --------- Carte semaine --------- */
.week-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background-color: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
    min-width: 260px;
    flex: 0 0 32%;
}

.week-main {
    text-align: center;
    flex: 1;
}

.week-label {
    font-size: 14px;
    color: var(--muted);
    margin-bottom: 16px;
}

.week-value {
    font-size: 28px;
    font-weight: 700;
}

.week-range {
    font-size: 14px;
    color: var(--muted);
}

.nav-arrow {
    padding: 0 12px;
    background: none;
    border: none;
    font-size: 32px;
    cursor: pointer;
    color: var(--muted);
    transition: 0.2s;
}

.nav-arrow:hover {
    color: var(--ink);
}

/* ============================================
   HISTOGRAMME AVEC ESPACES LATERAUX
============================================ */
.time-month {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0 45px;
    /* <-- espace pour flèches */
    position: relative;
}

/* --------- barres --------- */
.bars {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 18px;
    height: 190px;
    padding: 18px 12px;
    border-radius: 12px;
    background: var(--white);
    box-shadow: var(--shadow);
}

.bar {
    background: var(--accent);
    width: 8%;
    /* <-- barre plus petite */
    border-radius: 10px;
    position: relative;
    transition: height .3s ease;
    min-height: 6px;
    /* valeur 0 visible */
}

.bar:hover {
    opacity: 1;
    transform: translateY(-5px);
}

/* Tooltip */
.bar-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translate(-50%, -6px);
    background: var(--ink);
    color: white;
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: 0.15s ease;
}

.bar:hover .bar-tooltip {
    opacity: 1;
}

/* --------- flèches pour défiler --------- */
.bar-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 38px;
    color: var(--muted);
    cursor: pointer;
    z-index: 4;
    padding: 5px 10px;
}

.bar-nav:hover {
    color: var(--ink);
}

#bar-prev {
    left: 8px;
}

#bar-next {
    right: 8px;
}

.legend {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 12px;
    color: var(--muted);
}

/* ============================================
   RESPONSIVE
============================================ */
@media (max-width: 900px) {
    .grid {
        grid-template-columns: 1fr;
    }

    .row {
        flex-direction: column;
    }

    .time-month {
        padding: 0 30px;
    }
}


/* ============================================
   Pour valeur au dessus des barres
============================================ */
.bar {
    position: relative;
    display: flex;
    justify-content: center;
}

/* Label affiché au-dessus de chaque barre */
.bar-label {
    position: absolute;
    top: -28px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 13px;
    font-weight: 700;
    color: var(--ink);
    white-space: nowrap;
    pointer-events: none;
}

/* ============================================
   NOTE DE BAS DE PAGE
============================================ */
.footer-note {
    margin-top: 6px;
    color: var(--muted);
    font-size: 13px;
    text-align: center;
}