/* --- Correction Globale et Variables --- */
*, *::before, *::after {
    box-sizing: border-box; /* Empêche les éléments de dépasser à cause du padding */
}

:root {
    --primary-red: #B30000;
    --light-bg: #FBD0D2;
    --dark-text: #2d2d2d;
    --white: #ffffff;
    --black: #000000;
    --shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

body.oneColElsCtrHdr {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: linear-gradient(135deg, var(--primary-red) 0%, #800000 100%);
    margin: 0;
    /* Utilise dvh (Dynamic Viewport Height) pour s'adapter parfaitement aux mobiles */
    min-height: 100dvh; 
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--dark-text);
    /* Supprime le padding ici pour éviter de pousser le contenu */
    padding: 0; 
    overflow: hidden; /* Empêche tout défilement résiduel */
}

#container {
    max-width: 600px;
    /* Utilise une largeur calculée pour laisser une marge de sécurité sans déborder */
    width: calc(100% - 20px); 
    margin: 10px;
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

/* --- Header --- */
#header {
    background: var(--black);
    padding: 25px 30px;
    color: var(--white);
    text-align: center;
}

#header h1 {
    margin: 0;
    font-size: 1.5rem;
    text-transform: uppercase;
}

#header h2 {
    margin: 5px 0 0 0;
    font-weight: 300;
    font-size: 1rem;
    opacity: 0.8;
}

#mainContent {
    padding: 25px; /* Ajusté pour mobile */
}

/* --- Formulaire et Inputs (RÉINTÉGRÉS) --- */
.form-group {
    margin-bottom: 20px;
    width: 100%;
}

label {
    display: block;
    font-weight: bold;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

input[type="input"], 
input[type="password"] {
    width: 100%; /* Occupe toute la largeur disponible */
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

input:focus {
    outline: none;
    border-color: #666;
    box-shadow: 0 0 0 3px rgba(102, 102, 102, 0.2);
}

input[type="submit"] {
    width: 100%;
    background: var(--primary-red);
    color: white;
    padding: 14px;
    border: none;
    border-radius: 6px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s ease;
}

/* --- Éléments de téléchargement --- */
.download-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fdfdfd;
    padding: 15px;
    border: 1px solid #eee;
    border-radius: 10px;
    margin-bottom: 12px;
    gap: 10px;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.btn-download, .btn-logout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    padding: 12px 18px;
    border-radius: 6px;
    font-weight: bold;
    white-space: nowrap; /* Empêche le texte du bouton de se couper */
}

.btn-download {
    background: var(--primary-red);
    color: white;
}

.btn-logout {
    background: var(--dark-text);
    color: white;
    width: 100%;
    margin-top: 10px;
}

/* --- MEDIA QUERIES (MOBILE) --- */
@media (max-width: 480px) {
    #mainContent {
        padding: 15px;
    }

    .download-item {
        flex-direction: column; /* Aligne verticalement sur petit écran */
        text-align: center;
    }

    .btn-download {
        width: 100%; /* Bouton pleine largeur pour faciliter le clic */
    }

    #header h1 {
        font-size: 1.2rem;
    }
}

/* --- Alertes Erreur --- */
.error-box {
    background-color: #fce4e4;
    border: 1px solid #fcc2c2;
    color: #cc0000;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    animation: shake 0.4s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.material-symbols-outlined {
    vertical-align: middle;
}

#footer {
    padding: 15px;
    background: #f8f8f8;
    color: #666;
    font-size: 0.75rem;
    text-align: center;
}