/* =========================
RESET
========================= */

*{
    box-sizing:border-box;
}

:root{
    --theme-color:#ff9286;
}

body{
    font-family:Arial, sans-serif;
    margin:0;
    background:white;
    overflow:hidden;
    line-height:1.5;
}


/* =========================
LAYOUT
========================= */

.page-layout{
    height:100vh;
    display:flex;
    flex-direction:column;
}

.container{
    max-width:1200px;
    margin:0 auto;
    flex:1;
    display:flex;
    flex-direction:column;
    min-height:0;
    width:100%;
    text-align:center;
}


/* =========================
HEADER
========================= */

.top-header{
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:15px;
    background:white;
}

.back-button{
    font-size:1.5rem;
    margin-right:15px;
    text-decoration:none;
    font-size:0.9rem;
    font-weight:600;
    font-style:italic;
    color:black;
}


/* bouton territoire */

.territory-btn{
    background:#f2f2f2;
    border:none;
    padding:8px 14px;
    border-radius:20px;
    cursor:pointer;
}


/* =========================
INTRO
========================= */

.intro{
    padding:1.25rem;
    background:white;
    text-align:center;
}

.intro h2{
    color:var(--theme-color);
    font-size:1.3rem;
}

.intro p{
    font-size:1rem;
    margin:auto;
}

.section-intro {
    transition:
        padding 0.3s ease,
        transform 0.3s ease;
    display:none;
}

.section-intro.active{
    display:block;
}

/* Titre */

.section-intro h2 {

    transition:
        font-size 0.3s ease,
        margin 0.3s ease;

}

.section-intro p {

    transition: 
        opacity 0.3s ease,
        transform 0.3s ease,
        max-height 0.3s ease;

    max-height: 120px;
    overflow: hidden;

}

/* Mode compact */

.section-intro.compact {

    padding-top: 6px;
    padding-bottom: 6px;

}

/* Titre réduit */

.section-intro.compact h2 {

    font-size: 1rem;

}

/* Paragraphe masqué */

.section-intro.compact p {

    opacity: 0;

    transform: translateY(-8px);

    max-height: 0;

}

/* état masqué */

.section-intro.p-hidden p {

    opacity: 0;

    transform: translateY(-10px);

    max-height: 0;

}


/* =========================
NAVIGATION DOTS
========================= */
.section-nav{
    display:flex;
    justify-content:center;
    gap:15px;
    padding:1rem;
    background:white;
    position: relative;
    z-index: 1;
}

.dot{
    width:1rem;
    height:1rem;
    border-radius:50%;
    background:#ddd;
    border:none;
    cursor:pointer;
    transition:0.3s;
}

.dot.active{
    background:var(--theme-color);
    transform:scale(1.2);
}


/* =========================
WAVE
========================= */

.wave{
    width:100%;
    overflow:hidden;
    margin-bottom:-5px;

    transition: margin-top 0.3s ease;

    position: relative;
    z-index: 2;

    pointer-events: none; /* très important */
}

.wave svg{
    display:block;
    width:100%;
    height:70px;
}

.wave path{
    fill:var(--theme-color);
}


/* Mode compact */

.wave.compact {

    margin-top: -40px;

}

/* =========================
CONTENT
========================= */

.content{
    background:var(--theme-color);
    padding:1.25rem;
    flex:1;
    overflow-y:auto;
    min-height:0;
}

.section{
    display:none;
}

.section.active{
    display:block;
}


/* =========================
TITRES
========================= */

.content h3{
    color:white;
    font-size:1rem;
    margin:20px auto 12px auto;
    max-width:700px;
}


/* =========================
SOURCES ET ANNOTATIONS GRAPHIQUE
========================= */
.source {
    color:white;
    font-size:0.75rem;
}


.annotation {
    color: white;
    font-size : 0.85rem;
    justify-content: center;}
/* =========================
CARDS
========================= */

.card{
    background:white;
    border-radius:16px;
    padding:1.5rem;
    box-shadow:0 8px 16px rgba(0,0,0,0.15);
    width:100%;
    position:relative;
}

.chart-card{
    height:420px;
}

.chart-card-small{
    height:260px;
}



.table-image-container {

    width: 100%;
    overflow-x: auto;
    background-color: #e6e6e6;

}

.responsive-table-image {

    width: 100%;
    height: auto;
    image-rendering: -webkit-optimize-contrast;

   /* border-radius: 12px;*/

}

/* Mobile */

@media (max-width: 768px) {

    .responsive-table-image {

        width: 100%;   /* ⚠️ remplace min-width:600px */

    }

}

/* =========================
CHARTJS
========================= */

.card canvas{
    width:100%;
    height:100%;
}

#chart-prix-repartition {
    overflow: visible;
}

/* =========================
CARTES
========================= */

#map-captages{
    width:100%;
    height:500px;
    border-radius:12px;
}

.cluster-blue{
    background-color: rgba(0,120,255,0.6);
    border-radius: 50%;
}

.cluster-blue div{
    background-color: rgba(0,120,255,0.8);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display:flex;
    align-items:center;
    justify-content:center;
}

.cluster-blue span{
    color:white;
    font-weight:bold;
}

.cluster-small div{ background:#c48ffa; }
.cluster-medium div{ background:#800bf4; }
.cluster-large div{ background:#3b0570; }

.map-legend{
background:rgba(255,255,255,0.85);
backdrop-filter: blur(3px);
padding:8px;
border-radius:6px;
font-size:12px;
box-shadow:0 0 6px rgba(0,0,0,0.25);
}

.legend-toggle{
cursor:pointer;
font-weight:bold;
}

.legend-content{
margin-top:6px;
max-height:200px;
overflow:auto;
}


.map-legend.collapsed .legend-content{
display:none;
}

/* =========================
NUMBERS
========================= */

.kpi-grid{
display:flex;
gap:5px;
justify-content:center;
}

.kpi-card{
text-align:center;
padding:5px;
}

.kpi-value{
font-size:1.75rem;
font-weight:bold;
color:var(--theme-color);
}

.kpi-percent{
font-size:1.25rem;
color:var(--theme-color);
}

.kpi-label{
margin-top:5px;
font-size:14px;
}

.numbers{
    text-align:center;
}

.key-number{
    color:var(--theme-color);
    font-size:2rem;
    font-weight:600;
}


/* =========================
RESPONSIVE
========================= */

@media (max-width:768px){

    .chart-card{
        height:360px;
    }

    .chart-card-medium{
        height:300px;
    }

    .chart-card-small{
        height:160px;
    }

}

/* =========================
TERRITORY FILTER
========================= */

.territory-filter{
    position:relative;
}

/* dropdown */

.territory-dropdown{

    position:absolute;

    right:0;
    top:45px;

    background:white;

    padding:15px;

    border-radius:12px;

    box-shadow:0 8px 20px rgba(0,0,0,0.15);

    width:220px;

    display:flex;
    flex-direction:column;
    gap:8px;

    z-index:2000;
}

.hidden{
    display:none;
}

.territory-dropdown select{

    width:100%;
}

/* tags */

.selected-tags{

    display:flex;
    flex-wrap:wrap;
    gap:6px;

    margin-top:6px;
}

.tag{

    background:var(--theme-color);

    color:white;

    padding:4px 10px;

    border-radius:12px;

    font-size:0.8rem;

    display:flex;
    align-items:center;
    gap:6px;
}

.tag button{

    border:none;
    background:none;
    color:white;
    cursor:pointer;
}