/* ==================================
   CSS RESPONSIVE - CODE ORIGINAL PRÉSERVÉ
   ================================== */

/* Code original - Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-image: url("aerop.jpg");
    background-repeat: no-repeat;
    background-size: cover;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    /*background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);*//
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    padding: 2rem;
    border-radius: 10px;
   background: linear-gradient(135deg, #FF4B2B 0%, #FF0000 100%);;
    width: 100%;
    max-width: 400px;
    margin-top: 120px;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h1 {
    color: #333;
    margin-bottom: 0.5rem;
}

.login-header p {
    color: #666;
    font-size: 0.9rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #333;
    font-weight: 500;
}

.form-group input, .form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e1e1e1;
    border-radius: 5px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: #667eea;
}

.btn-login {
    width: 100%;
    padding: 0.75rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

.btn-login:hover {
    transform: translateY(-2px);
}

.alert {
    padding: 0.75rem;
    margin-bottom: 1rem;
    border-radius: 5px;
    display: none;
}

.alert-error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.alert-success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

/* ==================================
   MEDIA QUERIES RESPONSIVE
   ================================== */

/* Amélioration de base pour tous les écrans */
body {
    background-position: center center;
    background-attachment: fixed;
    padding: 1rem; /* Ajout de padding pour éviter que le contenu touche les bords */
}

/* Très petits smartphones - Portrait (≤320px) */
@media screen and (max-width: 320px) {
    body {
        background-image: url("aerop.jpg");
    background-repeat: no-repeat;
    background-size: cover;
        padding: 0.5rem;
        background-attachment: scroll; /* Évite les problèmes de performance sur petits écrans */
    }

    .login-container {
        padding: 1rem;
        margin-top: 40px;
        max-width: 100%;
        border-radius: 8px;
    }

    .login-header {
        margin-bottom: 1.5rem;
    }

    .login-header h1 {
        font-size: 1.2rem;
        margin-bottom: 0.3rem;
    }

    .login-header p {
        font-size: 0.8rem;
    }

    .form-group {
        margin-bottom: 1.2rem;
    }

    .form-group label {
        margin-bottom: 0.3rem;
        font-size: 0.9rem;
    }

    .form-group input, .form-group select {
        padding: 0.6rem;
        font-size: 0.9rem;
    }

    .btn-login {
        padding: 0.6rem;
        font-size: 0.9rem;
    }

    .alert {
        padding: 0.6rem;
        font-size: 0.85rem;
    }
}

/* Smartphones Portrait (321px - 480px) */
@media screen and (min-width: 321px) and (max-width: 480px) {
    body {
         background-image: url("aerop.jpg");
    background-repeat: no-repeat;
    background-size: cover;
        padding: 0.75rem;
        background-attachment: scroll;
    }

    .login-container {
        padding: 1.5rem;
        margin-top: 60px;
        max-width: 350px;
        border-radius: 8px;
    }

    .login-header {
        margin-bottom: 1.75rem;
    }

    .login-header h1 {
        font-size: 1.4rem;
        margin-bottom: 0.4rem;
    }

    .login-header p {
        font-size: 0.85rem;
    }

    .form-group {
        margin-bottom: 1.3rem;
    }

    .form-group label {
        margin-bottom: 0.4rem;
        font-size: 0.95rem;
    }

    .form-group input, .form-group select {
        padding: 0.65rem;
        font-size: 0.95rem;
    }

    .btn-login {
        padding: 0.65rem;
        font-size: 0.95rem;
    }

    .alert {
        padding: 0.65rem;
        font-size: 0.85rem;
    }
}

/* Smartphones Paysage et Petites Tablettes (481px - 768px) */
@media screen and (min-width: 481px) and (max-width: 768px) {
    body {
        padding: 1rem;
        background-attachment: fixed;
    }

    .login-container {
        padding: 1.75rem;
        margin-top: 80px;
        max-width: 380px;
        border-radius: 9px;
    }

    .login-header {
        margin-bottom: 1.9rem;
    }

    .login-header h1 {
        font-size: 1.5rem;
        margin-bottom: 0.45rem;
    }

    .login-header p {
        font-size: 0.87rem;
    }

    .form-group {
        margin-bottom: 1.4rem;
    }

    .form-group label {
        margin-bottom: 0.45rem;
        font-size: 0.97rem;
    }

    .form-group input, .form-group select {
        padding: 0.7rem;
        font-size: 0.97rem;
    }

    .btn-login {
        padding: 0.7rem;
        font-size: 0.97rem;
    }

    .alert {
        padding: 0.7rem;
        font-size: 0.87rem;
    }
}

/* Tablettes (769px - 1024px) */
@media screen and (min-width: 769px) and (max-width: 1024px) {
    body {
        padding: 1rem;
        background-attachment: fixed;
    }

    .login-container {
        padding: 1.9rem;
        margin-top: 100px;
        max-width: 400px;
        border-radius: 10px;
    }

    .login-header {
        margin-bottom: 2rem;
    }

    .login-header h1 {
        font-size: 1.6rem;
        margin-bottom: 0.5rem;
    }

    .login-header p {
        font-size: 0.9rem;
    }

    .form-group {
        margin-bottom: 1.5rem;
    }

    .form-group label {
        margin-bottom: 0.5rem;
        font-size: 1rem;
    }

    .form-group input, .form-group select {
        padding: 0.75rem;
        font-size: 1rem;
    }

    .btn-login {
        padding: 0.75rem;
        font-size: 1rem;
    }

    .alert {
        padding: 0.75rem;
        font-size: 0.9rem;
    }
}

/* Desktop et Grands Écrans (≥1025px) */
@media screen and (min-width: 1025px) {
    body {
        padding: 1rem;
        background-attachment: fixed;
    }

    .login-container {
        padding: 2rem;
        margin-top: 120px;
        max-width: 400px;
        border-radius: 10px;
    }

    .login-header {
        margin-bottom: 2rem;
    }

    .login-header h1 {
        color: #333;
        margin-bottom: 0.5rem;
    }

    .login-header p {
        color: #666;
        font-size: 0.9rem;
    }

    .form-group {
        margin-bottom: 1.5rem;
    }

    .form-group label {
        display: block;
        margin-bottom: 0.5rem;
        color: #333;
        font-weight: 500;
    }

    .form-group input, .form-group select {
        width: 100%;
        padding: 0.75rem;
        border: 2px solid #e1e1e1;
        border-radius: 5px;
        font-size: 1rem;
        transition: border-color 0.3s;
    }

    .form-group input:focus, .form-group select:focus {
        outline: none;
        border-color: #667eea;
    }

    .btn-login {
        width: 100%;
        padding: 0.75rem;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: white;
        border: none;
        border-radius: 5px;
        font-size: 1rem;
        font-weight: 600;
        cursor: pointer;
        transition: transform 0.2s;
    }

    .btn-login:hover {
        transform: translateY(-2px);
    }

    .alert {
        padding: 0.75rem;
        margin-bottom: 1rem;
        border-radius: 5px;
        display: none;
    }

    .alert-error {
        background-color: #f8d7da;
        border: 1px solid #f5c6cb;
        color: #721c24;
    }

    .alert-success {
        background-color: #d4edda;
        border: 1px solid #c3e6cb;
        color: #155724;
    }
}

/* Très Grands Écrans (≥1440px) */
@media screen and (min-width: 1440px) {
    .login-container {
        margin-top: 140px;
        max-width: 420px;
        padding: 2.2rem;
    }

    .login-header h1 {
        font-size: 1.8rem;
    }

    .form-group input, .form-group select {
        padding: 0.8rem;
        font-size: 1.05rem;
    }

    .btn-login {
        padding: 0.8rem;
        font-size: 1.05rem;
    }
}

/* ==================================
   GESTION SPÉCIALE ORIENTATION
   ================================== */

/* Mode Paysage sur Mobile (hauteur réduite) */
@media screen and (max-height: 500px) and (orientation: landscape) {
    body {
        align-items: flex-start;
        padding-top: 1rem;
        padding-bottom: 1rem;
    }

    .login-container {
        margin-top: 10px;
        margin-bottom: 10px;
    }

    .login-header {
        margin-bottom: 1rem;
    }

    .login-header h1 {
        font-size: 1.2rem;
        margin-bottom: 0.25rem;
    }

    .form-group {
        margin-bottom: 1rem;
    }
}

/* ==================================
   AMÉLIORATIONS ACCESSIBILITÉ
   ================================== */

/* Focus visible pour navigation clavier */
.form-group input:focus, 
.form-group select:focus, 
.btn-login:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Réduction des animations pour utilisateurs sensibles */
@media (prefers-reduced-motion: reduce) {
    .btn-login {
        transition: none;
    }

    .btn-login:hover {
        transform: none;
    }

    .form-group input, 
    .form-group select {
        transition: none;
    }
}

/* ==================================
   OPTIMISATIONS PERFORMANCE
   ================================== */

/* Optimisation image de fond sur mobile */
@media screen and (max-width: 768px) {
    body {
        background-size: cover;
        background-position: center center;
    }
}

/* Support écrans haute densité (Retina) */
@media screen and (-webkit-min-device-pixel-ratio: 2),
       screen and (min-resolution: 192dpi) {
    body {
        background-image: url("aero@2x.jpg"); /* Version haute résolution si disponible */
    }
}

/* Fallback si l'image haute résolution n'existe pas */
@supports not (background-image: url("aero@2x.jpg")) {
    @media screen and (-webkit-min-device-pixel-ratio: 2),
           screen and (min-resolution: 192dpi) {
        body {
            background-image: url("aero.jpg");
        }
    }
}

/* ==================================
   CLASSES UTILITAIRES RESPONSIVE
   ================================== */

/* Classes d'aide pour le développement */
.hidden-mobile {
    display: block;
}

.visible-mobile {
    display: none;
}

@media screen and (max-width: 768px) {
    .hidden-mobile {
        display: none;
    }
    
    .visible-mobile {
        display: block;
    }
}

.hidden-desktop {
    display: none;
}

.visible-desktop {
    display: block;
}

@media screen and (min-width: 769px) {
    .hidden-desktop {
        display: block;
    }
    
    .visible-desktop {
        display: none;
    }
}

/* ==================================
   FALLBACKS NAVIGATEURS ANCIENS
   ================================== */

/* Support pour navigateurs sans vh */
.no-vh {
    height: 100%;
    min-height: 600px;
}

/* Support pour navigateurs sans flexbox */
.no-flexbox body {
    text-align: center;
    padding-top: 10%;
}

.no-flexbox .login-container {
    display: inline-block;
    text-align: left;
}

/* ==================================
   MODE SOMBRE (OPTIONNEL)
   ================================== */

@media (prefers-color-scheme: dark) {
    .login-container {
        background: linear-gradient(135deg, #4a5568 0%, #a53e3e 100%);
    }

    .login-header h1 {
        color: #f7fafc;
    }

    .login-header p {
        color: #cbd5e0;
    }

    .form-group label {
        color: #f7fafc;
    }

    .form-group input, 
    .form-group select {
        background-color: #2d3748;
        border-color: #4a5568;
        color: #f7fafc;
    }

    .form-group input:focus, 
    .form-group select:focus {
        border-color: #667eea;
    }
}