/* ============================================ */
/* AUTH.CSS - Styles Modal pour l'authentification */
/* Placez ce fichier dans: public/css/auth.css */
/* ============================================ */

/* --- Variables CSS pour les thèmes --- */
:root {
    --bg-color: #f8f9fa;
    --card-bg: #ffffff;
    --text-color: #333333;
    --text-muted: #6c757d;
    --border-color: #e0e0e0;
    --input-bg: #ffffff;
    --input-border: #e0e0e0;
    --header-gradient-start: #667eea;
    --header-gradient-end: #764ba2;
    --shadow: rgba(0, 0, 0, 0.1);
    --shadow-hover: rgba(102, 126, 234, 0.3);
    --backdrop-blur: rgba(255, 255, 255, 0.85);
}

[data-theme="dark"] {
    --bg-color: #1a1a2e;
    --card-bg: #16213e;
    --text-color: #e4e4e4;
    --text-muted: #a0a0a0;
    --border-color: #2a3f5f;
    --input-bg: #0f1419;
    --input-border: #2a3f5f;
    --header-gradient-start: #4a5d8a;
    --header-gradient-end: #5a3d6e;
    --shadow: rgba(0, 0, 0, 0.5);
    --shadow-hover: rgba(102, 126, 234, 0.5);
    --backdrop-blur: rgba(10, 10, 20, 0.85);
}

/* --- Base Page --- */
.auth-modal-page {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    overflow: hidden;
    background-color: var(--bg-color);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* --- Backdrop avec effet blur --- */
.auth-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--backdrop-blur);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 1;
    transition: background 0.3s ease;
}

.auth-pattern {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(135deg, var(--header-gradient-start) 0%, var(--header-gradient-end) 100%);
    opacity: 0.1;
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* --- Modal Container --- */
.auth-modal-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 2;
    overflow-y: auto;
}

/* --- Modal Card --- */
.auth-modal {
    background: var(--card-bg);
    border-radius: 20px;
    box-shadow: 0 25px 50px var(--shadow);
    max-width: 480px;
    width: 100%;
    margin: auto;
    animation: modalSlideIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    transition: background-color 0.3s ease;
    position: relative;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* --- Modal Header --- */
.auth-modal-header {
    padding: 2.5rem 2rem 1.5rem;
    border-bottom: 2px solid var(--border-color);
    transition: border-color 0.3s ease;
}

.auth-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--header-gradient-start) 0%, var(--header-gradient-end) 100%);
    border-radius: 50%;
    font-size: 2.5rem;
    color: white;
    box-shadow: 0 8px 16px var(--shadow-hover);
    animation: iconPulse 2s ease-in-out infinite;
}

@keyframes iconPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.auth-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 0.5rem;
    text-align: center;
}

.auth-subtitle {
    font-size: 1rem;
    color: var(--text-muted);
    text-align: center;
    margin: 0;
}

/* --- Modal Body --- */
.auth-modal-body {
    padding: 2rem;
}

/* --- Toggle de thème --- */
.theme-toggle-guest {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 10;
}

.theme-toggle-guest .btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    color: var(--text-color);
    box-shadow: 0 4px 12px var(--shadow);
    transition: all 0.3s ease;
    font-size: 1.25rem;
}

.theme-toggle-guest .btn:hover {
    transform: rotate(180deg) scale(1.1);
    border-color: var(--header-gradient-start);
    color: var(--header-gradient-start);
}

/* --- Form Elements --- */
.form-label {
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.form-control {
    background-color: var(--input-bg);
    color: var(--text-color);
    border: 2px solid var(--input-border);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.form-control:focus {
    background-color: var(--input-bg);
    color: var(--text-color);
    border-color: var(--header-gradient-start);
    box-shadow: 0 0 0 0.25rem rgba(102, 126, 234, 0.15);
    outline: none;
}

.form-control::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

.form-control.is-valid {
    border-color: #28a745;
}

.form-control.is-invalid {
    border-color: #dc3545;
}

/* --- Input Groups --- */
.input-group .form-control {
    border-radius: 10px 0 0 10px;
}

.input-group .btn {
    background: var(--input-bg);
    color: var(--text-color);
    border: 2px solid var(--input-border);
    border-left: none;
    border-radius: 0 10px 10px 0;
    transition: all 0.3s ease;
    padding: 0.75rem 1rem;
}

.input-group .btn:hover {
    background: var(--card-bg);
    color: var(--header-gradient-start);
}

/* --- Buttons --- */
.btn-primary {
    background: linear-gradient(135deg, var(--header-gradient-start) 0%, var(--header-gradient-end) 100%);
    border: none;
    border-radius: 10px;
    padding: 0.875rem 2rem;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
    color: white;
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px var(--shadow-hover);
}

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

.btn-outline-secondary {
    background: transparent;
    color: var(--text-color);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 0.875rem 2rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-outline-secondary:hover {
    background: var(--input-bg);
    border-color: var(--header-gradient-start);
    color: var(--header-gradient-start);
}

/* --- Checkbox --- */
.form-check-input {
    cursor: pointer;
    background-color: var(--input-bg);
    border: 2px solid var(--input-border);
    transition: all 0.3s ease;
    width: 1.25rem;
    height: 1.25rem;
}

.form-check-input:checked {
    background-color: var(--header-gradient-start);
    border-color: var(--header-gradient-start);
}

.form-check-input:focus {
    box-shadow: 0 0 0 0.25rem rgba(102, 126, 234, 0.15);
}

.form-check-label {
    cursor: pointer;
    user-select: none;
    color: var(--text-color);
}

/* --- Alerts --- */
.alert {
    border-radius: 12px;
    border: none;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px var(--shadow);
    animation: alertSlideIn 0.3s ease;
}

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

.alert-success {
    background-color: #d4edda;
    color: #155724;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
}

[data-theme="dark"] .alert-success {
    background-color: rgba(40, 167, 69, 0.2);
    color: #7fd49b;
}

[data-theme="dark"] .alert-danger {
    background-color: rgba(220, 53, 69, 0.2);
    color: #f39393;
}

[data-theme="dark"] .alert-info {
    background-color: rgba(23, 162, 184, 0.2);
    color: #8fd4e8;
}

[data-theme="dark"] .alert-warning {
    background-color: rgba(255, 193, 7, 0.2);
    color: #ffd97d;
}

/* --- Password Strength --- */
.password-strength {
    height: 6px;
    background: var(--border-color);
    border-radius: 10px;
    overflow: hidden;
}

.password-strength-bar {
    height: 100%;
    width: 0;
    transition: all 0.3s ease;
    border-radius: 10px;
}

.password-strength-bar.strength-weak {
    background: #dc3545;
    width: 33%;
}

.password-strength-bar.strength-medium {
    background: #ffc107;
    width: 66%;
}

.password-strength-bar.strength-strong {
    background: #28a745;
    width: 100%;
}

/* --- Requirements --- */
.requirements {
    font-size: 0.85rem;
}

.requirement {
    color: #dc3545;
    transition: all 0.3s ease;
    padding: 0.25rem 0;
    display: flex;
    align-items: center;
}

.requirement.met {
    color: #28a745;
}

.requirement i {
    margin-right: 0.5rem;
    font-size: 0.8rem;
}

/* --- Links --- */
.auth-link {
    color: var(--header-gradient-start);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

.auth-link:hover {
    color: var(--header-gradient-end);
    text-decoration: underline;
}

/* --- Validation --- */
.invalid-feedback,
.valid-feedback {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.875rem;
}

.invalid-feedback {
    color: #dc3545;
}

.valid-feedback {
    color: #28a745;
}

/* --- Text Utilities --- */
.text-muted {
    color: var(--text-muted) !important;
}

.fw-bold {
    font-weight: 600 !important;
}

/* --- Responsive --- */
@media (max-width: 576px) {
    .auth-modal {
        max-width: 100%;
        border-radius: 15px;
        margin: 0.5rem;
    }

    .auth-modal-header {
        padding: 2rem 1.5rem 1rem;
    }

    .auth-modal-body {
        padding: 1.5rem;
    }

    .auth-icon {
        width: 70px;
        height: 70px;
        font-size: 2rem;
        margin-bottom: 1rem;
    }

    .auth-title {
        font-size: 1.5rem;
    }

    .auth-subtitle {
        font-size: 0.9rem;
    }

    .theme-toggle-guest {
        top: 1rem;
        right: 1rem;
    }

    .theme-toggle-guest .btn {
        width: 45px;
        height: 45px;
        font-size: 1.1rem;
    }

    .btn-primary,
    .btn-outline-secondary {
        padding: 0.75rem 1.5rem;
    }
}

/* --- Loading State --- */
.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary.loading::after {
    content: '';
    display: inline-block;
    width: 1rem;
    height: 1rem;
    margin-left: 0.5rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* --- Focus Visible --- */
*:focus-visible {
    outline: 2px solid var(--header-gradient-start);
    outline-offset: 2px;
}

/* --- Caps Lock Warning --- */
.caps-lock-warning {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #ffc107;
}

/* --- Bootstrap Overrides --- */
[data-theme="dark"] .btn-close {
    filter: invert(1);
}

/* --- Smooth Transitions --- */
* {
    transition-property: background-color, border-color, color;
    transition-duration: 0.3s;
    transition-timing-function: ease;
}