:root {
    --primary: #ff6e14;
    --primary-hover: #e05a00;
    --bg-main: #f4f6f7;
    --text-dark: #1a1a1a;
    --text-neutral: #6a6a6a;
    --border-light: #e6e8eb;
    --border-input: #cbcfd3;
    --focus-ring: #4183d7;
    --error: #c9252d;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-dark);
    -webkit-font-smoothing: antialiased;
}

body.modal-open {
    overflow: hidden;
}

/* Anneau de focus visible au clavier, invisible à la souris */
:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}

:focus:not(:focus-visible) {
    outline: none;
}

/* Respect du réglage système "réduire les animations" */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.page-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Desktop : la page tient dans la fenêtre, pas de scroll vertical.
   Sans min-height:0, la colonne d'illustrations impose la hauteur de son
   contenu (cartes empilées) et étire toute la page. */
@media (min-width: 768px) {
    .page-layout {
        height: 100vh;
        height: 100dvh;
        min-height: 0;
        overflow: hidden;
    }

    .main-content,
    .illustration-column,
    .form-column {
        min-height: 0;
    }

    .form-column {
        overflow-y: auto; /* Filet de sécurité si la fenêtre est très basse */
    }
}

/* Header */
.header {
    height: 80px;
    background-color: #ffffff;
    display: flex;
    align-items: center;
    padding: 0 24px;
    border-bottom: 1px solid var(--border-light);
    position: relative;
}

.btn-back {
    position: absolute;
    left: 24px;
    background: transparent;
    border: none;
    color: var(--text-dark);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.btn-back:hover {
    opacity: 0.8;
}

.header-brand {
    margin: 0 auto;
}

.header-brand span {
    color: var(--primary);
    font-weight: 700;
    font-size: 24px;
    letter-spacing: -0.5px;
}

/* Main Content: Split Screen Layout */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Left Form Column */
.form-column {
    flex: 1;
    display: flex;
    justify-content: center; /* Mobile : formulaire centré horizontalement */
    padding: 24px 24px 40px;
}

@media (min-width: 768px) {
    .main-content {
        flex-direction: row;
    }

    .form-column {
        flex: 0 0 50%;
        justify-content: flex-start; /* Desktop : aligné à gauche dans sa moitié */
        padding-left: 80px;
        padding-right: 48px;
        padding-top: 64px;
        padding-bottom: 80px;
    }
}

.form-container {
    width: 100%;
    max-width: 360px;
}

.main-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.2;
    margin-bottom: 32px;
}

/* Form Styles */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-dark);
}

.required {
    color: var(--primary);
}

.input-group input {
    height: 44px;
    padding: 0 16px;
    border: 1px solid var(--border-input);
    border-radius: 8px;
    background-color: #ffffff;
    color: var(--text-dark);
    font-size: 16px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-group input:focus {
    border-color: var(--focus-ring);
    box-shadow: 0 0 0 1px var(--focus-ring);
}

.input-group input::placeholder {
    color: #999;
}

/* Champ mot de passe + bouton afficher/masquer */
.input-wrapper {
    position: relative;
    display: flex;
}

.input-wrapper input {
    flex: 1;
    padding-right: 48px; /* Réserve la place du bouton œil */
}

.btn-toggle-password {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-neutral);
    transition: color 0.2s, background-color 0.2s;
}

.btn-toggle-password:hover {
    background-color: rgba(26, 26, 26, 0.05);
    color: var(--text-dark);
}

.btn-toggle-password.is-active {
    color: var(--primary);
}

/* Erreurs de saisie */
.input-error {
    font-size: 13px;
    color: var(--error);
    display: flex;
    align-items: center;
    gap: 6px;
}

.input-error[hidden] {
    display: none; /* Sinon display:flex écrase l'attribut hidden */
}

.input-error::before {
    content: "⚠";
    font-size: 12px;
}

.input-group input.has-error {
    border-color: var(--error);
}

.input-group input.has-error:focus {
    box-shadow: 0 0 0 1px var(--error);
}

/* Options : rester connecté / mot de passe oublié */
.form-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: -8px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-dark);
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

.link-inline {
    font-size: 14px;
    font-weight: 500;
    color: var(--primary);
    text-decoration: none;
}

.link-inline:hover {
    text-decoration: underline;
}

.signup-hint {
    margin-top: 24px;
    font-size: 14px;
    color: var(--text-neutral);
    text-align: center;
}

/* Bouton en cours de chargement */
.btn-primary.is-loading,
.modal-btn:disabled {
    cursor: not-allowed;
}

.btn-primary.is-loading {
    background-color: var(--primary-hover);
    opacity: 0.85;
}

.btn-primary {
    height: 44px;
    width: 100%;
    background-color: var(--primary);
    color: #ffffff;
    border: none;
    border-radius: 22px; /* Pill shape */
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

/* Divider */
.divider {
    display: flex;
    align-items: center;
    margin: 24px 0;
}

.divider-line {
    flex: 1;
    height: 1px;
    background-color: var(--border-input);
}

.divider span {
    padding: 0 12px;
    font-size: 14px;
    color: var(--text-neutral);
}

/* Social Login */
.social-login {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.btn-social {
    height: 44px;
    width: 100%;
    background-color: transparent;
    border: 1px solid var(--text-dark);
    border-radius: 22px; /* Pill shape */
    color: var(--text-dark);
    font-size: 16px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: background-color 0.2s;
    position: relative;
}

.btn-social:hover {
    background-color: rgba(26, 26, 26, 0.05);
}

.btn-social svg {
    position: absolute;
    left: 20px;
    width: 20px;
    height: 20px;
}

.apple-icon {
    fill: var(--text-dark);
}

/* Illustration Column (Top on mobile, Right on desktop) */
.illustration-column {
    display: block;
    height: calc(50vw + 16px); /* Hauteur réduite pour n'afficher qu'une seule ligne (un carreau) sur mobile */
    background-color: #f2f2f2;
    position: relative;
    overflow: hidden;
    order: -1; /* Place above the form on mobile */
    border-bottom: 1px solid var(--border-light);
}

.col-3 {
    display: none; /* Masquer la 3ème colonne sur mobile */
}

/* Mobile : une seule rangée visible, les colonnes doivent s'aligner.
   Le décalage négatif est un effet desktop qui rognerait les cartes ici. */
@media (max-width: 767px) {
    .col-2 .grid-track {
        margin-top: 0;
    }
}

@media (min-width: 768px) {
    .illustration-column {
        flex: 0 0 50%;
        height: auto;
        border-left: 1px solid var(--border-light);
        border-bottom: none;
        order: 0;
    }

    .col-3 {
        display: block; /* Réafficher la 3ème colonne sur desktop */
    }
}

.animated-grid {
    display: flex;
    gap: 16px;
    padding: 16px;
    height: 100%;
}

.grid-column {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.grid-track {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
}

.col-1 .grid-track {
    animation: scroll-up 25s linear infinite;
}

.col-2 .grid-track {
    animation: scroll-down 30s linear infinite;
    margin-top: -120px;
}

.col-3 .grid-track {
    animation: scroll-up 28s linear infinite;
    margin-top: -60px;
}

@keyframes scroll-up {
    0% { transform: translateY(0); }
    100% { transform: translateY(calc(-50% - 8px)); }
}

@keyframes scroll-down {
    0% { transform: translateY(calc(-50% - 8px)); }
    100% { transform: translateY(0); }
}

.item-card {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-placeholder {
    font-size: 80px;
    user-select: none;
}

.btn-heart {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #ffffff;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    color: #1a1a1a;
    transition: transform 0.2s;
}

.btn-heart:hover {
    transform: scale(1.1);
}

.btn-heart svg {
    width: 16px;
    height: 16px;
}

/* Pastel backgrounds from the screenshot */
.bg-yellow { background-color: #fef7e1; }
.bg-yellow-light { background-color: #fff9e6; }
.bg-lavender { background-color: #e2d9f3; }
.bg-lavender-light { background-color: #eae5f8; }
.bg-lavender-dark { background-color: #dfd7f5; }
.bg-blue { background-color: #d1edf8; }
.bg-pink { background-color: #fad3d3; }
.bg-cyan { background-color: #d2f1f1; }
.bg-peach { background-color: #fce3d0; }

/* MAIN FOOTER */
.main-footer {
    background-color: #1a1a1a;
    color: #ffffff;
    padding: 64px 24px 32px 24px;
    margin-top: 64px;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 48px;
    margin-bottom: 64px;
}

.footer-column h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 24px;
}

.footer-column ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.footer-column ul li a {
    color: #a6a6a6;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
}

.footer-column ul li a:hover {
    color: #ffffff;
    text-decoration: underline;
}

.app-badges {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 32px;
}

.store-badge {
    background-color: #333333;
    border: 1px solid #4d4d4d;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.store-badge:hover {
    background-color: #4d4d4d;
}

.social-title {
    margin-bottom: 16px;
}

.social-icons {
    display: flex;
    gap: 16px;
}

.social-icons a {
    color: #ffffff;
    background-color: #333333;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.social-icons a:hover {
    background-color: var(--primary);
}

.footer-bottom {
    border-top: 1px solid #333333;
    padding-top: 32px;
    text-align: center;
    color: #a6a6a6;
    font-size: 14px;
}

@media (max-width: 768px) {
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }
}

/* Adaptation du footer pour la page de connexion (split screen) */
.page-layout + .main-footer {
    background-color: transparent;
    padding: 16px 24px;
    margin-top: 0;
    color: var(--text-neutral);
    border-top: none;
}

.page-layout + .main-footer .footer-container {
    max-width: none;
}

.page-layout + .main-footer .footer-grid {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 0;
}

.page-layout + .main-footer .footer-column h3,
.page-layout + .main-footer .app-badges,
.page-layout + .main-footer .social-title,
.page-layout + .main-footer .social-icons,
.page-layout + .main-footer .footer-bottom {
    display: none;
}

.page-layout + .main-footer .footer-column ul {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
}

.page-layout + .main-footer .footer-column ul li a {
    color: var(--text-neutral);
    font-size: 13px;
    text-decoration: underline;
}

@media (min-width: 768px) {
    .page-layout + .main-footer {
        position: absolute;
        bottom: 0;
        left: 0;
        width: 50%;
        padding: 24px;
    }
}

/* --- Modal Styles --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    position: relative;
    background-color: #ffffff;
    border-radius: 16px;
    padding: 32px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-align: center;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 12px;
}

.modal-desc {
    font-size: 14px;
    color: var(--text-neutral);
    margin-bottom: 24px;
    line-height: 1.5;
}

.code-inputs {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 24px;
}

.code-input {
    width: 44px;
    height: 52px;
    border: 1px solid var(--border-input);
    border-radius: 8px;
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    color: var(--text-dark);
    transition: all 0.2s;
}

.code-input:focus {
    border-color: var(--focus-ring);
    box-shadow: 0 0 0 3px rgba(65, 131, 215, 0.15);
    outline: none;
}

.modal-btn {
    width: 100%;
    height: 48px;
    border-radius: 24px;
    font-size: 16px;
    font-weight: 700;
    background-color: var(--primary);
    color: #ffffff;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-btn:hover {
    background-color: var(--primary-hover);
}

.modal-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: 50%;
    color: var(--text-neutral);
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.modal-close:hover {
    background-color: rgba(26, 26, 26, 0.06);
    color: var(--text-dark);
}

.modal-status {
    min-height: 18px;
    margin: -12px 0 16px;
    font-size: 13px;
    color: var(--text-neutral);
}

.modal-step-indicator {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-bottom: 24px;
}

.step-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--border-input);
}

.step-dot.active {
    background-color: var(--primary);
}
