/**
 * AUTH MODERN - Pages de connexion/inscription modernes
 * Avec fond animé et design épuré
 */

/* ===================================
   FOND AVEC BULLES SUBTILES SUR BODY
   =================================== */
body.auth-page {
    background: var(--bg-primary) !important;
    position: relative;
    min-height: 100vh;
}

/* Bulles décoratives subtiles en arrière-plan */
body.auth-page::before {
    content: '';
    position: fixed;
    top: -10%;
    right: -5%;
    width: 500px;
    height: 500px;
    background: var(--primary-color);
    opacity: 0.03;
    border-radius: 50%;
    z-index: 0;
    pointer-events: none;
}

body.auth-page::after {
    content: '';
    position: fixed;
    bottom: -10%;
    left: -5%;
    width: 600px;
    height: 600px;
    background: var(--primary-light);
    opacity: 0.03;
    border-radius: 50%;
    z-index: 0;
    pointer-events: none;
}

/* ===================================
   SECTION AUTH
   =================================== */
.auth-modern-page {
    width: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 1rem;
    min-height: 600px;
}

/* ===================================
   CONTAINER ET CARTE
   =================================== */
.auth-modern-container {
    width: 100%;
    max-width: 480px;
    position: relative;
    z-index: 2;
}

.auth-modern-card {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 24px;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    padding: 3rem 2.5rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.auth-modern-card:hover {
    transform: translateY(-5px);
    box-shadow:
        0 30px 80px rgba(0, 0, 0, 0.2),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

/* ===================================
   EN-TÊTE
   =================================== */
.auth-modern-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.auth-modern-logo {
    width: 64px;
    height: 64px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 30px rgba(68, 124, 172, 0.3);
}

.auth-modern-logo i {
    font-size: 28px;
    color: white;
}

.auth-modern-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 0.5rem;
    letter-spacing: -0.5px;
}

.auth-modern-header p {
    font-size: 15px;
    color: #64748b;
    margin: 0;
}

/* ===================================
   FORMULAIRES
   =================================== */
.auth-modern-form {
    margin-top: 2rem;
}

.form-group-modern {
    margin-bottom: 1.25rem;
}

.form-group-modern label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 0.5rem;
}

.input-modern {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 15px;
    color: #1e293b;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    transition: all 0.2s ease;
    outline: none;
}

.input-modern:focus {
    background: white;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(68, 124, 172, 0.1);
}

.input-modern::placeholder {
    color: #94a3b8;
}

/* Input avec icône */
.input-with-icon {
    position: relative;
    display: block;
}

/* Icône gauche (enfant direct uniquement, pas celle du toggle) */
.input-with-icon > i:first-child {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 16px;
    z-index: 1;
    pointer-events: none;
}

.input-with-icon .input-modern {
    padding-left: 2.75rem;
}

/* Input avec toggle password : ajouter padding à droite */
/* Fallback pour navigateurs sans :has() */
.input-with-icon .input-modern[type="password"],
.input-with-icon .input-modern[type="text"] + .password-toggle-modern ~ .input-modern,
.input-with-icon:has(.password-toggle-modern) .input-modern {
    padding-right: 3rem;
}

/* Row pour 2 champs côte à côte */
.form-row-modern {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Toggle password */
.password-toggle-modern {
    position: absolute !important;
    right: 1rem !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    left: auto !important;
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 0.25rem;
    transition: color 0.2s;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    width: auto;
    height: auto;
}

/* Reset complet de l'icône dans le toggle */
.password-toggle-modern i,
.password-toggle-modern i.fas,
.password-toggle-modern i.fa-eye,
.password-toggle-modern i.fa-eye-slash {
    position: static !important;
    left: auto !important;
    top: auto !important;
    transform: none !important;
    font-size: 16px;
    color: inherit;
    pointer-events: none;
}

.password-toggle-modern:hover {
    color: var(--primary-color);
}

/* ===================================
   BOUTONS
   =================================== */
.btn-modern {
    width: 100%;
    padding: 0.875rem 1.5rem;
    font-size: 15px;
    font-weight: 600;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-modern-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(68, 124, 172, 0.3);
}

.btn-modern-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(68, 124, 172, 0.4);
}

.btn-modern-primary:active {
    transform: translateY(0);
}

.btn-modern-ghost {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid #e2e8f0;
}

.btn-modern-ghost:hover {
    background: #f8fafc;
    border-color: var(--primary-color);
}

/* Bouton Google */
.btn-google-modern {
    width: 100%;
    padding: 0.875rem 1.5rem;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    position: relative;
}

.btn-google-modern:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.btn-google-modern svg {
    width: 20px;
    height: 20px;
}

.recommended-badge-modern {
    position: absolute;
    top: -8px;
    right: 10px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===================================
   DIVIDER
   =================================== */
.divider-modern {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 2rem 0;
}

.divider-modern::before,
.divider-modern::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #e2e8f0;
}

.divider-modern span {
    padding: 0 1rem;
    color: #94a3b8;
    font-size: 14px;
    font-weight: 500;
}

/* ===================================
   OPTIONS ET FOOTER
   =================================== */
.form-options-modern {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 1.5rem 0;
    font-size: 14px;
}

.checkbox-modern {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
}

.checkbox-modern input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.checkbox-modern span {
    color: #64748b;
}

.forgot-link-modern {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.forgot-link-modern:hover {
    color: var(--primary-dark);
}

.auth-footer-modern {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #e2e8f0;
    text-align: center;
}

.auth-footer-modern p {
    color: #64748b;
    font-size: 14px;
    margin-bottom: 1rem;
}

.auth-footer-modern a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.auth-footer-modern a:hover {
    color: var(--primary-dark);
}

/* ===================================
   ALERTS
   =================================== */
.alert-modern {
    padding: 1rem 1.25rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    font-size: 14px;
    line-height: 1.5;
}

.alert-modern i {
    margin-top: 2px;
    font-size: 16px;
}

.alert-error-modern {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-success-modern {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.alert-warning-modern {
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fde68a;
}

/* ===================================
   PASSWORD STRENGTH
   =================================== */
.password-strength-modern {
    margin-top: 0.5rem;
    height: 4px;
    background: #e2e8f0;
    border-radius: 2px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.password-strength-modern .strength-bar {
    height: 100%;
    transition: width 0.3s ease, background-color 0.3s ease;
    border-radius: 2px;
}

.password-strength-modern[data-strength="weak"] .strength-bar {
    width: 33%;
    background: #ef4444;
}

.password-strength-modern[data-strength="medium"] .strength-bar {
    width: 66%;
    background: #f59e0b;
}

.password-strength-modern[data-strength="strong"] .strength-bar {
    width: 100%;
    background: #10b981;
}

/* ===================================
   RESPONSIVE
   =================================== */
@media (max-width: 768px) {
    .auth-modern-container {
        max-width: 100%;
    }

    .auth-modern-card {
        padding: 2rem 1.5rem;
        border-radius: 20px;
    }

    .auth-modern-header h1 {
        font-size: 24px;
    }

    .form-row-modern {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .auth-modern-page {
        padding: 1rem 0.75rem;
    }

    .auth-modern-card {
        padding: 1.5rem 1.25rem;
    }

    .btn-google-modern {
        padding: 0.75rem 1rem;
        font-size: 14px;
    }

    .recommended-badge-modern {
        font-size: 10px;
        padding: 2px 6px;
    }
}

/* ===================================
   ANIMATIONS
   =================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-modern-card {
    animation: fadeInUp 0.6s ease-out;
}

/* ===================================
   OAUTH TERMS NOTICE
   =================================== */
.oauth-terms-notice {
    text-align: center;
    font-size: 12px;
    color: #94a3b8;
    margin: 0.75rem 0 0;
    line-height: 1.4;
}

.oauth-terms-notice a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.oauth-terms-notice a:hover {
    text-decoration: underline;
}

/* ===================================
   ALIASES POUR COMPATIBILITE
   (Classes utilisées dans login.php)
   =================================== */
.auth-container {
    max-width: 650px !important;
    margin: 0 auto;
    padding: clamp(4rem, 6vw, 6rem) clamp(1rem, 3vw, 2rem);
    position: relative;
    z-index: 1;
}

.auth-card {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 24px;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    padding: 3rem 2.5rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    max-width: 100% !important;
    width: 100% !important;
    animation: fadeInUp 0.6s ease-out;
}

.auth-card:hover {
    transform: translateY(-5px);
    box-shadow:
        0 30px 80px rgba(0, 0, 0, 0.2),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

.auth-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.auth-logo {
    width: 64px;
    height: 64px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 30px rgba(68, 124, 172, 0.3);
}

.auth-logo i {
    font-size: 28px;
    color: white;
}

.auth-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary, #1a202c);
    margin-bottom: 0.5rem;
    letter-spacing: -0.5px;
}

.auth-header p {
    font-size: 15px;
    color: var(--text-secondary, #64748b);
    margin: 0;
}

.auth-form {
    margin-top: 2rem;
}

/* Responsive pour les aliases */
@media (max-width: 768px) {
    .auth-container {
        max-width: 100%;
    }

    .auth-card {
        padding: 2rem 1.5rem;
        border-radius: 20px;
    }

    .auth-header h1 {
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .auth-container {
        padding: 1rem 0.75rem;
    }

    .auth-card {
        padding: 1.5rem 1.25rem;
    }
}

/* ===================================
   AUTH ICON (alias pour auth-logo)
   =================================== */
.auth-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 30px rgba(68, 124, 172, 0.3);
}

.auth-icon i {
    font-size: 28px;
    color: white;
}

/* ===================================
   SUCCESS STATE (forgot_password)
   =================================== */
.success-state {
    text-align: center;
    padding: 1rem 0;
}

.success-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 30px rgba(16, 185, 129, 0.3);
}

.success-icon i {
    font-size: 36px;
    color: white;
}

.success-state h2 {
    font-size: 20px;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 0.75rem;
}

.success-state p {
    font-size: 14px;
    color: #64748b;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

/* ===================================
   INFO NOTE
   =================================== */
.info-note {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 13px;
    color: #0369a1;
    text-align: left;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.info-note i {
    margin-top: 2px;
    flex-shrink: 0;
}

/* ===================================
   FORM GROUP (alias pour form-group-modern)
   =================================== */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 0.5rem;
}

/* ===================================
   ALERTS (alias pour alert-modern)
   =================================== */
.alert {
    padding: 1rem 1.25rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    font-size: 14px;
    line-height: 1.5;
}

.alert i {
    margin-top: 2px;
    font-size: 16px;
    flex-shrink: 0;
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-error i {
    color: #ef4444;
}

.alert-success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.alert-success i {
    color: #10b981;
}

/* ===================================
   AUTH FOOTER (alias pour auth-footer-modern)
   =================================== */
.auth-footer {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e2e8f0;
    text-align: center;
}

.auth-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: color 0.2s;
}

.auth-footer a:hover {
    color: var(--primary-dark);
}

/* ===================================
   WELCOME BONUS BANNER (register)
   =================================== */
.welcome-bonus-banner {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    animation: slideDown 0.4s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.welcome-bonus-banner.referral-banner {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    border: 1px solid #86efac;
}

.welcome-bonus-banner.affiliate-banner {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border: 1px solid #93c5fd;
}

.welcome-bonus-banner .bonus-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.referral-banner .bonus-icon {
    background: #22c55e;
    color: white;
}

.affiliate-banner .bonus-icon {
    background: #3b82f6;
    color: white;
}

.welcome-bonus-banner .bonus-icon i {
    font-size: 1.25rem;
}

.welcome-bonus-banner .bonus-content {
    flex: 1;
}

.welcome-bonus-banner .bonus-content strong {
    display: block;
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.referral-banner .bonus-content strong {
    color: #166534;
}

.affiliate-banner .bonus-content strong {
    color: #1e40af;
}

.welcome-bonus-banner .bonus-content p {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.4;
}

.referral-banner .bonus-content p {
    color: #15803d;
}

.affiliate-banner .bonus-content p {
    color: #1d4ed8;
}

.welcome-bonus-banner .bonus-amount {
    font-weight: 700;
    background: rgba(255, 255, 255, 0.5);
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
}

/* ===================================
   REFERRAL CODE GROUP (register)
   =================================== */
.referral-code-group {
    margin-top: 0.5rem;
    padding-top: 1rem;
    border-top: 1px dashed #e2e8f0;
}

.referral-input-wrapper {
    position: relative;
}

.referral-status-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
}

.referral-input-wrapper .input-modern {
    padding-right: 40px;
}

.input-modern.referral-valid {
    border-color: #10b981 !important;
    background: #f0fdf4;
}

.input-modern.referral-invalid {
    border-color: #ef4444 !important;
    background: #fef2f2;
}

.referral-feedback {
    margin-top: 0.5rem;
    font-size: 0.8125rem;
    min-height: 1.25rem;
}

.referral-success {
    color: #059669;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.referral-error {
    color: #dc2626;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

/* ===================================
   RESPONSIVE POUR REGISTER
   =================================== */
@media (max-width: 768px) {
    .auth-container {
        padding-top: 80px; /* Espace pour header fixe mobile */
    }

    .form-row-modern {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .auth-container {
        padding: 70px 0.75rem 1rem 0.75rem;
    }

    .welcome-bonus-banner {
        flex-direction: column;
        text-align: center;
        padding: 1rem;
    }

    .welcome-bonus-banner .bonus-icon {
        width: 40px;
        height: 40px;
    }
}

/* ===================================
   PASSWORD REQUIREMENTS (reset_password)
   =================================== */
.password-requirements-modern {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1rem 1.25rem;
    margin: 1.25rem 0;
}

.password-requirements-modern p {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    margin: 0 0 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.password-requirements-modern p i {
    color: #94a3b8;
}

.password-requirements-modern ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.password-requirements-modern li {
    font-size: 12px;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: color 0.2s ease;
}

.password-requirements-modern li i {
    font-size: 10px;
    color: #cbd5e1;
    transition: color 0.2s ease;
}

.password-requirements-modern li.valid {
    color: #059669;
}

.password-requirements-modern li.valid i {
    color: #10b981;
}

.password-requirements-modern li.invalid {
    color: #64748b;
}

@media (max-width: 480px) {
    .password-requirements-modern ul {
        grid-template-columns: 1fr;
    }
}

/* ===================================
   AUTH ERROR STATE (reset_password)
   =================================== */
.auth-error-state {
    text-align: center;
    padding: 2rem 1rem;
}

.auth-error-state .error-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, #fecaca 0%, #fca5a5 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-error-state .error-icon i {
    font-size: 36px;
    color: #dc2626;
}

.auth-error-state h2 {
    font-size: 20px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 0.75rem;
}

.auth-error-state p {
    font-size: 15px;
    color: #64748b;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.auth-error-state .btn-modern {
    max-width: 280px;
    margin: 0 auto;
}
