/* ===== RESET DE BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Arial, sans-serif;
}

/* ===== PARAMÈTRES GLOBAUX ===== */
body {
    background: #fff;
    color: #111;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

main {
    width: 100%;
    height: 100%;
}

/* ===== PAGE D’ACCUEIL & CONNEXION (TOUCHE PAS C’EST SACRÉ) ===== */
.accueil {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    align-content: center;
    text-align: center;
    gap: 15px;
}

/* Header transparent en haut */
.header-transparent {
    height: 15%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1%;
}

.header-logo {
    height: 80%;
    width: auto;
    max-width: 150px;
    align-content: center;
}

/* Image principale */
.hero-img {
    width: 500px;
}

/* Titre principal */
.accueil-title {
    font-size: 2.5rem;
    color: #111;
}

/* Sous-titre */
.accueil-subtitle {
    font-size: 1.2rem;
    opacity: 0.8;
    color: #111;
}

/* Bouton principal */
.primary-btn {
    padding: 18px 30px;
    font-size: 1.2rem;
    border: none;
    border-radius: 12px;
    background: #2980b9;
    color: white;
}

/* Bouton secondaire */
.secondary-btn {
    height: 100%;
    width: 5%;
    padding: 9px 15px;
    font-size: clamp(1.2rem, 2vh, 18px);
    border: none;
    border-radius: 12px;
    background: #2980b9;
    color: white;
    box-sizing: border-box;
}

/* Bouton secondaire dans le header */
.header-transparent .secondary-btn {
    flex: 0 0 auto;       
    height: 70%;          
    font-size: clamp(12px, 2vh, 18px); 
    padding: 0.3em 0.6em;    
    min-width: 40px;         
    box-sizing: border-box;
}

/* Bouton désactivé */
button:disabled {
    pointer-events: none;
    transition: none;
    animation: none;
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== BARRE DE CONTRÔLE (PILOTAGE) ===== */
.header-bar {
    height: 15%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    background: #f0f0f0;
    color: #111;
}

.header-bar button {
    padding: 12px 18px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
}

/* Infos d’état */
.status-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Bouton arrêt d’urgence */
.btnArret {
    background: red;
    color: white;
    font-weight: bold;
}

/* Sélecteur de modes */
.driving-modes {
    display: flex;
    gap: 8px;
}

/* Bouton de mode */
.mode-btn {
    background: #ddd;
    color: #111;
    padding: 12px 18px;
    border-radius: 12px;
    font-weight: bold;
    font-size: 1rem;
}

/* Mode actif */
.mode-btn.active {
    background: #2980b9;
    color: white;
}

/* ===== ZONE DE CONTRÔLE (MANETTE) ===== */
.controls-container {
    height: 85%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 30px;
}

/* Zones gauche et droite */
.controls-left,
.controls-right {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 40px;
}

/* Boutons directionnels PC */
.dir {
    width: 300px;
    height: 300px;
    font-size: 4.5rem;
    border-radius: 50%;
    border: none;
    background: #2980b9;
    color: white;
    box-shadow: 0 6px 12px rgba(0,0,0,0.2);
    transition: transform 0.1s;
    cursor: pointer;
}

/* Bouton direction actif */
.dir.active {
    transform: scale(0.95);
    box-shadow: 0 3px 6px rgba(0,0,0,0.2);
    background-color: #1f6fa0;
}

/* Bouton déconnexion */
#btnDeconnecter {
    padding: 12px 20px;
    border: none;
    border-radius: 12px;
    background: #2980b9;
    color: white;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
}

/* Placement manette PC */
.controls-left {
    width: 40%;
    justify-content: center;
}

.controls-right {
    width: 40%;
    flex-direction: column;
    justify-content: center;
}

/* Effet pression sur tous les boutons */
button:active,
.dir:active,
#btnDeconnecter:active,
.mode-btn:active {
    transform: scale(0.9);
    box-shadow: 0 3px 6px rgba(0,0,0,0.2);
}

/* ===== BOUTONS ACCUEIL ===== */
.accueil-boutons {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 30px;
    margin-top: 30px;
}

/* ===== SAISIE ADRESSE IP ===== */
#ip-entry {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 15px;
    font-size: 1.3rem;
    font-weight: bold;
    color: #2980b9;
}

#ip-entry input {
    width: 70px;
    height: 40px;
    text-align: center;
    font-size: 1.1rem;
    border-radius: 4px;
    border: 2px solid #2980b9;
    outline: none;
    transition: border 0.2s, box-shadow 0.2s;
}

/* Focus */
#ip-entry input:focus {
    border-color: #1f6fa0;
    box-shadow: 0 0 4px rgba(41, 128, 185, 0.5);
}


/* ===== RESPONSIVE MOBILE (PAYSAGE) ===== */
@media screen and (max-width: 1000px) {
    .controls-container {
        flex-direction: row;
        padding: 15px;
    }

    .controls-left,
    .controls-right {
        width: 45%;
        gap: 10px;
    }

    .dir {
        width: 130px;
        height: 130px;
        font-size: 2rem;
    }

    .primary-btn, .mode-btn, .header-bar button {
        font-size: 1rem;
        padding: 10px 18px;
    }

    .hero-img {
        width: 150px;
    }

    .accueil-title {
        font-size: 1.8rem;
    }

    .accueil-subtitle {
        font-size: 0.95rem;
    }
}

/* ===== MESSAGE SI MOBILE EN PORTRAIT ===== */
@media screen and (orientation: portrait) and (max-width: 1000px) {
    body {
        display: flex;
        justify-content: center;
        align-items: center;
    }

    body::before {
        content: url("../res/paysage.png");
        width: 200px;
        display: block;
        text-align: center;
    }

    main {
        display: none;
    }
}

/* ===== BOUTONS PC GRAND ÉCRAN ===== */
@media screen and (min-width: 1001px) {
    .header-bar button,
    #btnDeconnecter {
        padding: 16px 25px;
        font-size: 1.5rem;
    }
    .status-info span {
        font-size: 1.5rem;
    }
}

/* ===== ZONE SCAN QR (GRAND) ===== */
#reader {
    width: 95vw;
    max-width: 700px;
    margin: 30px auto;
    border-radius: 25px;
    border: 5px solid #2980b9;
    overflow: hidden;
    padding: 10px;
}

/* Canvas du scanner */
.html5-qrcode-container canvas {
    width: 100%;
    height: 100%;
    border-radius: 20px;
}

/* ===== BOUTONS CAMÉRA ===== */
.html5-qrcode-button, 
#html5-qrcode-button-camera-start, 
#html5-qrcode-button-camera-stop,
#html5-qrcode-button-camera-permission {
    background-color: #2980b9 !important;
    color: white !important;
    font-weight: bold;
    border-radius: 12px !important;
    padding: 12px 25px !important;
    font-size: 1.2rem;
    margin-top: 15px;
    cursor: pointer;
    box-shadow: 0 6px 12px rgba(0,0,0,0.2);
    transition: all 0.2s;
}

/* Hover boutons caméra */
.html5-qrcode-button:hover, 
#html5-qrcode-button-camera-start:hover, 
#html5-qrcode-button-camera-stop:hover,
#html5-qrcode-button-camera-permission:hover {
    background-color: #1f6fa0 !important;
    transform: scale(1.05);
}

/* Active boutons caméra */
.html5-qrcode-button:active, 
#html5-qrcode-button-camera-start:active, 
#html5-qrcode-button-camera-stop:active,
#html5-qrcode-button-camera-permission:active {
    transform: scale(0.95);
    box-shadow: 0 3px 6px rgba(0,0,0,0.2);
}

/* ===== QR SCANNER VERSION MOBILE ===== */
@media screen and (max-width: 1000px) {
    #reader {
        width: 50vw;
        max-width: 200px;
        aspect-ratio: 1;
        border-radius: 10px;
        border: 2px solid #2980b9;
        padding: 3px;
        margin: 10px auto 15px auto;
    }

    .html5-qrcode-container canvas {
        width: 100%;
        height: 100%;
        border-radius: 8px;
    }

    .html5-qrcode-button, 
    #html5-qrcode-button-camera-start, 
    #html5-qrcode-button-camera-stop,
    #html5-qrcode-button-camera-permission {
        padding: 6px 12px !important;
        font-size: 0.85rem !important;
        margin: 8px auto !important;
        border-radius: 10px !important;
        display: block;
    }
}

/* ===== QR SCANNER MOBILE PORTRAIT ===== */
@media screen and (orientation: portrait) and (max-width: 1000px) {
    #reader {
        width: 45vw;
        max-width: 160px;
        border-radius: 8px;
        border: 2px solid #2980b9;
        padding: 2px;
        margin: 8px auto 15px auto;
    }

    .html5-qrcode-container canvas {
        border-radius: 6px;
    }

    .html5-qrcode-button, 
    #html5-qrcode-button-camera-start, 
    #html5-qrcode-button-camera-stop,
    #html5-qrcode-button-camera-permission {
        padding: 5px 10px !important;
        font-size: 0.8rem !important;
        margin: 8px auto !important;
        border-radius: 8px !important;
        display: block;
    }
}

/* ===== PAGE D'INFOS ===== */
.infos {
    height: 85%;
    width: 100%;
    padding: 40px;
    overflow-y: auto;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.infos h1 {
    font-size: 2.5rem;
    color: #2980b9;
    text-align: center;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.infos section {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 6px 15px rgba(0,0,0,0.1);
    border-left: 5px solid #2980b9;
}

.infos section h2 {
    font-size: 1.8rem;
    color: #2980b9;
    margin-bottom: 15px;
}

.infos section ol,
.infos section ul {
    margin-left: 25px;
    line-height: 1.8;
    font-size: 1.1rem;
    color: #333;
}

.infos section li {
    margin-bottom: 12px;
}

.infos section p {
    font-size: 1.1rem;
    color: #555;
    line-height: 1.8;
    margin-bottom: 15px;
}

.infos section strong {
    color: #2980b9;
    font-weight: bold;
}

/* Scrollbar personnalisée */
.infos::-webkit-scrollbar {
    width: 10px;
}

.infos::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.05);
    border-radius: 10px;
}

.infos::-webkit-scrollbar-thumb {
    background: #2980b9;
    border-radius: 10px;
}

.infos::-webkit-scrollbar-thumb:hover {
    background: #1f6fa0;
}

/* ===== RESPONSIVE INFOS ===== */
@media screen and (max-width: 1000px) {
    .infos {
        padding: 20px;
        height: 85%;
    }

    .infos h1 {
        font-size: 1.8rem;
        margin-bottom: 15px;
    }

    .infos section {
        padding: 15px;
        border-radius: 10px;
        border-left: 4px solid #2980b9;
    }

    .infos section h2 {
        font-size: 1.3rem;
        margin-bottom: 10px;
    }

    .infos section ol,
    .infos section ul {
        margin-left: 20px;
        font-size: 0.95rem;
        line-height: 1.6;
    }

    .infos section li {
        margin-bottom: 8px;
    }

    .infos section p {
        font-size: 0.95rem;
    }
}