/* Reset et variables */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #ec4899;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --white: #ffffff;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1),
        0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1),
        0 8px 10px -6px rgb(0 0 0 / 0.1);
}

/* Layout principal */
body {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        sans-serif;
    background: linear-gradient(
        135deg,
        var(--primary) 0%,
        var(--secondary) 100%
    );
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    margin: 0;
}

/* Container principal */
.auth-container {
    background: var(--white);
    border-radius: 1.5rem;
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    width: 100%;
    max-width: 26rem;
    position: relative;
    margin: 0 auto;
    min-height: auto;
}

/* Header */
.auth-header {
    background: linear-gradient(
        135deg,
        var(--gray-50) 0%,
        var(--gray-100) 100%
    );
    padding: 2rem 2rem 1rem;
    text-align: center;
    border-bottom: 1px solid var(--gray-200);
}

.auth-title {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
}

.auth-subtitle {
    color: var(--gray-600);
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

.auth-tabs {
    display: flex;
    background: var(--gray-200);
    border-radius: 0.75rem;
    padding: 0.25rem;
    gap: 0.25rem;
}

.auth-tab {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    background: transparent;
    border-radius: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--gray-600);
}

.auth-tab.active {
    background: var(--white);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.auth-tab:hover:not(.active) {
    color: var(--gray-700);
}

/* Contenu des formulaires */
.auth-content {
    padding: 2rem;
}

.form-container {
    position: relative;
    width: 100%;
}

.form-section {
    width: 100%;
    display: none;
}

.form-section.active {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}

.form-section form {
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
}

/* Étapes du formulaire d'inscription */
.step {
    display: none;
}

.step.active {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}

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

/* Groupes de champs */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.form-input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: 0.75rem;
    font-size: 1rem;
    transition: all 0.2s ease;
    background: var(--white);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgb(99 102 241 / 0.1);
}

.form-input::placeholder {
    color: var(--gray-400);
}

/* Input avec icône */
.input-group {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    font-size: 1.125rem;
}

.input-group .form-input {
    padding-left: 3rem;
}

/* Toggle password */
.password-toggle {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-400);
    font-size: 1.125rem;
    padding: 0.25rem;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
}

.password-toggle:hover {
    color: var(--gray-600);
    background: var(--gray-100);
}

/* Select personnalisé */
select.form-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 1rem center;
    background-repeat: no-repeat;
    background-size: 1rem;
    padding-right: 3rem;
    cursor: pointer;
}

/* Checkbox personnalisé */
.checkbox-group {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.checkbox-input {
    width: 1.125rem;
    height: 1.125rem;
    margin-top: 0.125rem;
    accent-color: var(--primary);
    cursor: pointer;
}

.checkbox-label {
    font-size: 0.875rem;
    color: var(--gray-600);
    line-height: 1.5;
    cursor: pointer;
}

.checkbox-label a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.checkbox-label a:hover {
    text-decoration: underline;
}

/* Boutons */
.btn {
    width: 100%;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: linear-gradient(
        135deg,
        var(--primary) 0%,
        var(--primary-dark) 100%
    );
    color: var(--white);
    box-shadow: var(--shadow);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

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

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
    border: 2px solid var(--gray-200);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--gray-200);
    border-color: var(--gray-300);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Messages d'erreur et d'aide */
.form-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: var(--error);
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    margin-top: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    flex-direction: column;
}

.form-error > div:first-child {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#countdown {
    background: rgba(239, 68, 68, 0.1);
    padding: 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.8rem;
    width: 100%;
    text-align: center;
}

#countdownTimer {
    font-weight: 700;
    color: var(--error);
}

/* Style spécial pour le rate limiting */
.form-error.rate-limited {
    background: #fef3c7;
    border-color: #f59e0b;
    color: var(--warning);
}

.form-error.rate-limited i {
    color: var(--warning);
}

.form-helper {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
}

.form-helper.error {
    color: var(--error);
}

.form-helper.success {
    color: var(--success);
}

/* Navigation entre étapes */
.step-navigation {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.step-navigation .btn {
    flex: 1;
}

/* Indicateur d'étapes */
.step-indicator {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.step-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--gray-300);
    transition: all 0.2s ease;
}

.step-dot.active {
    background: var(--primary);
    transform: scale(1.2);
}

.step-dot.completed {
    background: var(--success);
}

/* Footer */
.page-footer {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
}

.footer-logo {
    height: 2.5rem;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.footer-logo:hover {
    opacity: 1;
}

/* Responsive */
@media (max-width: 640px) {
    body {
        padding: 1rem 0.5rem;
        align-items: center;
        justify-content: center;
        min-height: 100vh;
        overflow: hidden;
    }

    .auth-container {
        max-width: 95%;
        border-radius: 1rem;
        margin: 0 auto;
        width: 26rem;
    }

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

    .auth-content {
        padding: 2.5rem;
    }

    .form-section {
        padding: 0;
    }

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

    .page-footer {
        position: fixed;
        bottom: 0.5rem;
    }
}

@media (max-width: 480px) {
    body {
        padding: 0.5rem 0.25rem;
        align-items: center;
        justify-content: center;
    }

    .auth-header {
        padding: 1rem;
    }

    .auth-content {
        padding: 1rem;
    }

    .form-section {
        padding: 0;
    }

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

/* Pour les très petits écrans */
@media (max-width: 360px) {
    body {
        padding: 0.25rem;
    }

    .auth-header {
        padding: 0.75rem;
    }

    .auth-content {
        padding: 0.75rem;
    }

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

/* États de chargement */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        transparent
    );
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* Animations d'entrée */
.auth-container {
    animation: slideUp 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
