body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #f5f7fa;
    color: #222;
}

.logo {
    height: 40px;
    width: 30px;
    object-fit: contain;
}

.logout-zone {
    display: flex;
    align-items: center;
    gap: 20px;
}

header {
    background: #1976d2;
    color: white;
    justify-content: space-between;
}

#user-login {
    white-space: pre;
}

.user-login {
    font-size: 14px;
    padding: 30px;
    color: white;
}

header h1 {
    margin: 0;
}

main {
    max-width: 1300px;
    margin: auto;
    padding: 30px;
}

.hidden {
    display: none;
}

.logo-odevice {
    height: 60px;
    width: auto;
    filter: brightness(0) invert(1);
}

#logout-link {
    display: block;
    text-align: right;
}

.logout-zone {
    width: 100%;
    display: flex;
    justify-content: flex-end;
}

/* LISTE CAPTEURS */
#page-liste {
    text-align: left;
}

#liste-capteurs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 400px));
    gap: 20px;
    justify-content: start;
}

.capteur-card {
    background: white;
    border-radius: 12px;
    padding: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.10);
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.capteur-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
}
 
.capteur-header {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.capteur-nom {
    font-size: 14px;
    color: #666;
    font-weight: bold;
}

.capteur-info {
    font-size: 14px;
    color: #666;
    margin-top: 2px;
}

.capteur-erreur {
    font-size: 14px;
    color: #666;
    margin-top: 15px;
    min-height: 40px;
}

.capteur-Id {
    font-size: 10px;
    color: #888;
    margin-top: auto;
}

.capteur-etat {
    margin-left: 8px;
    font-size: 30px;
    line-height: 1;
    flex-shrink: 0;
}

.radio-stack {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.radio-stack-Image_barre{
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.radio-stack-Image_type{
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.nowifi-image {
    position: absolute;
    width: 40px;
    height: 40px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.radio-image {
    width: 35px;
    height: 35px;
}

.icone-horloge {
    width: 30px;
    height: 30px;
    vertical-align: middle;
}
.derniere-com {
    display: flex;
    align-items: center;
    gap: 1px;
    white-space: nowrap;
}

.icones-status-capteur {
    display: flex;
    align-items: center;
    justify-content: space-between;    
    width: 100%;
}
.status-gauche {
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.icone-radio {
    width: 35px;
    height: 35px;
    object-fit: contain;
    vertical-align: middle;
}

.icone-batterie {
    width: 35px;
    height: 35px;
    object-fit: contain;
    vertical-align: middle;
}

.icone-Mode {
    width: 25px;
    height: 25px;
    object-fit: contain;
    vertical-align: middle;
}

.icone-type-capteur {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.capteur-mesure {
    font-size: 14px;
    font-weight: bold;
    margin-top: auto;
    margin-bottom: 10px;
}

.icone-mode-cuve {
    width: 200px;
    height: 200px;
    object-fit: contain;
}

.capteur-bas {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 15px;
}

.capteur-bas-gauche {
    flex: 1;
    min-width: 0;
}

.capteur-bas-droite {
    width: 45%;
    min-width: 150px;
}

.card-graphique-jour {
    width: 100%;
    height: 70px;
    display: flex;
    align-items: center;
    box-sizing: border-box;
    border: 1px solid #d8d8d8;
    border-radius: 10px;
    padding: 6px;
    background: white;
}

.graph-24h-compact {
    width: 100%;
    height: 100%;
    display: block;
}

/* DETAIL */

#bouton-retour {
    border: none;
    background: none;
    color: #1976d2;
    font-size: 16px;
    cursor: pointer;
    margin-top: 20px;
    margin-bottom: 20px;
}

#detail-batterie {
    display: flex;
    margin-top: 10px;
    align-items: center;
    gap: 2px;
}

.detail-colonnes {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 50px;
    align-items: start;
    width: 100%;
}

.detail-icone-mode {
    width: 40px;
    height: 40px;
}

.detail-gauche {
    flex: 1;
}

.detail-etat-capteur {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.detail-etat-txt {
    font-size: 32px;
    line-height: 1;
}

.detail-mode-txt {
    font-size: 32px;
    line-height: 1;
}

.detail-Radio-capteur {
    display: flex;
    align-items: center;
    gap: 8px;
}

.detail-nom {
    display: flex;
    align-items: center;
    gap: 12px;
}

.detail-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.detail-Mode-capteur {
    display: flex;
    align-items: center;
    gap: 8px;
}

.detail-type-cpt-capteur {
    display: flex;
    align-items: center;
    gap: 8px;
}

.resume {
    display: flex;
    gap: 20px;
    margin: 30px 0;
}

.details-alertes-section {
    background: white;
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 30px;
}

.details-alertes-setting-section {
    background: white;
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 30px;
}

.detail-droite {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-left: 30px;
}

.detail-alerte {
    margin-left: 25px;
}

.detail-bouton-reset {
    font-size: 14px;
    font-weight: bold;
    padding: 5px 15px;
    min-width: 120px;
    min-height: 32px;
    margin-top: 0px;
    cursor: pointer;
    border-radius: 8px;
}

#bouton-reset {
    position: relative;
    top: -14px;
}

#detail-mode-Cuve {
    display: block;
    text-align: center;
}

.detail-mode-Cuve-card {
    margin-top: 20px;
}

.cuve-image-container {
    position: relative;
    display: inline-block;
}

.cuve-texte {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 20px;
    font-weight: bold;
    text-align: center;
}

.graphique-principal {
    height: 300px;
    background: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 40px;
}

.resume-card {
    background: white;
    padding: 5px;
    border-radius: 10px;
    min-width: 180px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.resume-card strong {
    display: block;
    font-size: 14px;
    margin-top: 4px;
}

#detail-volume-card {
    margin-top: 0px;
    align-items: center;
}

.volume-reset-ligne {
    display: flex;
    align-items: center;
    gap: 10px;
}

#btn-reset-volume {
    height: 40px;
    padding: 0 15px;
    cursor: pointer;
}
.volume-reset-ligne {
    display: flex;
    align-items: center;
    gap: 10px;
}

#detail-alerte {
    height: 60px;
}

#detail-alerte-card {
    width: 100%;
}

#detail-alerte-card .resume-card {
    width: 100%;
    box-sizing: border-box;
}
/* graphique */

#graphiques-semaine {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    overflow-x: auto;
    width: 100%;
    padding: 10px 0;
}
.graphique-jour {
    flex: 0 0 280px;
    width: 280px;
    min-width: 280px;
    height: 190px;
    box-sizing: border-box;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 12px;
    background: white;
}
.graph-titre {
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 5px;
}
.graph-24h {
    display: block;
    width: 100%;
    height: 150px;
}
.graph-axe {
    stroke: #777;
    stroke-width: 1;
}
.graph-grille {
    stroke: #ddd;
    stroke-width: 1;
    stroke-dasharray: 4 4;
}
.graph-courbe {
    fill: none;
    stroke: #007aff;
    stroke-width: 2;
    stroke-linejoin: round;
    stroke-linecap: round;
}
.graph-label {
    font-size: 9px;
    fill: #777;
}

.graph-barre {
    fill: #007aff;
}

.graph-volume {
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    margin-top: 4px;
}

.graph-barre-ref {
    fill: none;
    stroke: #00c853;
    stroke-width: 2;
}

/* SMARTPHONE */

@media (max-width: 700px) {

    main {
        padding: 15px;
        width: 100%;
        box-sizing: border-box;    
    }

    .resume {
        flex-direction: column;
    }

    .detail-colonnes {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;  
        min-width: 0;  
    }

    .detail-colonne-1,
    .detail-colonne-2,
    .detail-colonne-3 {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        flex: none;    
        box-sizing: border-box;
    }

    .graphiques-semaine {
        grid-template-columns: repeat(2, 1fr);
    }

    /* fenetre dialog box */

    #api-key-dialog {
        width: 580px;
        max-width: calc(100vw - 32px);
        box-sizing: border-box;
        padding: 30px;
        margin: auto;
        border: none;
        border-radius: 18px;
        background: #fff;
        color: #18354b;
        font-family: inherit;
        box-shadow: 0 20px 70px rgba(0, 0, 0, 0.25);
    }
    #api-key-dialog::backdrop {
        background: rgba(5, 25, 45, 0.55);
        backdrop-filter: blur(3px);
    }
    #api-key-dialog h3 {
        margin: 0 0 16px;
        font-size: 23px;
        font-weight: 700;
    }
    #api-key-message {
        margin: 0 0 22px;
        color: #526477;
        font-size: 15px;
        line-height: 1.6;
    }
    #api-key-value {
        display: block;
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
        padding: 16px;
        border: 1px solid #cbd9e5;
        border-radius: 10px;
        background: #f3f7fb;
        color: #123b60;
        font-family: monospace;
        font-size: 16px;
    }
    #api-key-dialog [hidden] {
        display: none !important;
    }
    #api-key-value:focus {
        outline: 2px solid #1675c5;
        outline-offset: 2px;
    }
    #api-key-dialog .api-key-actions {
        display: flex;
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: 12px;
        margin-top: 24px;
    }
    #api-key-dialog button {
        padding: 12px 22px;
        border: none;
        border-radius: 10px;
        background: #edf2f7;
        color: #334b60;
        font-family: inherit;
        font-size: 15px;
        font-weight: 600;
        cursor: pointer;
    }
    #api-key-dialog #api-key-confirm,
    #api-key-dialog #api-key-copy {
        background: #0868b5;
        color: white;
    }
    #api-key-dialog button:hover {
        filter: brightness(0.95);
    }
    #api-key-dialog button:disabled {
        opacity: 0.6;
        cursor: wait;
    }
}