/* ============================================
   VARIABLES & RESET
   ============================================ */
:root {
    --primary-color: #2980b9;
    --secondary-color: #3498db;
    --gradient: linear-gradient(135deg, #2980b9, #3498db);
    --text-dark: #2c3e50;
    --text-light: #7f8c8d;
    --shadow-sm: 0 10px 40px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 20px 60px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 30px 80px rgba(0, 0, 0, 0.2);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-login {
    background: var(--gradient);
    border: none;
    border-radius: 50px;
    padding: 14px 28px;
    font-weight: 600;
    font-size: 1rem;
    color: white;
    width: 100%;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    filter: brightness(1.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    overflow-x: hidden;
    min-height: 100vh;
}

/* ============================================
   BACKGROUND & OVERLAY
   ============================================ */
.login-wrapper {
    min-height: 100vh;
    width: 100%;
    position: relative;
    background: url('../img/image.jpg') center/cover no-repeat fixed;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* Overlay sombre pour que le formulaire soit bien lisible */
.overlay-dark {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.6) 100%);
    backdrop-filter: blur(2px);
    z-index: 1;
}

/* Fallback si l'image ne charge pas */
.login-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #1a5f7a 0%, #0a2e3f 100%);
    z-index: -1;
}

.container {
    position: relative;
    z-index: 2;
    width: 100%;
    padding-right: 15px;
    padding-left: 15px;
    margin-right: auto;
    margin-left: auto;
}

/* ============================================
   CARTE DE CONNEXION - DESIGN RESPONSIVE
   ============================================ */
.login-card {
    background: white;
    border-radius: 32px;
    padding: 2rem 1.5rem;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
    animation: fadeInUp 0.8s ease-out;
    width: 100%;
    margin: 0 auto;
}

/* Mobile (par défaut) - déjà défini ci-dessus */

/* Tablettes (sm: 640px et plus) */
@media (min-width: 640px) {
    .login-card {
        padding: 2rem;
        max-width: 500px;
    }
}

/* Grandes tablettes (md: 768px et plus) */
@media (min-width: 768px) {
    .login-card {
        padding: 2.5rem;
        max-width: 550px;
    }
}

/* Desktop (lg: 1024px et plus) */
@media (min-width: 1024px) {
    .login-card {
        padding: 2.5rem;
        max-width: 600px;
    }
}

/* Grand écran (xl: 1280px et plus) */
@media (min-width: 1280px) {
    .login-card {
        padding: 3rem;
        max-width: 650px;
    }
}

/* Très grand écran (2xl: 1536px et plus) */
@media (min-width: 1536px) {
    .login-card {
        padding: 3.5rem;
        max-width: 700px;
    }
}

.login-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

/* ============================================
   LOGO - RESPONSIVE
   ============================================ */
.logo-container {
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
}

.logo-img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    background: transparent;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    transition: var(--transition);
    filter: drop-shadow(0 10px 25px rgba(0, 0, 0, 0.2));
}

/* Mobile medium */
@media (min-width: 480px) {
    .logo-img {
        width: 100px;
        height: 100px;
    }
}

/* Tablettes */
@media (min-width: 768px) {
    .logo-img {
        width: 120px;
        height: 120px;
    }
}

/* Desktop */
@media (min-width: 1024px) {
    .logo-img {
        width: 140px;
        height: 140px;
    }
}

.logo-img:hover {
    transform: scale(1.05);
    filter: drop-shadow(0 15px 35px rgba(0, 0, 0, 0.3));
}

/* ============================================
   TITRE ANIMÉ - RESPONSIVE
   ============================================ */
.animated-gradient-title {
    background: linear-gradient(135deg, #2ecc71, #3498db, #e74c3c, #f39c12, #9b59b6, #1abc9c);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientShift 4s ease infinite;
    font-weight: 800;
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
    letter-spacing: -0.5px;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Mobile medium */
@media (min-width: 480px) {
    .animated-gradient-title {
        font-size: 1.8rem;
    }
}

/* Tablettes */
@media (min-width: 768px) {
    .animated-gradient-title {
        font-size: 2rem;
    }
}

/* Desktop */
@media (min-width: 1024px) {
    .animated-gradient-title {
        font-size: 2.2rem;
    }
}

/* ============================================
   SOUS-TITRE - RESPONSIVE
   ============================================ */
.institution-subtitle {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.75rem;
}

@media (min-width: 768px) {
    .institution-subtitle {
        font-size: 1.1rem;
        margin-bottom: 1rem;
    }
}

@media (min-width: 1024px) {
    .institution-subtitle {
        font-size: 1.2rem;
    }
}

.title-divider {
    width: 50px;
    height: 3px;
    background: var(--gradient);
    margin: 0.75rem auto;
    border-radius: 3px;
}

@media (min-width: 768px) {
    .title-divider {
        width: 70px;
        margin: 1rem auto;
    }
}

.welcome-text {
    color: var(--text-light);
    font-size: 0.8rem;
    margin-top: 0.5rem;
    font-weight: 500;
}

@media (min-width: 768px) {
    .welcome-text {
        font-size: 0.9rem;
    }
}

/* ============================================
   CHAMPS DE FORMULAIRE - RESPONSIVE
   ============================================ */
.input-group-custom {
    position: relative;
    margin-bottom: 1rem;
}

@media (min-width: 768px) {
    .input-group-custom {
        margin-bottom: 1.5rem;
    }
}

.input-group-custom .input-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    z-index: 2;
    transition: var(--transition);
    font-size: 0.9rem;
}

@media (min-width: 768px) {
    .input-group-custom .input-icon {
        left: 16px;
        font-size: 1rem;
    }
}

.input-group-custom .form-control {
    height: 48px;
    padding-left: 40px;
    padding-right: 40px;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    font-size: 0.9rem;
    transition: var(--transition);
    background: #f8f9fa;
    font-weight: 500;
}

@media (min-width: 768px) {
    .input-group-custom .form-control {
        height: 56px;
        padding-left: 48px;
        padding-right: 48px;
        border-radius: 16px;
        font-size: 1rem;
    }
}

.input-group-custom .form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(41, 128, 185, 0.1);
    outline: none;
    background: white;
}

.input-group-custom .form-control:focus + .input-icon i {
    color: var(--primary-color);
}

.input-group-custom .form-control::placeholder {
    color: #adb5bd;
    font-weight: 400;
    font-size: 0.85rem;
}

@media (min-width: 768px) {
    .input-group-custom .form-control::placeholder {
        font-size: 1rem;
    }
}

/* Effet hover sur les champs */
.input-group-custom:hover .form-control {
    border-color: #cbd5e0;
}

.input-group-custom:hover .input-icon i {
    color: var(--primary-color);
}

/* Toggle Password */
.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    transition: var(--transition);
    z-index: 2;
    font-size: 1rem;
}

@media (min-width: 768px) {
    .toggle-password {
        right: 16px;
        font-size: 1.1rem;
    }
}

.toggle-password:hover {
    color: var(--primary-color);
    transform: translateY(-50%) scale(1.1);
}

/* ============================================
   OPTIONS DU FORMULAIRE - RESPONSIVE
   ============================================ */
.form-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 1.5rem;
}

@media (min-width: 480px) {
    .form-options {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 0;
        margin-bottom: 1.8rem;
    }
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-check-input {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

@media (min-width: 768px) {
    .form-check-input {
        width: 18px;
        height: 18px;
    }
}

.form-check-label {
    color: var(--text-light);
    font-size: 0.85rem;
    cursor: pointer;
    font-weight: 500;
}

@media (min-width: 768px) {
    .form-check-label {
        font-size: 0.9rem;
    }
}

.forgot-password {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    transition: var(--transition);
}

@media (min-width: 768px) {
    .forgot-password {
        font-size: 0.9rem;
    }
}

.forgot-password:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

/* ============================================
   BOUTON DE CONNEXION - RESPONSIVE
   ============================================ */
.btn-login {
    width: 100%;
    height: 48px;
    background: var(--gradient);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 0.9rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    transition: var(--transition);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    letter-spacing: 0.5px;
}

@media (min-width: 768px) {
    .btn-login {
        height: 56px;
        border-radius: 16px;
        font-size: 1rem;
        gap: 0.8rem;
    }
}

.btn-login::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-login:hover::before {
    width: 300px;
    height: 300px;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.btn-login:active {
    transform: translateY(0);
}

.btn-login i {
    transition: transform 0.3s;
    font-size: 0.9rem;
}

@media (min-width: 768px) {
    .btn-login i {
        font-size: 1rem;
    }
}

.btn-login:hover i {
    transform: translateX(5px);
}

/* État de chargement du bouton */
.btn-login.loading {
    opacity: 0.8;
    cursor: wait;
}

.btn-login.loading i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ============================================
   FOOTER DU FORMULAIRE - RESPONSIVE
   ============================================ */
.login-footer {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #e9ecef;
}

@media (min-width: 768px) {
    .login-footer {
        margin-top: 2rem;
        padding-top: 1.5rem;
    }
}

.login-footer p {
    font-size: 0.75rem;
    color: var(--text-light);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

@media (min-width: 768px) {
    .login-footer p {
        font-size: 0.85rem;
        margin-bottom: 0.75rem;
    }
}

.login-footer p i {
    margin-right: 5px;
}

.login-footer small {
    font-size: 0.65rem;
    color: var(--text-light);
}

@media (min-width: 768px) {
    .login-footer small {
        font-size: 0.7rem;
    }
}

/* ============================================
   ALERTES - RESPONSIVE
   ============================================ */
.alert {
    border-radius: 12px;
    border: none;
    padding: 0.75rem;
    margin-bottom: 1rem;
    font-weight: 500;
    font-size: 0.85rem;
}

@media (min-width: 768px) {
    .alert {
        border-radius: 16px;
        padding: 1rem;
        margin-bottom: 1.5rem;
        font-size: 0.9rem;
    }
}

.alert-danger {
    background: linear-gradient(135deg, #fee2e2 0%, #ffe6e6 100%);
    color: #c0392b;
    border-left: 4px solid #c0392b;
}

.alert i {
    margin-right: 8px;
}

/* ============================================
   SÉLECTEUR DE COULEURS FLOTTANT - RESPONSIVE
   ============================================ */
.color-switcher {
    position: fixed;
    bottom: 15px;
    right: 15px;
    display: flex;
    gap: 8px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 8px 10px;
    border-radius: 50px;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

@media (min-width: 768px) {
    .color-switcher {
        bottom: 20px;
        right: 20px;
        gap: 10px;
        padding: 10px 12px;
    }
}

@media (min-width: 1024px) {
    .color-switcher {
        bottom: 30px;
        right: 30px;
        gap: 12px;
        padding: 12px 16px;
    }
}

.color-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid white;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

@media (min-width: 768px) {
    .color-btn {
        width: 35px;
        height: 35px;
        border-width: 2.5px;
    }
}

@media (min-width: 1024px) {
    .color-btn {
        width: 40px;
        height: 40px;
        border-width: 3px;
    }
}

.color-btn:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.color-btn.yellow {
    background: linear-gradient(135deg, #f39c12, #e67e22);
}

.color-btn.green {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
}

.color-btn.blue {
    background: linear-gradient(135deg, #2980b9, #3498db);
}

/* ============================================
   TEST INFO - RESPONSIVE
   ============================================ */
.test-info {
    text-align: center;
    margin-top: 0.75rem;
}

@media (min-width: 768px) {
    .test-info {
        margin-top: 1rem;
    }
}

.test-info small {
    font-size: 0.65rem;
}

@media (min-width: 768px) {
    .test-info small {
        font-size: 0.7rem;
    }
}

.test-info i {
    margin-right: 4px;
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* ============================================
   UTILITAIRES RESPONSIVE
   ============================================ */
.h-100 {
    height: 100%;
}

/* Classes de grid personnalisées si besoin */
.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -15px;
    margin-left: -15px;
}

.col-12 {
    flex: 0 0 100%;
    max-width: 100%;
    padding-right: 15px;
    padding-left: 15px;
}

/* ============================================
   ORIENTATION PAYSAGE (LANDSCAPE)
   ============================================ */
@media (max-width: 768px) and (orientation: landscape) {
    .login-card {
        padding: 1rem;
        max-width: 90%;
    }
    
    .logo-img {
        width: 60px;
        height: 60px;
    }
    
    .animated-gradient-title {
        font-size: 1.2rem;
    }
    
    .institution-subtitle {
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
    }
    
    .input-group-custom .form-control {
        height: 40px;
        font-size: 0.85rem;
    }
    
    .btn-login {
        height: 40px;
        font-size: 0.85rem;
    }
    
    .login-footer {
        margin-top: 1rem;
        padding-top: 0.75rem;
    }
}

/* ============================================
   HAUTE RÉSOLUTION (RETINA)
   ============================================ */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .login-wrapper {
        background-attachment: scroll;
    }
}

/* ============================================
   ACCESSIBILITÉ - RÉDUCTION DES MOUVEMENTS
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .animated-gradient-title {
        animation: none;
        background: linear-gradient(135deg, #2ecc71, #3498db);
        -webkit-background-clip: text;
        background-clip: text;
        -webkit-text-fill-color: transparent;
    }
}