/* ========== VARIABLES ========== */
:root {
    --primary: #4361ee;
    --secondary: #3f37c9;
    --accent: #4cc9f0;
    --light: #f8f9fa;
    --dark: #212529;
    --success: #06d6a0;
    --warning: #ffd166;
    --danger: #ef476f;
    --gradient: linear-gradient(135deg, var(--primary), var(--secondary));
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 20px 40px rgba(0, 0, 0, 0.2);
    --font-main: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --bg-light: #f0f2f5;
    --border-radius: 16px;
    --spacing: 1rem;
}

/* ========== RESET & BASE ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background: var(--bg-light);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    line-height: 1.5;
    color: var(--dark);
}

/* ========== CONTENEUR PRINCIPAL ========== */
.auth-container {
    width: 100%;
    max-width: 450px; /* adapté au mobile-first */
    margin: auto;
}

.auth-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 2rem 1.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.auth-card:hover {
    box-shadow: var(--shadow-hover);
}

/* ========== EN-TÊTE ========== */
.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header h1 {
    font-size: 1.8rem;
    font-weight: 600;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.auth-header p {
    color: #6c757d;
    font-size: 0.95rem;
}

/* ========== FORMULAIRE ========== */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.form-row .form-group {
    flex: 1 1 200px; /* flexible mais minimum 200px */
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 500;
    font-size: 0.9rem;
    color: #495057;
}

.form-group .optional {
    font-weight: 400;
    color: #adb5bd;
    font-size: 0.8rem;
}

.form-group input {
    padding: 0.85rem 1rem;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: white;
    width: 100%;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(67, 97, 238, 0.15);
}

.form-group input::placeholder {
    color: #ced4da;
}

.form-group .error-message {
    color: var(--danger);
    font-size: 0.8rem;
    min-height: 1.2rem;
}

/* ========== BOUTON PRINCIPAL ========== */
.btn-primary {
    background: var(--gradient);
    color: white;
    border: none;
    padding: 1rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: opacity 0.2s, transform 0.1s;
    margin-top: 0.5rem;
    width: 100%;
    position: relative;
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Loader pour soumission */
.btn-loader {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========== PIED DE PAGE ========== */
.auth-footer {
    text-align: center;
    margin-top: 2rem;
    font-size: 0.9rem;
    color: #6c757d;
}

.auth-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.auth-footer a:hover {
    color: var(--secondary);
    text-decoration: underline;
}

.auth-footer .small {
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

/* ========== NOTIFICATIONS TOAST ========== */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--dark);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 50px;
    box-shadow: var(--shadow-hover);
    font-size: 0.95rem;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    max-width: 90%;
    width: auto;
    animation: slideUp 0.3s ease;
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--danger);
}

.toast.info {
    background: var(--primary);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translate(-50%, 20px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

/* ========== RESPONSIVE ========== */
@media (max-width: 480px) {
    .auth-card {
        padding: 1.5rem 1rem;
    }

    .auth-header h1 {
        font-size: 1.6rem;
    }

    .form-row {
        flex-direction: column;
        gap: 1rem;
    }

    .btn-primary {
        padding: 0.9rem;
    }

    .toast {
        bottom: 1rem;
        font-size: 0.9rem;
        padding: 0.75rem 1.25rem;
    }
}

/* Pour très petits écrans */
@media (max-width: 360px) {
    .auth-card {
        padding: 1rem;
    }

    .auth-header h1 {
        font-size: 1.4rem;
    }
}