/* ==========================================================================
   ARCHIVERSE - AUTH MODAL (CONNEXION & INSCRIPTION)
   ========================================================================== */

/* Arrière-plan flouté */
.auth-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(11, 18, 32, 0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.auth-modal-backdrop.is-active {
    opacity: 1;
    visibility: visible;
}

/* Boîte de la modale */
.auth-modal-card {
    background: #ffffff;
    color: #0f172a;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.95) translateY(10px);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    border: 1px solid rgba(226, 232, 240, 0.8);
    font-family: 'Radio Canada Big', system-ui, -apple-system, sans-serif;
}

/* Support du thème sombre */
[data-theme="dark"] .auth-modal-card,
body.dark-mode .auth-modal-card {
    background: #1A263E;
    color: #f8fafc;
    border-color: #2C3C5A;
}

.auth-modal-backdrop.is-active .auth-modal-card {
    transform: scale(1) translateY(0);
}

/* Bouton Fermer */
.auth-modal-close {
    position: absolute;
    top: 16px;
    right: 18px;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #64748b;
    cursor: pointer;
    line-height: 1;
    padding: 6px;
    border-radius: 8px;
    transition: all 0.2s ease;
    z-index: 10;
}

.auth-modal-close:hover {
    color: #0f172a;
    background: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .auth-modal-close:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

/* En-tête avec onglets */
.auth-modal-header {
    padding: 24px 28px 0 28px;
    border-bottom: 1px solid #e2e8f0;
}

[data-theme="dark"] .auth-modal-header {
    border-color: #2C3C5A;
}

.auth-modal-tabs {
    display: flex;
    gap: 20px;
}

.auth-tab-btn {
    background: none;
    border: none;
    padding: 10px 4px 14px 4px;
    font-family: 'Bricolage Grotesque', sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: #64748b;
    cursor: pointer;
    position: relative;
    transition: color 0.2s ease;
}

[data-theme="dark"] .auth-tab-btn {
    color: #92A2C0;
}

.auth-tab-btn:hover {
    color: #0f172a;
}

[data-theme="dark"] .auth-tab-btn:hover {
    color: #ffffff;
}

.auth-tab-btn.is-active {
    color: #2563eb;
}

[data-theme="dark"] .auth-tab-btn.is-active {
    color: #A8C0F0;
}

.auth-tab-btn.is-active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 3px;
    background: #2563eb;
    border-radius: 3px 3px 0 0;
}

[data-theme="dark"] .auth-tab-btn.is-active::after {
    background: #A8C0F0;
}

/* Corps de la modale avec défilement */
.auth-modal-body {
    padding: 24px 28px;
    overflow-y: auto;
    flex: 1;
}

/* Boîte de message d'alerte */
.auth-alert-box {
    display: none;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 0.9rem;
    margin-bottom: 18px;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.auth-alert-box.is-error {
    display: flex;
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

[data-theme="dark"] .auth-alert-box.is-error {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.3);
}

.auth-alert-box.is-success {
    display: flex;
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

[data-theme="dark"] .auth-alert-box.is-success {
    background: rgba(34, 197, 94, 0.15);
    color: #86efac;
    border-color: rgba(34, 197, 94, 0.3);
}

/* Formulaires & Groupes de champs */
.auth-form-group {
    margin-bottom: 16px;
}

.auth-form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: #334155;
}

[data-theme="dark"] .auth-form-group label {
    color: #cbd5e1;
}

.auth-input, .auth-select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.95rem;
    background: #f8fafc;
    color: #0f172a;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

[data-theme="dark"] .auth-input,
[data-theme="dark"] .auth-select {
    background: #0B1220;
    border-color: #2C3C5A;
    color: #ffffff;
}

.auth-input:focus, .auth-select:focus {
    outline: none;
    border-color: #2563eb;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

[data-theme="dark"] .auth-input:focus,
[data-theme="dark"] .auth-select:focus {
    border-color: #A8C0F0;
    background: #111a2e;
    box-shadow: 0 0 0 3px rgba(168, 192, 240, 0.15);
}

.auth-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* Sections conditionnelles */
.auth-dynamic-section {
    display: none;
    background: rgba(117, 135, 169, 0.06);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    animation: authFadeIn 0.25s ease forwards;
}

[data-theme="dark"] .auth-dynamic-section {
    background: rgba(44, 60, 90, 0.3);
    border-color: #2C3C5A;
}

@keyframes authFadeIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Indicateur de force du mot de passe */
.password-meter-wrap {
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: #64748b;
}

.password-meter-bar {
    flex: 1;
    height: 4px;
    background: #e2e8f0;
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

[data-theme="dark"] .password-meter-bar {
    background: #2C3C5A;
}

.password-meter-fill {
    height: 100%;
    width: 0%;
    transition: width 0.3s ease, background-color 0.3s ease;
}

.password-meter-fill.weak { width: 33%; background-color: #ef4444; }
.password-meter-fill.medium { width: 66%; background-color: #f59e0b; }
.password-meter-fill.strong { width: 100%; background-color: #10b981; }

/* Checkbox CGU */
.auth-checkbox-group {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 14px;
    font-size: 0.85rem;
    color: #475569;
}

[data-theme="dark"] .auth-checkbox-group {
    color: #94a3b8;
}

.auth-checkbox-group input[type="checkbox"] {
    margin-top: 3px;
    cursor: pointer;
}

.auth-checkbox-group a {
    color: #2563eb;
    text-decoration: underline;
}

[data-theme="dark"] .auth-checkbox-group a {
    color: #A8C0F0;
}

/* Bouton principal */
.auth-submit-btn {
    width: 100%;
    padding: 12px 20px;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 12px;
    font-family: 'Bricolage Grotesque', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.25);
}

.auth-submit-btn:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.35);
}

.auth-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Liens bas de formulaire */
.auth-footer-links {
    margin-top: 16px;
    text-align: center;
    font-size: 0.88rem;
    color: #64748b;
}

[data-theme="dark"] .auth-footer-links {
    color: #92A2C0;
}

.auth-footer-links a {
    color: #2563eb;
    text-decoration: none;
    font-weight: 600;
}

[data-theme="dark"] .auth-footer-links a {
    color: #A8C0F0;
}

.auth-footer-links a:hover {
    text-decoration: underline;
}

/* Responsive Mobile */
@media (max-width: 580px) {
    .auth-modal-card {
        max-height: 95vh;
        border-radius: 16px;
    }
    .auth-modal-header {
        padding: 20px 20px 0 20px;
    }
    .auth-modal-body {
        padding: 20px;
    }
    .auth-row-2 {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}
