/* Variables du thème */
:root {
    --primary-blue: #1e40af;
    --secondary-blue: #3b82f6;
    --dark-blue: #1e3a8a;
    --orange: #f97316;
    --light-orange: #fb923c;
    --text-light: #f8fafc;
    --text-gray: #64748b;
    --success: #10b981;
    --error: #ef4444;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 10px 10px -5px rgb(0 0 0 / 0.04);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Container principal avec motif quadrillé dans le vide */
.auth-container {
    min-height: 100vh;
    max-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at center, #f1f5f9 0%, #e2e8f0 100%);
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem;
}

/* Switch de thème */
.theme-switch-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.theme-switch {
    position: relative;
}

.theme-toggle {
    display: none;
}

.theme-switch-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 80px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 25px;
    padding: 4px;
    cursor: pointer;
    transition: var(--transition);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
}

.theme-switch-label:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.05);
}

.theme-icon {
    font-size: 0.9rem;
    z-index: 2;
    transition: var(--transition);
    color: rgba(255, 255, 255, 0.6);
    width: 16px;
    text-align: center;
}

.sun-icon {
    margin-left: 8px;
}

.moon-icon {
    margin-right: 8px;
}

.theme-switch-slider {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    border-radius: 50%;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.theme-toggle:checked + .theme-switch-label .theme-switch-slider {
    transform: translateX(40px);
    background: linear-gradient(135deg, #3b82f6, #1e40af);
}

.theme-toggle:checked + .theme-switch-label .sun-icon {
    color: rgba(255, 255, 255, 0.4);
}

.theme-toggle:checked + .theme-switch-label .moon-icon {
    color: rgba(255, 255, 255, 0.9);
}

.theme-toggle:not(:checked) + .theme-switch-label .sun-icon {
    color: rgba(255, 255, 255, 0.9);
}

.theme-toggle:not(:checked) + .theme-switch-label .moon-icon {
    color: rgba(255, 255, 255, 0.4);
}

/* Motif quadrillé subtil dans le vide */
.auth-container::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        linear-gradient(rgba(0,0,0,0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,0,0,0.08) 1px, transparent 1px);
    background-size: 60px 60px;
    animation: gridFloat 25s linear infinite;
    pointer-events: none;
    z-index: 1;
}

/* Scintillements très subtils dans le vide */
.auth-container::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 15% 25%, rgba(0,0,0,0.03) 1px, transparent 1px),
        radial-gradient(circle at 85% 75%, rgba(0,0,0,0.025) 1px, transparent 1px),
        radial-gradient(circle at 70% 15%, rgba(0,0,0,0.035) 1px, transparent 1px),
        radial-gradient(circle at 25% 85%, rgba(0,0,0,0.02) 1px, transparent 1px),
        radial-gradient(circle at 95% 45%, rgba(0,0,0,0.03) 1px, transparent 1px);
    background-size: 300px 300px, 400px 400px, 350px 350px, 450px 450px, 280px 280px;
    animation: voidSparkle 12s ease-in-out infinite;
    pointer-events: none;
    z-index: 1;
}

@keyframes gridFloat {
    0% { transform: translate(0, 0); }
    100% { transform: translate(60px, 60px); }
}

@keyframes voidSparkle {
    0%, 100% { opacity: 0.2; transform: scale(1); }
    25% { opacity: 0.4; transform: scale(1.1); }
    50% { opacity: 0.15; transform: scale(0.95); }
    75% { opacity: 0.35; transform: scale(1.05); }
}

/* Carte d'authentification avec hauteur adaptée */
.auth-card {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    max-height: 90vh;
    padding: 2.5rem 2rem;
    position: relative;
    transform: translateY(20px);
    opacity: 0;
    animation: slideUp 0.8s ease-out forwards;
    border: 1px solid rgba(255, 255, 255, 0.3);
    z-index: 2;
    overflow-y: auto;
    margin: 2rem 0;
}

/* Scrollbar personnalisé pour la carte */
.auth-card::-webkit-scrollbar {
    width: 6px;
}

.auth-card::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 3px;
}

.auth-card::-webkit-scrollbar-thumb {
    background: rgba(30, 64, 175, 0.3);
    border-radius: 3px;
}

.auth-card::-webkit-scrollbar-thumb:hover {
    background: rgba(30, 64, 175, 0.5);
}

@keyframes slideUp {
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Logo/Titre avec icône */
.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-icon {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--primary-blue), var(--secondary-blue));
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.2rem;
    box-shadow: var(--shadow);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.auth-icon i {
    font-size: 1.8rem;
    color: var(--text-light);
}

.auth-title {
    color: #1e293b;
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.auth-subtitle {
    color: var(--text-gray);
    font-size: 0.95rem;
}

/* Formulaire */
.auth-form {
    animation: fadeIn 1s ease-out 0.3s both;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.form-group {
    margin-bottom: 1.2rem;
    position: relative;
}

.form-label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 600;
    color: #374151;
    font-size: 0.9rem;
    transition: var(--transition);
}

.form-control {
    width: 100%;
    padding: 0.9rem 0.9rem 0.9rem 2.8rem;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 0.95rem;
    transition: var(--transition);
    background: #f9fafb;
    position: relative;
    color: #374151;
}

.form-control::placeholder {
    color: #9ca3af;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-blue);
    background: white;
    box-shadow: 0 0 0 4px rgba(30, 64, 175, 0.1);
    transform: translateY(-2px);
    color: #1f2937;
}

/* Icônes dans les champs */
.form-group .field-icon {
    position: absolute;
    left: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-gray);
    transition: var(--transition);
    z-index: 1;
    margin-top: 0.6rem;
}

.form-control:focus + .field-icon {
    color: var(--primary-blue);
}

/* Checkbox personnalisé */
.form-check {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.2rem;
}

.form-check-input {
    width: 18px;
    height: 18px;
    border: 2px solid #d1d5db;
    border-radius: 5px;
    position: relative;
    cursor: pointer;
    transition: var(--transition);
}

.form-check-input:checked {
    background: var(--primary-blue);
    border-color: var(--primary-blue);
}

.form-check-input:checked::before {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
}

.form-check-label {
    color: #374151;
    font-size: 0.85rem;
    cursor: pointer;
    user-select: none;
}

/* Boutons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.9rem 1.3rem;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-blue), var(--secondary-blue));
    color: white;
    box-shadow: var(--shadow);
    width: 100%;
    margin-bottom: 1rem;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(30, 64, 175, 0.3);
}

.btn-primary:active {
    transform: translateY(-1px);
}

.btn-outline-primary {
    background: transparent;
    color: var(--primary-blue);
    border: 2px solid var(--primary-blue);
    width: 100%;
}

.btn-outline-primary:hover {
    background: var(--primary-blue);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

/* Loading state */
.btn.loading {
    pointer-events: none;
    position: relative;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Section de changement */
.auth-switch {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e5e7eb;
    animation: fadeIn 1s ease-out 0.6s both;
}

.auth-switch p {
    color: var(--text-gray);
    margin-bottom: 0.8rem;
    font-size: 0.85rem;
}

/* Alertes */
.alert {
    padding: 0.9rem 1.1rem;
    border-radius: 12px;
    margin-bottom: 1.2rem;
    border-left: 4px solid;
    animation: slideDown 0.5s ease-out;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
    border-color: var(--error);
}

.alert-success {
    background: #dcfce7;
    color: #166534;
    border-color: var(--success);
}

.alert i {
    margin-right: 0.5rem;
}

/* Responsive */
@media (max-width: 480px) {
    .auth-card {
        padding: 1.8rem 1.2rem;
        margin: 1rem;
        border-radius: 16px;
        max-height: 95vh;
    }
    
    .auth-title {
        font-size: 1.6rem;
    }
    
    .form-control {
        padding: 0.8rem 0.8rem 0.8rem 2.5rem;
    }
    
    .form-group .field-icon {
        left: 0.8rem;
    }
}

@media (max-height: 700px) {
    .auth-card {
        max-height: 85vh;
        padding: 2rem 1.8rem;
    }
    
    .auth-header {
        margin-bottom: 1.5rem;
    }
    
    .auth-icon {
        width: 60px;
        height: 60px;
        margin-bottom: 1rem;
    }
    
    .auth-icon i {
        font-size: 1.5rem;
    }
    
    .auth-title {
        font-size: 1.6rem;
    }
}

/* Thème sombre */
.dark-theme .auth-container {
    background: radial-gradient(ellipse at center, #0f1419 0%, #000000 100%);
}

.dark-theme .auth-container::before {
    background-image: 
        linear-gradient(rgba(255,255,255,0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.08) 1px, transparent 1px);
}

.dark-theme .auth-container::after {
    background-image: 
        radial-gradient(circle at 15% 25%, rgba(255,255,255,0.03) 1px, transparent 1px),
        radial-gradient(circle at 85% 75%, rgba(255,255,255,0.025) 1px, transparent 1px),
        radial-gradient(circle at 70% 15%, rgba(255,255,255,0.035) 1px, transparent 1px),
        radial-gradient(circle at 25% 85%, rgba(255,255,255,0.02) 1px, transparent 1px),
        radial-gradient(circle at 95% 45%, rgba(255,255,255,0.03) 1px, transparent 1px);
}

.dark-theme .auth-card {
    background: rgba(30, 41, 59, 0.98);
    border-color: rgba(255, 255, 255, 0.1);
}

.dark-theme .auth-title {
    color: var(--text-light);
}

.dark-theme .form-label {
    color: #e2e8f0;
}

.dark-theme .form-control {
    background: rgba(51, 65, 85, 0.8);
    border-color: #475569;
    color: var(--text-light);
}

.dark-theme .form-control::placeholder {
    color: #94a3b8;
}

.dark-theme .form-control:focus {
    background: rgba(51, 65, 85, 1);
    color: var(--text-light);
}

.dark-theme .form-check-label {
    color: #e2e8f0;
}

.forgot-password {
    color: #7f8c8d;
    font-size: 0.9rem;
    text-decoration: none;
    transition: color 0.3s ease;
}

.forgot-password:hover {
    color: #34495e;
} 