/*
 * AUTH MODAL CSS - France-Reprog
 * Design inspiré ECU-Files avec panel slider
 * Support thème clair/sombre
 */

/* ============================================
   OVERLAY
   ============================================ */
.auth-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

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

/* ============================================
   MODAL CONTAINER
   ============================================ */
.auth-modal {
    position: relative;
    width: 900px;
    max-width: 95%;
    height: 580px;
    max-height: 90vh;
    background: var(--bg-card, #fff);
    border-radius: 24px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.auth-modal-overlay.active .auth-modal {
    transform: scale(1);
}

/* ============================================
   CLOSE BUTTON
   ============================================ */
.auth-modal-close {
    position: absolute;
    top: 16px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 50%;
    font-size: 20px;
    color: #fff;
    cursor: pointer;
    z-index: 100;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-modal-close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: rotate(90deg);
}

/* ============================================
   INNER CONTAINER
   ============================================ */
.auth-modal-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
}

/* ============================================
   FORM BOXES (Login / Register)
   ============================================ */
.auth-form-box {
    position: absolute;
    width: 50%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 50px 40px;
    box-sizing: border-box;
    transition: opacity 0.4s ease;
    background: var(--bg-card, #fff);
}

/* Login à droite par défaut */
.auth-form-login {
    right: 0;
    opacity: 1;
}

/* Register à gauche, caché par défaut */
.auth-form-register {
    left: 0;
    opacity: 0;
    pointer-events: none;
}

/* Mode Register : inverser */
.auth-modal-container.register-mode .auth-form-login {
    opacity: 0;
    pointer-events: none;
}

.auth-modal-container.register-mode .auth-form-register {
    opacity: 1;
    pointer-events: auto;
}

/* ============================================
   FORM BOX CONTENT
   ============================================ */
.auth-form-box h2 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary, #1a1a2e);
    margin: 0 0 8px;
    text-align: center;
}

.auth-form-box .auth-subtitle {
    font-size: 14px;
    color: var(--text-secondary, #64748b);
    margin: 0 0 30px;
    text-align: center;
}

.auth-form-box form {
    width: 100%;
    max-width: 320px;
}

/* ============================================
   SLIDING PANEL (Rouge France-Reprog)
   ============================================ */
.auth-panel {
    position: absolute;
    width: 50%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    background: linear-gradient(145deg, #e63946 0%, #c62828 100%);
    transition: all 0.6s cubic-bezier(0.68, -0.15, 0.265, 1.15);
    left: 0;
    border-radius: 0 150px 150px 0;
    overflow: hidden;
}

/* Effet décoratif sur le panel */
.auth-panel::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    pointer-events: none;
}

.auth-panel::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -30%;
    width: 80%;
    height: 80%;
    background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 60%);
    pointer-events: none;
}

/* Mode Register : panel slide à droite */
.auth-modal-container.register-mode .auth-panel {
    left: 50%;
    border-radius: 150px 0 0 150px;
}

/* ============================================
   PANEL CONTENT
   ============================================ */
.auth-panel-content {
    text-align: center;
    color: #fff;
    padding: 50px 40px;
    max-width: 320px;
}

.auth-panel-icon {
    width: 70px;
    height: 70px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    font-size: 28px;
    color: #fff;
}

.auth-panel-content h3 {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 16px;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.auth-panel-content p {
    font-size: 15px;
    color: #fff;
    opacity: 1;
    margin: 0 0 32px;
    line-height: 1.7;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Switch button */
.auth-panel-switch {
    background: #fff;
    border: none;
    color: #e63946;
    padding: 16px 48px;
    border-radius: 50px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.auth-panel-switch:hover {
    background: #fff;
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

/* ============================================
   INPUT STYLES
   ============================================ */
.auth-input-row {
    display: flex;
    gap: 12px;
}

.auth-input-row .auth-input-group {
    flex: 1;
}

.auth-input-group {
    position: relative;
    margin-bottom: 18px;
}

.auth-input-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary, #1a1a2e);
    margin-bottom: 6px;
}

.auth-input-group input {
    width: 100%;
    padding: 14px 45px 14px 16px;
    border: 2px solid var(--border-color, #e2e8f0);
    border-radius: 12px;
    font-size: 14px;
    background: var(--bg-input, #fff);
    color: var(--text-primary, #1a1a2e);
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.auth-input-group input::placeholder {
    color: var(--text-muted, #94a3b8);
}

.auth-input-group input:focus {
    outline: none;
    border-color: #e63946;
    box-shadow: 0 0 0 4px rgba(230, 57, 70, 0.15);
}

.auth-input-group input.error {
    border-color: #ef4444;
}

/* Password toggle icon */
.auth-input-group .toggle-password {
    position: absolute;
    right: 14px;
    top: 38px;
    background: none;
    border: none;
    color: var(--text-muted, #94a3b8);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-input-group .toggle-password:hover {
    color: var(--text-secondary, #64748b);
}

/* Error text */
.auth-input-group .error-text {
    display: block;
    color: #ef4444;
    font-size: 12px;
    margin-top: 4px;
}

/* ============================================
   FORM OPTIONS
   ============================================ */
.auth-form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    font-size: 13px;
}

.auth-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary, #64748b);
    cursor: pointer;
}

.auth-checkbox input {
    width: 16px;
    height: 16px;
    accent-color: #e63946;
}

.auth-forgot-link {
    color: #e63946;
    font-size: 13px;
    text-decoration: none;
}

.auth-forgot-link:hover {
    text-decoration: underline;
}

/* Checkbox CGU */
.auth-cgu-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 12px;
    color: var(--text-secondary, #64748b);
    margin-bottom: 20px;
    line-height: 1.4;
}

.auth-cgu-checkbox input {
    margin-top: 2px;
    width: 16px;
    height: 16px;
    accent-color: #e63946;
    flex-shrink: 0;
}

.auth-cgu-checkbox a {
    color: #e63946;
}

/* ============================================
   SUBMIT BUTTON
   ============================================ */
.auth-submit-btn {
    width: 100%;
    padding: 16px 24px;
    background: linear-gradient(135deg, #e63946 0%, #c62828 100%);
    border: none;
    border-radius: 12px;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.auth-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(230, 57, 70, 0.4);
}

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

.auth-submit-btn .spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   ALERT MESSAGES
   ============================================ */
.auth-alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 13px;
    width: 100%;
    max-width: 320px;
    animation: slideDown 0.3s ease;
}

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

.auth-alert.error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.auth-alert.success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

/* ============================================
   SUCCESS STATE
   ============================================ */
.auth-success-state {
    display: none;
    text-align: center;
    padding: 20px;
}

.auth-success-state.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.auth-success-state .success-icon {
    width: 80px;
    height: 80px;
    background: rgba(34, 197, 94, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    color: #22c55e;
    font-size: 2.5rem;
}

.auth-success-state h3 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary, #1a1a2e);
    margin-bottom: 10px;
}

.auth-success-state p {
    color: var(--text-secondary, #64748b);
    margin-bottom: 25px;
    font-size: 14px;
}

/* ============================================
   THEME SOMBRE
   ============================================ */
[data-theme="dark"] .auth-modal {
    background: #111113;
}

[data-theme="dark"] .auth-form-box {
    background: #111113;
}

[data-theme="dark"] .auth-form-box h2 {
    color: #fff;
}

[data-theme="dark"] .auth-form-box .auth-subtitle {
    color: #a1a1aa;
}

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

[data-theme="dark"] .auth-input-group input {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

[data-theme="dark"] .auth-input-group input::placeholder {
    color: #71717a;
}

[data-theme="dark"] .auth-input-group input:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: #e63946;
}

[data-theme="dark"] .auth-checkbox,
[data-theme="dark"] .auth-cgu-checkbox {
    color: #a1a1aa;
}

[data-theme="dark"] .auth-input-group .toggle-password {
    color: #71717a;
}

[data-theme="dark"] .auth-input-group .toggle-password:hover {
    color: #a1a1aa;
}

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

[data-theme="dark"] .auth-success-state h3 {
    color: #fff;
}

[data-theme="dark"] .auth-success-state p {
    color: #a1a1aa;
}

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

[data-theme="dark"] .auth-alert.success {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}

/* ============================================
   RESPONSIVE - TABLETTE
   ============================================ */
@media (max-width: 900px) {
    .auth-modal {
        width: 95%;
        max-width: 500px;
        height: auto;
        max-height: 90vh;
    }

    .auth-modal-container {
        flex-direction: column;
    }

    /* Cacher le panel sur tablette/mobile */
    .auth-panel {
        display: none !important;
    }

    /* Form boxes en pleine largeur */
    .auth-form-box {
        position: relative !important;
        width: 100% !important;
        height: auto !important;
        padding: 40px 30px !important;
        display: none;
    }

    .auth-form-box.auth-form-login {
        display: flex !important;
    }

    .auth-form-box.auth-form-register {
        display: none !important;
    }

    .auth-modal-container.register-mode .auth-form-box.auth-form-login {
        display: none !important;
    }

    .auth-modal-container.register-mode .auth-form-box.auth-form-register {
        display: flex !important;
    }

    .auth-form-box form {
        max-width: 100%;
    }

    .auth-input-row {
        flex-direction: column;
        gap: 0;
    }

    /* Close button sur fond sombre pour être visible */
    .auth-modal-close {
        background: var(--bg-hover, #f1f5f9);
        color: var(--text-secondary, #64748b);
    }

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

    /* Tabs mobiles pour switcher */
    .auth-mobile-tabs {
        display: flex !important;
        border-bottom: 1px solid var(--border-color, #e2e8f0);
    }
}

/* ============================================
   MOBILE TABS (visible uniquement sur mobile)
   ============================================ */
.auth-mobile-tabs {
    display: none;
    background: var(--bg-card, #fff);
}

.auth-mobile-tab {
    flex: 1;
    padding: 16px;
    background: none;
    border: none;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted, #94a3b8);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.auth-mobile-tab.active {
    color: #e63946;
}

.auth-mobile-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: #e63946;
    border-radius: 3px 3px 0 0;
}

[data-theme="dark"] .auth-mobile-tabs {
    background: #111113;
    border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .auth-mobile-tab {
    color: #71717a;
}

[data-theme="dark"] .auth-mobile-tab.active {
    color: #e63946;
}

/* ============================================
   SWITCH LINK (Mobile)
   ============================================ */
.auth-switch-link {
    text-align: center;
    margin-top: 24px;
    font-size: 14px;
    color: var(--text-secondary, #64748b);
}

.auth-switch-link a {
    color: #e63946;
    font-weight: 600;
    cursor: pointer;
}

.auth-switch-link a:hover {
    text-decoration: underline;
}

@media (min-width: 901px) {
    .auth-switch-link {
        display: none;
    }
}

/* ============================================
   GOOGLE SIGN-IN BUTTON (Modal)
   ============================================ */

.auth-form-box .auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
}

.auth-form-box .auth-divider::before,
.auth-form-box .auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color, rgba(255, 255, 255, 0.1));
}

.auth-form-box .auth-divider span {
    font-size: 12px;
    color: var(--text-secondary, #64748b);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.btn-google-modal {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.05);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-google-modal:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.25);
}

.btn-google-modal svg {
    flex-shrink: 0;
}

/* Theme clair */
[data-theme="light"] .btn-google-modal {
    background: #ffffff;
    color: #3c4043;
    border-color: #dadce0;
}

[data-theme="light"] .btn-google-modal:hover {
    background: #f8f9fa;
    border-color: #c6c6c6;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ============================================
   GOOGLE BUTTONS POSITION
   ============================================ */
.btn-google-top {
    width: 100%;
    max-width: 320px;
    margin-bottom: 0;
}

.btn-google-bottom {
    margin-top: 20px;
    width: 100%;
    max-width: 320px;
}

.auth-divider-top {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0 20px;
    width: 100%;
    max-width: 320px;
}

.auth-divider-top::before,
.auth-divider-top::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color, rgba(255, 255, 255, 0.1));
}

.auth-divider-top span {
    font-size: 12px;
    color: var(--text-secondary, #64748b);
    text-transform: lowercase;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

[data-theme="light"] .auth-divider-top::before,
[data-theme="light"] .auth-divider-top::after {
    background: #e2e8f0;
}

[data-theme="light"] .btn-google-top {
    background: #ffffff;
    color: #3c4043;
    border-color: #dadce0;
}

[data-theme="light"] .btn-google-top:hover {
    background: #f8f9fa;
    border-color: #c6c6c6;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ============================================
   FIX MOBILE - REGISTER FULL WIDTH
   ============================================ */
@media (max-width: 900px) {
    .auth-form-box .btn-google-top,
    .auth-form-box .auth-divider-top {
        max-width: 100%;
    }

    .auth-alert {
        max-width: 100%;
    }
}

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

/* Classe pour cacher des éléments (utilisée par JS) */
.hidden {
    display: none !important;
}
