/* ==========================================================================
   AuraEnergie — Authentication Page Styles
   ========================================================================== */

/* ===== Reset & Base ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Primary Colors */
    --primary: #00D2B4;
    --primary-light: #00F0D6;
    --primary-dark: #00A88E;
    --primary-glow: rgba(0, 210, 180, 0.3);

    /* Secondary */
    --secondary: #FA7232;
    --secondary-light: #FF8F5E;

    /* Backgrounds */
    --bg-dark: #05181C;
    --bg-darker: #031014;
    --bg-card: #0A1E23;
    --bg-card-hover: #0E252C;
    --bg-input: #0D2329;
    --bg-input-focus: #112B33;

    /* Text */
    --text-primary: #FFFFFF;
    --text-secondary: #94A8AC;
    --text-muted: #5A7178;
    --text-accent: #00D2B4;

    /* Borders */
    --border: #1A3A42;
    --border-focus: #00D2B4;
    --border-error: #EF4444;

    /* Status */
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --info: #3B82F6;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 40px rgba(0, 210, 180, 0.15);

    /* Typography */
    --font-display: 'Sora', sans-serif;
    --font-body: 'DM Sans', sans-serif;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);

    /* Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

html, body {
    height: 100%;
    font-family: var(--font-body);
    background: var(--bg-dark);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow: hidden;
}

/* ===== Auth Wrapper ===== */
.auth-wrapper {
    display: flex;
    height: 100vh;
    position: relative;
}

/* ===== Animated Background ===== */
.auth-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
}

.auth-bg-gradient {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 20% 50%, rgba(0, 210, 180, 0.08) 0%, transparent 50%),
                radial-gradient(ellipse at 80% 20%, rgba(250, 114, 50, 0.05) 0%, transparent 50%),
                var(--bg-dark);
}

.auth-bg-grid {
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(rgba(0, 210, 180, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 210, 180, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
}

.auth-bg-orbs {
    position: absolute;
    inset: 0;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: float 20s ease-in-out infinite;
}

.orb-1 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(0, 210, 180, 0.3), transparent 70%);
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

.orb-2 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(250, 114, 50, 0.2), transparent 70%);
    bottom: -50px;
    right: 10%;
    animation-delay: -7s;
}

.orb-3 {
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.15), transparent 70%);
    top: 40%;
    right: -50px;
    animation-delay: -14s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -30px) scale(1.05); }
    66% { transform: translate(-20px, 20px) scale(0.95); }
}

/* ===== Left Panel: Branding ===== */
.auth-branding {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    position: relative;
    z-index: 1;
    overflow: hidden;
}

.branding-content {
    max-width: 520px;
    animation: slideInLeft 0.8s ease-out;
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-40px); }
    to { opacity: 1; transform: translateX(0); }
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.brand-name {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.wordmark-primary { color: var(--primary); }
.wordmark-accent { color: var(--secondary); }

.brand-tagline {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 3rem;
}

/* Features */
.brand-features {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.brand-feature {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem;
    background: rgba(0, 210, 180, 0.05);
    border: 1px solid rgba(0, 210, 180, 0.1);
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.brand-feature:hover {
    background: rgba(0, 210, 180, 0.08);
    border-color: rgba(0, 210, 180, 0.2);
    transform: translateX(4px);
}

.feature-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.feature-icon .icon {
    width: 22px;
    height: 22px;
    color: var(--bg-dark);
}

.feature-text h3 {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.feature-text p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Stats */
.brand-stats {
    display: flex;
    gap: 2rem;
}

.stat {
    display: flex;
    flex-direction: column;
}

.stat-number {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--primary);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ===== Right Panel: Auth Forms ===== */
.auth-panel {
    width: 520px;
    min-width: 520px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    position: relative;
    z-index: 1;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    animation: slideInRight 0.8s ease-out;
    backdrop-filter: blur(20px);
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ===== Tabs ===== */
.auth-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    background: var(--bg-input);
    border-radius: var(--radius-md);
    padding: 0.35rem;
}

.auth-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.auth-tab .icon {
    width: 18px;
    height: 18px;
}

.auth-tab:hover {
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
}

.auth-tab.active {
    background: var(--primary);
    color: var(--bg-dark);
    box-shadow: 0 2px 8px rgba(0, 210, 180, 0.3);
}

/* ===== Form Styles ===== */
.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

.form-header {
    margin-bottom: 1.75rem;
}

.form-header h2 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
}

.form-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 1rem;
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    pointer-events: none;
    transition: var(--transition-fast);
    z-index: 1;
}

.input-wrapper input {
    width: 100%;
    padding: 0.85rem 1rem 0.85rem 2.75rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.95rem;
    transition: var(--transition);
    outline: none;
}

.input-wrapper input::placeholder {
    color: var(--text-muted);
}

.input-wrapper input:focus {
    border-color: var(--border-focus);
    background: var(--bg-input-focus);
    box-shadow: 0 0 0 3px rgba(0, 210, 180, 0.1);
}

.input-wrapper input:focus + .input-icon,
.input-wrapper input:focus ~ .input-icon {
    color: var(--primary);
}

.input-wrapper:has(input:focus) .input-icon {
    color: var(--primary);
}

/* Password Toggle */
.toggle-password {
    position: absolute;
    right: 0.75rem;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.toggle-password .icon {
    width: 18px;
    height: 18px;
}

.toggle-password:hover {
    color: var(--text-secondary);
}

/* Input Hint */
.input-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* Password Strength */
.password-strength {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.strength-bar {
    flex: 1;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}

.strength-fill {
    height: 100%;
    width: 0%;
    border-radius: 2px;
    transition: var(--transition);
}

.strength-text {
    font-size: 0.75rem;
    font-weight: 500;
    min-width: 60px;
    text-align: right;
}

.strength-weak .strength-fill { width: 25%; background: var(--danger); }
.strength-fair .strength-fill { width: 50%; background: var(--warning); }
.strength-good .strength-fill { width: 75%; background: var(--info); }
.strength-strong .strength-fill { width: 100%; background: var(--success); }

/* ===== Form Options ===== */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

/* Custom Checkbox */
.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}

.checkbox-wrapper input {
    display: none;
}

.checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.checkbox-wrapper input:checked + .checkmark {
    background: var(--primary);
    border-color: var(--primary);
}

.checkbox-wrapper input:checked + .checkmark::after {
    content: '';
    width: 5px;
    height: 9px;
    border: solid var(--bg-dark);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) translateY(-1px);
}

.link-inline {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition-fast);
}

.link-inline:hover {
    color: var(--primary-light);
    text-decoration: underline;
}

.forgot-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    transition: var(--transition-fast);
}

.forgot-link:hover {
    color: var(--primary);
}

/* ===== Buttons ===== */
.btn-primary {
    width: 100%;
    padding: 0.9rem 1.5rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--bg-dark);
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    opacity: 0;
    transition: var(--transition);
}

.btn-primary:hover::before {
    opacity: 1;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(0, 210, 180, 0.4);
}

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

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* T06 tsk-auth-01 (décision 13) : état visuel « désactivé » tant que la
   validation client juge le formulaire invalide — gris, aria-disabled,
   aucun effet de survol. Pas d'attribut `disabled` : la soumission et la
   validation serveur restent la source de vérité. */
.btn-primary.is-disabled {
    background: var(--bg-input);
    color: var(--text-muted);
    box-shadow: none;
    cursor: not-allowed;
}

.btn-primary.is-disabled::before,
.btn-primary.is-disabled:hover::before {
    opacity: 0;
}

.btn-primary.is-disabled:hover {
    transform: none;
    box-shadow: none;
}

.btn-text, .btn-loader {
    position: relative;
    z-index: 1;
}

.spinner {
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

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

/* ===== Utility ===== */
/* `.is-hidden` est défini dans style.css, mais auth.html ne charge que
   auth.css : sans cette règle, les erreurs vides et les loaders masqués
   restent visibles (display:flex). */
.is-hidden {
    display: none !important;
}

/* ===== Error Message ===== */
.form-error {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-sm);
    color: #FCA5A5;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-5px); }
    40% { transform: translateX(5px); }
    60% { transform: translateX(-5px); }
    80% { transform: translateX(5px); }
}

/* ===== Divider ===== */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.auth-divider span {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* ===== Social Logins ===== */
.social-logins {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.social-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.social-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--text-muted);
    color: var(--text-primary);
    transform: translateY(-1px);
}

/* T06 tsk-auth-01 (décision 12) : badge « Bientôt » des SSO stubs —
   visible, non intrusif, titre explicatif porté par le bouton. */
.sso-soon {
    padding: 0.15rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-input);
    color: var(--text-muted);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
}

/* ===== Footer ===== */
.auth-footer {
    text-align: center;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
}

.auth-footer-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.icon-small {
    width: 14px;
    height: 14px;
}

/* ===== Back to landing link ===== */
.auth-back-home {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: color var(--transition-fast);
}

.auth-back-home:hover {
    color: var(--text-accent);
}

/* ===== Toast Notifications ===== */
.toast-container {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.4s ease;
    min-width: 300px;
    max-width: 420px;
}

.toast.toast-success { border-left: 3px solid var(--success); }
.toast.toast-error { border-left: 3px solid var(--danger); }
.toast.toast-info { border-left: 3px solid var(--info); }

.toast-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.toast-success .toast-icon { color: var(--success); }
.toast-error .toast-icon { color: var(--danger); }
.toast-info .toast-icon { color: var(--info); }

.toast-message {
    flex: 1;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    transition: var(--transition-fast);
}

.toast-close:hover {
    color: var(--text-primary);
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(100px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(100px); }
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .auth-branding {
        display: none;
    }

    .auth-panel {
        width: 100%;
        min-width: unset;
    }

    .auth-wrapper {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .auth-panel {
        padding: 1rem;
    }

    .auth-card {
        padding: 1.75rem;
        border-radius: var(--radius-lg);
    }

    .brand-name {
        font-size: 2rem;
    }

    .auth-tabs {
        flex-direction: column;
    }

    .social-logins {
        flex-direction: column;
    }
}

/* ===== Accessibility ===== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus visible for keyboard navigation */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
