/* ================================
   MODAL LOGIN/REGISTER - EURAVIA
   Version complète sans dépendances
   ================================ */

/* Reset de base */
.modal-overlay,
.modal-overlay * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Overlay de fond sombre */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 99999;
    overflow-y: auto;
}

/* Centrage avec flexbox */
.modal-overlay[style*="display: flex"],
.modal-overlay[style*="display: block"] {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 20px;
}

/* Container principal */
.modal-content {
    background-color: #ffffff;
    width: 100%;
    max-width: 440px;
    border-radius: 10px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    position: relative;
}

/* ====== HEADER ====== */
.modal-header {
    background: linear-gradient(135deg, #2e5c49 0%, #245440 100%);
    color: #ffffff;
    padding: 30px 25px 25px;
    text-align: center;
    position: relative;
}

/* Logo Euravia */
.modal-header .logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 12px;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #ffffff;
}

/* Icône du logo (goutte d'eau en CSS pur) */
.modal-header .logo-icon {
    display: inline-block;
    width: 24px;
    height: 24px;
    position: relative;
}

.modal-header .logo-icon::before {
    content: "💧";
    font-size: 20px;
    position: absolute;
    top: -2px;
    left: 0;
}

/* Alternative sans emoji */
.modal-header .logo-icon svg,
.modal-header .logo-icon i {
    display: none; /* Cache les icônes Feather qui ne chargent pas */
}

/* Titre */
.modal-header h3 {
    font-size: 26px;
    font-weight: 300;
    color: #ffffff;
    margin: 0;
    letter-spacing: -0.5px;
}

/* Bouton fermeture (X) */
.close-modal {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    line-height: 1;
    transition: all 0.2s ease;
}

.close-modal::before {
    content: "×";
    font-weight: 300;
}

.close-modal:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: #ffffff;
    transform: rotate(90deg);
}

/* Cache l'icône Feather qui ne charge pas */
.close-modal i,
.close-modal svg {
    display: none;
}

/* ====== BODY DU MODAL ====== */
.modal-body {
    padding: 35px 30px 30px;
    background-color: #ffffff;
}

/* Messages d'erreur/succès */
#messageContainer {
    margin-bottom: 15px;
}

.error-message,
.success-message {
    padding: 12px 15px;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 15px;
}

.error-message {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
    border-left: 4px solid #dc2626;
}

.success-message {
    background-color: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
    border-left: 4px solid #22c55e;
}

/* ====== FORMULAIRES ====== */
.form-group {
    margin-bottom: 22px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #374151;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input {
    width: 100%;
    padding: 13px 15px;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    font-size: 16px;
    color: #1f2937;
    background-color: #f9fafb;
    transition: all 0.2s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #2e5c49;
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(46, 92, 73, 0.1);
}

.form-group input::placeholder {
    color: #9ca3af;
}

/* ====== BOUTON PRINCIPAL ====== */
.modal-btn,
button.modal-btn {
    display: block;
    width: 100%;
    padding: 15px 20px;
    background: linear-gradient(135deg, #2e5c49 0%, #245440 100%);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 25px;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}

.modal-btn:hover {
    background: linear-gradient(135deg, #245440 0%, #1c3f30 100%);
    transform: translateY(-1px);
    box-shadow: 0 5px 15px rgba(46, 92, 73, 0.3);
}

.modal-btn:active {
    transform: translateY(0);
}

/* État de chargement */
.loading .modal-btn {
    opacity: 0.7;
    pointer-events: none;
}

.loading .modal-btn::after {
    content: "...";
    position: absolute;
    right: 20px;
    animation: dots 1.5s infinite;
}

@keyframes dots {
    0%, 20% { content: "."; }
    40% { content: ".."; }
    60%, 100% { content: "..."; }
}

/* ====== SWITCH MODE ====== */
.switch-mode {
    text-align: center;
    padding-top: 20px;
    margin-top: 20px;
    border-top: 1px solid #e5e7eb;
    color: #6b7280;
    font-size: 14px;
}

.switch-mode a {
    color: #2e5c49;
    text-decoration: none;
    font-weight: 600;
    padding: 2px 0;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.switch-mode a:hover {
    color: #245440;
    border-bottom-color: #245440;
}

/* ====== RESPONSIVE ====== */
@media (max-width: 500px) {
    .modal-overlay[style*="display: flex"],
    .modal-overlay[style*="display: block"] {
        padding: 15px;
    }
    
    .modal-content {
        max-width: 100%;
        border-radius: 8px;
    }
    
    .modal-header {
        padding: 25px 20px 20px;
    }
    
    .modal-header h3 {
        font-size: 22px;
    }
    
    .modal-body {
        padding: 25px 20px;
    }
    
    .form-group {
        margin-bottom: 18px;
    }
    
    /* Force font-size pour éviter le zoom iOS */
    .form-group input {
        font-size: 16px !important;
    }
}

/* ====== UTILITAIRES ====== */

/* Empêche le scroll du body */
body.modal-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

/* Force les styles même si d'autres CSS interfèrent */
#b2bModal .modal-header {
    background: linear-gradient(135deg, #2e5c49 0%, #245440 100%) !important;
}

#b2bModal .modal-header * {
    color: #ffffff !important;
}

#b2bModal .modal-btn {
    background: linear-gradient(135deg, #2e5c49 0%, #245440 100%) !important;
    color: #ffffff !important;
}

#b2bModal .modal-body {
    background-color: #ffffff !important;
}

/* Fix pour les inputs sur mobile */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    .form-group input {
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
    }
}

/* Animation d'apparition simple */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-overlay {
    animation: fadeIn 0.2s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-content {
    animation: slideUp 0.3s ease;
}