@import 'utils/variables.css';

/* ══════════════════════════════════════════════════
   FOND D'ÉCRAN - 60% Blanc, 25% Noir, 5% Rouge
   ═══════════════════════════════════════════════════ */
.auth-body {
    min-height: 100vh;
    /* Dégradé Noir profond avec une touche subtile de rouge institutionnel */
    background: linear-gradient(135deg, rgba(17, 17, 17, 0.95) 0%, rgba(41, 41, 41, 0.9) 50%, rgba(201, 37, 37, 0.1) 100%), 
                url('https://images.unsplash.com/photo-1589829545856-d10d557cf95f?auto=format&fit=crop&q=80&w=1920');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    display: flex;
    flex-direction: column;
    padding: 2rem 1rem;
    font-family: var(--font-primary);
}

.auth-page-wrapper {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    flex: 1;
}

/* ══════════════════════════════════════════════════
   CARTES SÉPARÉES (Split Layout)
   ═══════════════════════════════════════════════════ */
.auth-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    min-height: 600px;
    align-items: stretch;
}

/* ── Carte Gauche : Slider ── */
.auth-split__slider {
    position: relative;
    overflow: hidden;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    background: var(--deep-black);
    border: 1px solid rgba(201, 37, 37, 0.2); /* Fine bordure rouge subtile */
}

.auth-slider {
    position: relative;
    width: 100%;
    height: 100%;
}

.auth-slider__item {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transition: opacity 1.2s ease-in-out, transform 8s ease;
    transform: scale(1.05);
}

.auth-slider__item.active {
    opacity: 1;
    transform: scale(1);
}

.auth-slider__item::before {
    content: '';
    position: absolute;
    inset: 0;
    /* Dégradé Noir dominant vers le bas */
    background: linear-gradient(180deg, rgba(17, 17, 17, 0.3) 0%, rgba(17, 17, 17, 0.9) 100%);
}

.auth-slider__overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 3rem;
    color: var(--pure-white);
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.8s ease 0.3s;
}

.auth-slider__item.active .auth-slider__overlay {
    transform: translateY(0);
    opacity: 1;
}

.auth-slider__title {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    line-height: 1.2;
    color: var(--pure-white); /* Titre en blanc pour contraste sur fond sombre */
}

.auth-slider__desc {
    font-size: 1.1rem;
    opacity: 0.9;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.9);
}

.auth-slider__dots {
    position: absolute;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    gap: 0.75rem;
    z-index: 10;
}

.auth-slider__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
}

.auth-slider__dot.active {
    background: var(--institutional-red); /* Point actif rouge */
    width: 32px;
    border-radius: 5px;
}

/* ── Carte Droite : Formulaire (60% Blanc cassé) ── */
.auth-split__form {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    background: var(--pure-white);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    border-top: 4px solid var(--institutional-red); /* Touche rouge en haut */
}

.auth-form-wrapper {
    width: 100%;
    max-width: 420px;
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.auth-form-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-form-logo {
    height: 65px;
    width: auto;
    margin-bottom: 1.25rem;
}

.auth-form-title {
    font-family: var(--font-heading);
    font-size: 1.85rem;
    color: var(--deep-black);
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.auth-form-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* ── Champs de formulaire ── */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 1rem;
    color: var(--text-muted);
    pointer-events: none;
    z-index: 1;
    transition: color 0.3s ease;
}

.form-control {
    width: 100%;
    padding: 0.9rem 1rem 0.9rem 3rem;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.form-control:focus {
    outline: none;
    border-color: var(--institutional-red); /* Focus rouge */
    background: var(--pure-white);
    box-shadow: 0 0 0 4px rgba(201, 37, 37, 0.1);
}

.input-wrapper:focus-within .input-icon {
    color: var(--institutional-red);
}

.form-control--password {
    padding-right: 3rem;
}

.password-toggle {
    position: absolute;
    right: 1rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
    z-index: 2;
}

.password-toggle:hover {
    color: var(--institutional-red);
}

/* ── Options & Liens ── */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-secondary);
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkbox-custom {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    position: relative;
    transition: all 0.2s ease;
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom {
    background: var(--institutional-red);
    border-color: var(--institutional-red);
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.forgot-link {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.3s ease;
}

.forgot-link:hover {
    color: var(--institutional-red);
}

/* ── Boutons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.9rem 1.5rem;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn-primary {
    background: var(--institutional-red);
    color: var(--pure-white) !important;
}

.btn-primary:hover {
    background: var(--dark-red);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(201, 37, 37, 0.3);
}

.btn-full {
    width: 100%;
    margin-top: 0.5rem;
}

.auth-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 1.5rem 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-color);
}

.auth-divider span {
    padding: 0 1rem;
}

.btn-google {
    background: var(--pure-white);
    color: var(--text-primary) !important;
    border: 2px solid var(--border-color);
    font-weight: 500;
}

.btn-google:hover {
    background: var(--bg-secondary);
    border-color: var(--institutional-red);
    transform: translateY(-2px);
}

.auth-form-footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.95rem;
}

.auth-form-footer a {
    color: var(--institutional-red);
    font-weight: 600;
    text-decoration: none;
}

.auth-form-footer a:hover {
    color: var(--dark-red);
    text-decoration: underline;
}

/* ── Alerts ── */
.alert {
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.alert-error {
    background: rgba(201, 37, 37, 0.1);
    color: var(--institutional-red);
    border: 1px solid rgba(201, 37, 37, 0.2);
}

.alert-error ul {
    margin: 0;
    padding-left: 1.25rem;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: #065f46;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

/* ══════════════════════════════════════════════════
   FOOTER DANS AUTH
   ═══════════════════════════════════════════════════ */
.auth-page-wrapper .footer {
    margin-top: 3rem;
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    border-top: 1px solid rgba(201, 37, 37, 0.2); /* Ligne rouge subtile */
    padding-top: 2rem;
}

.auth-page-wrapper .footer__brand {
    color: var(--pure-white);
}

/* ══════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════ */
@media (max-width: 968px) {
    .auth-body {
        padding: 1rem;
        background-attachment: scroll;
    }
    .auth-split {
        grid-template-columns: 1fr;
        grid-template-rows: 280px 1fr;
        gap: 1rem;
    }
    .auth-slider__overlay { padding: 1.5rem; }
    .auth-slider__title { font-size: 1.5rem; }
    .auth-slider__desc { font-size: 0.95rem; }
    .auth-slider__dots { bottom: 1rem; right: 1rem; }
    .auth-split__form { padding: 2.5rem 2rem; }
    .auth-form-title { font-size: 1.6rem; }
}

@media (max-width: 480px) {
    .auth-split { grid-template-rows: 220px 1fr; }
    .auth-split__form { padding: 2rem 1.5rem; }
    .auth-form-logo { height: 50px; }
    .form-options { flex-direction: column; gap: 1rem; align-items: flex-start; }
    .auth-slider__title { font-size: 1.25rem; }
}

/* ══════════════════════════════════════════════════
   DARK MODE
   ═══════════════════════════════════════════════════ */
[data-theme="dark"] .auth-split__form {
    background: var(--bg-primary); /* #0F0F0F */
    border-top: 4px solid var(--institutional-red);
}

[data-theme="dark"] .form-control {
    background: var(--bg-secondary); /* #1A1A1A */
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .form-control:focus {
    background: var(--bg-primary);
    border-color: var(--institutional-red);
    box-shadow: 0 0 0 4px rgba(201, 37, 37, 0.15);
}

[data-theme="dark"] .auth-form-title {
    color: var(--text-primary);
}

[data-theme="dark"] .btn-google {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-primary) !important;
}

[data-theme="dark"] .auth-form-footer {
    border-top-color: var(--border-color);
}