/* ============================================
   MODALE COMPTE - DESKTOP
   ============================================ */

/* Desktop uniquement - Modale classique centrée */
@media (min-width: 769px) {
    /* Overlay */
    #authOverlay,
    .modal-overlay {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        background: rgba(0, 0, 0, 0.6) !important;
        backdrop-filter: blur(8px) !important;
        -webkit-backdrop-filter: blur(8px) !important;
        z-index: 9999 !important;
        opacity: 0 !important;
        visibility: hidden !important;
        transition: opacity 0.3s ease, visibility 0s 0.3s;
        pointer-events: none !important;
        display: none !important;
    }
    
    #authOverlay.active,
    .modal-overlay.active {
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
        display: block !important;
        transition: opacity 0.3s ease, visibility 0s 0s;
    }
    
    /* Modale centrée - Taille réduite */
    #authModal {
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) scale(0.98);
        width: 90%;
        max-width: 580px;
        max-height: 85vh;
        min-height: 520px;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(20px) saturate(180%);
        -webkit-backdrop-filter: blur(20px) saturate(180%);
        border-radius: 24px;
        box-shadow: 0 25px 70px rgba(0, 0, 0, 0.3);
        z-index: 10000 !important;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s 0.2s, max-height 0.3s ease;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        pointer-events: none;
    }
    
    #authModal.active {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: translate(-50%, -50%) scale(1);
        transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s 0s, max-height 0.3s ease;
    }
    
    /* Mode inscription - Modale plus compacte */
    #authModal.register-mode {
        max-height: 88vh;
        min-height: 600px;
    }
    
    /* Réduire les espacements en mode inscription */
    #authModal.register-mode .modal__content {
        padding: 40px 32px 45px;
    }
    
    #authModal.register-mode .auth-toggle {
        margin-bottom: 14px;
    }
    
    #authModal.register-mode .form-group {
        margin-bottom: 8px;
    }
    
    #authModal.register-mode .form-row {
        margin-bottom: 8px;
    }
    
    #authModal.register-mode .form-label {
        margin-bottom: 5px;
        font-size: 13px;
    }
    
    #authModal.register-mode .form-input {
        padding: 10px 13px;
        font-size: 13.5px;
    }
    
    #authModal.register-mode .form-options {
        margin-bottom: 12px;
        margin-top: 8px;
    }
    
    #authModal.register-mode .btn {
        padding: 12px 20px;
        font-size: 14px;
    }
    
    #authModal.register-mode .input-icon-btn {
        width: 30px;
        height: 30px;
        right: 6px;
        font-size: 13px;
    }
    
    #authModal.register-mode .input-icon-btn i {
        font-size: 13px;
    }
    
    #authModal.register-mode .input-with-icon .form-input {
        padding-right: 40px;
    }
    
    /* Pas de handle sur desktop */
    #authModal::before {
        display: none;
    }
    
    /* Bouton fermer - CROIX BIEN VISIBLE */
    #authModal .modal__close,
    #authModal #closeAuthModal {
        position: absolute !important;
        top: 28px !important;
        right: 28px !important;
        width: 48px !important;
        height: 48px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        background: rgba(184, 70, 31, 0.12) !important;
        border: 2px solid rgba(184, 70, 31, 0.2) !important;
        border-radius: 14px !important;
        color: #B8461F !important;
        font-size: 32px !important;
        font-weight: 300 !important;
        line-height: 1 !important;
        cursor: pointer !important;
        z-index: 100 !important;
        transition: all 0.2s ease !important;
        opacity: 1 !important;
        visibility: visible !important;
    }
    
    #authModal .modal__close:hover,
    #authModal #closeAuthModal:hover {
        background: rgba(184, 70, 31, 0.25) !important;
        border-color: rgba(184, 70, 31, 0.4) !important;
        transform: scale(1.1) rotate(90deg) !important;
        color: #9a3819 !important;
    }
    
    #authModal .modal__close:active,
    #authModal #closeAuthModal:active {
        transform: scale(0.95) rotate(90deg) !important;
    }
    
    /* Contenu de la modale - scrollable seulement si nécessaire */
    .modal__content {
        flex: 1;
        overflow-y: auto;
        overflow-x: hidden;
        overscroll-behavior: contain;
        padding: 45px 35px 35px;
        opacity: 0;
        transform: translateY(10px);
        transition: opacity 0.25s ease 0.1s, transform 0.25s ease 0.1s;
        scrollbar-width: thin;
        scrollbar-color: rgba(184, 70, 31, 0.3) transparent;
    }
    
    #authModal.active .modal__content {
        opacity: 1;
        transform: translateY(0);
    }
    
    /* Scrollbar personnalisée - apparaît seulement au survol ou si nécessaire */
    .modal__content::-webkit-scrollbar {
        width: 6px;
    }
    
    .modal__content::-webkit-scrollbar-track {
        background: transparent;
    }
    
    .modal__content::-webkit-scrollbar-thumb {
        background: transparent;
        border-radius: 4px;
        transition: background 0.2s ease;
    }
    
    .modal__content:hover::-webkit-scrollbar-thumb {
        background: rgba(184, 70, 31, 0.3);
    }
    
    .modal__content::-webkit-scrollbar-thumb:hover {
        background: rgba(184, 70, 31, 0.5);
    }
    
    /* Toggle Connexion/Inscription */
    .auth-toggle {
        display: flex;
        gap: 8px;
        margin-bottom: 20px;
        position: relative;
        background: rgba(184, 70, 31, 0.05);
        border-radius: 12px;
        padding: 4px;
        opacity: 0;
        transform: translateY(-5px);
        transition: opacity 0.3s ease 0.15s, transform 0.3s ease 0.15s;
    }
    
    #authModal.active .auth-toggle {
        opacity: 1;
        transform: translateY(0);
    }
    
    .auth-toggle__btn {
        flex: 1;
        padding: 12px 18px;
        font-size: 15px;
        font-weight: 600;
        color: #6b7280;
        background: transparent;
        border: none;
        border-radius: 10px;
        cursor: pointer;
        transition: all 0.3s ease;
        position: relative;
        z-index: 2;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
    }
    
    .auth-toggle__btn.active {
        color: white;
    }
    
    .auth-toggle__btn:hover:not(.active) {
        color: #B8461F;
    }
    
    .auth-toggle__btn i {
        font-size: 14px;
    }
    
    .auth-toggle__slider {
        position: absolute;
        top: 4px;
        left: 4px;
        width: calc(50% - 4px);
        height: calc(100% - 8px);
        background: linear-gradient(135deg, #B8461F 0%, #9a3819 100%);
        border-radius: 10px;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1;
        box-shadow: 0 3px 10px rgba(184, 70, 31, 0.35);
    }
    
    .auth-toggle.register .auth-toggle__slider {
        transform: translateX(calc(100% + 4px));
    }
    
    /* Formulaires */
    .auth-forms {
        position: relative;
        opacity: 0;
        transform: translateY(5px);
        transition: opacity 0.3s ease 0.2s, transform 0.3s ease 0.2s;
    }
    
    #authModal.active .auth-forms {
        opacity: 1;
        transform: translateY(0);
    }
    
    .auth-form {
        display: none;
        animation: fadeInForm 0.25s ease;
    }
    
    .auth-form--active {
        display: block;
    }
    
    @keyframes fadeInForm {
        from {
            opacity: 0;
            transform: translateY(8px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    
    .form-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        margin-bottom: 10px;
    }
    
    .form-group {
        margin-bottom: 10px;
        opacity: 0;
        animation: slideInUp 0.3s ease forwards;
    }
    
    .form-group:nth-child(1) { animation-delay: 0.25s; }
    .form-group:nth-child(2) { animation-delay: 0.3s; }
    .form-group:nth-child(3) { animation-delay: 0.35s; }
    .form-group:nth-child(4) { animation-delay: 0.4s; }
    .form-group:nth-child(5) { animation-delay: 0.45s; }
    
    @keyframes slideInUp {
        from {
            opacity: 0;
            transform: translateY(10px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    
    .form-label {
        display: flex;
        align-items: center;
        gap: 6px;
        font-size: 14px;
        font-weight: 600;
        color: #374151;
        margin-bottom: 7px;
    }
    
    .form-label i {
        font-size: 13px;
        color: #B8461F;
    }
    
    .form-input {
        width: 100%;
        padding: 12px 15px;
        font-size: 14px;
        color: #1a1a1a;
        background: rgba(255, 255, 255, 0.9);
        border: 1.5px solid rgba(0, 0, 0, 0.1);
        border-radius: 11px;
        transition: all 0.2s ease;
    }
    
    .form-input:focus {
        outline: none;
        border-color: #B8461F;
        background: white;
        box-shadow: 0 0 0 4px rgba(184, 70, 31, 0.12);
    }
    
    .form-input:hover:not(:focus) {
        border-color: rgba(184, 70, 31, 0.35);
    }
    
    .input-with-icon {
        position: relative;
        display: block;
        width: 100%;
    }
    
    .input-with-icon .form-input {
        padding-right: 48px;
        width: 100%;
        display: block;
    }
    
    .input-icon-btn {
        position: absolute !important;
        right: 8px !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        width: 34px !important;
        height: 34px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        background: transparent !important;
        border: none !important;
        color: #6b7280 !important;
        cursor: pointer !important;
        transition: all 0.2s ease !important;
        border-radius: 8px !important;
        font-size: 14px !important;
        padding: 0 !important;
        margin: 0 !important;
        z-index: 10 !important;
    }
    
    .input-icon-btn:hover {
        color: #B8461F;
        background: rgba(184, 70, 31, 0.08);
    }
    
    .input-icon-btn i {
        font-size: 14px;
    }
    
    /* Options du formulaire */
    .form-options {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 12px;
        font-size: 13px;
        opacity: 0;
        animation: slideInUp 0.3s ease 0.5s forwards;
    }
    
    .form-checkbox {
        display: flex;
        align-items: center;
        gap: 10px;
        cursor: pointer;
    }
    
    .form-checkbox input[type="checkbox"] {
        display: none;
    }
    
    .checkbox-mark {
        width: 20px;
        height: 20px;
        border: 2px solid rgba(0, 0, 0, 0.2);
        border-radius: 5px;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.2s ease;
    }
    
    .form-checkbox:hover .checkbox-mark {
        border-color: #B8461F;
    }
    
    .form-checkbox input[type="checkbox"]:checked + .checkbox-mark {
        background: #B8461F;
        border-color: #B8461F;
    }
    
    .form-checkbox input[type="checkbox"]:checked + .checkbox-mark::after {
        content: '✓';
        color: white;
        font-size: 13px;
        font-weight: bold;
    }
    
    .form-link {
        color: #B8461F;
        text-decoration: none;
        font-weight: 500;
        transition: all 0.2s ease;
    }
    
    .form-link:hover {
        color: #9a3819;
        text-decoration: underline;
    }
    
    /* Boutons dans la modale uniquement */
    #authModal .btn,
    .modal-overlay .btn {
        width: 100%;
        padding: 13px 22px;
        font-size: 15px;
        font-weight: 700;
        border: none;
        border-radius: 11px;
        cursor: pointer;
        transition: all 0.2s ease;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        opacity: 0;
        animation: slideInUp 0.3s ease 0.55s forwards;
    }
    
    #authModal .btn--full,
    .modal-overlay .btn--full {
        width: 100%;
    }
    
    #authModal .btn--gradient,
    .modal-overlay .btn--gradient {
        background: linear-gradient(135deg, #B8461F 0%, #9a3819 100%);
        color: white;
        box-shadow: 0 4px 12px rgba(184, 70, 31, 0.3);
    }
    
    #authModal .btn--gradient:hover,
    .modal-overlay .btn--gradient:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 16px rgba(184, 70, 31, 0.4);
    }
    
    #authModal .btn--gradient:active,
    .modal-overlay .btn--gradient:active {
        transform: translateY(0);
        box-shadow: 0 2px 8px rgba(184, 70, 31, 0.3);
    }
    
    #authModal .btn--social,
    .modal-overlay .btn--social {
        background: white;
        color: #374151;
        border: 1px solid rgba(0, 0, 0, 0.1);
        margin-top: 10px;
    }
    
    #authModal .btn--social:hover,
    .modal-overlay .btn--social:hover {
        background: rgba(0, 0, 0, 0.02);
        border-color: rgba(0, 0, 0, 0.2);
        transform: translateY(-1px);
    }
    
    #authModal .btn--social:active,
    .modal-overlay .btn--social:active {
        background: rgba(0, 0, 0, 0.05);
        transform: translateY(0);
    }
    
    #authModal .btn i,
    .modal-overlay .btn i {
        font-size: 15px;
    }
    
    /* Divider */
    .auth-divider {
        display: flex;
        align-items: center;
        text-align: center;
        margin: 14px 0;
        color: #6b7280;
        font-size: 13px;
    }
    
    .auth-divider::before,
    .auth-divider::after {
        content: '';
        flex: 1;
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    }
    
    .auth-divider::before {
        margin-right: 14px;
    }
    
    .auth-divider::after {
        margin-left: 14px;
    }
}

/* Empêcher le scroll du body quand la modale est ouverte */
body.modal-open {
    overflow: hidden;
}


/* ============================================
   MESSAGE DE NOTIFICATION DANS LA MODALE
   ============================================ */

.auth-modal-message {
    padding: 16px 20px;
    border-radius: 16px;
    margin: 16px 0;
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 15px;
    font-weight: 500;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.auth-modal-message::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.4);
    animation: progressBar 3s linear;
}

@keyframes progressBar {
    from {
        width: 100%;
    }
    to {
        width: 0%;
    }
}

.auth-modal-message.show {
    opacity: 1;
    transform: translateY(0);
}

.auth-modal-message--success {
    background: linear-gradient(135deg, #B8461F 0%, #8B2F0F 100%);
    color: white;
    box-shadow: 0 8px 24px rgba(184, 70, 31, 0.35);
}

.auth-modal-message--error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 8px 24px rgba(239, 68, 68, 0.35);
}

.auth-modal-message i {
    font-size: 22px;
    flex-shrink: 0;
    animation: iconPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes iconPop {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

.auth-modal-message span {
    flex: 1;
    line-height: 1.5;
    letter-spacing: 0.01em;
}

/* Desktop */
@media (min-width: 769px) {
    .auth-modal-message {
        margin: 20px 0;
        padding: 16px 24px;
        font-size: 15px;
        border-radius: 16px;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .auth-modal-message {
        margin: 14px 20px;
        padding: 16px 20px;
        font-size: 15px;
        border-radius: 14px;
    }
}
