/*
|--------------------------------------------------------------------------
| ASSETS/CSS/LOGIN.CSS
| Fusion de app.css + auth.css — page d'authentification uniquement
|--------------------------------------------------------------------------
*/


/*
|--------------------------------------------------------------------------
| Fonts — Inter (site) + Host Grotesk (logo Quorelix) + Seaside (tagline)
|--------------------------------------------------------------------------
*/

/* Inter Variable — police principale du site, hébergée en local */
@font-face {
    font-family: "Inter";
    src: url("/assets/fonts/Inter-VariableFont.ttf") format("truetype");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Inter Italic";
    src: url("/assets/fonts/Inter-Italic-VariableFont.ttf") format("truetype");
    font-weight: 100 900;
    font-style: italic;
    font-display: swap;
}

/* Host Grotesk — uniquement pour le logo "Quorelix" */
@font-face {
    font-family: "Host Grotesk";
    src: url("/assets/fonts/HostGrotesk-VariableFont_wght.ttf") format("truetype");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Seaside";
    src: url("/assets/fonts/Seaside.ttf") format("truetype");
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Geist";
    src: url("/assets/fonts/Geist-VariableFont_wght.ttf") format("truetype");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Manrope";
    src: url("/assets/fonts/Manrope-VariableFont_wght.ttf") format("truetype");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

/*
|--------------------------------------------------------------------------
| Design Tokens
|--------------------------------------------------------------------------
*/

:root {
    /* Typography */
    --font: "Geist", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;

    --text-xxxs: 8px;
    --text-xxs:  10px;
    --text-xs:   12px;
    --text-sm:   14px;
    --text-md:   16px;
    --text-lg:   18px;
    --text-xl:   20px;
    --text-2xl:  24px;
    --text-3xl:  32px;
    --text-4xl:  40px;

    --leading-tight:  1.15;
    --leading-normal: 1.5;
    --leading-loose:  1.7;

    --tracking-tight:  -0.04em;
    --tracking-normal: -0.02em;

    /* Spacing */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --space-7: 48px;
    --space-8: 64px;

    /* Colors */
    --bg:        #f5f5f7;
    --surface:   #ffffff;
    --surface-2: #fbfbfd;

    --text:      #1d1d1f;
    --text-soft: #424245;
    --muted:     #6e6e73;
    --line:      #d2d2d7;

    --accent:       #2C5F75;
    --accent-hover: #3a6a7d;
    --accent-soft:  rgba(44, 95, 117, 0.12);
    --accent-apple: #007AFF;

    /* Radius */
    --radius:    16px;
    --radius-sm: 12px;

    /* Layout */
    --auth-width: 320px;
    --max-width:  980px;

    /* Elevation */
    --shadow-soft: 0 4px 14px rgba(0, 0, 0, 0.04);
    --shadow:      0 10px 30px rgba(0, 0, 0, 0.08);
}


/*
|--------------------------------------------------------------------------
| Reset
|--------------------------------------------------------------------------
*/

* {
    box-sizing: border-box;
}


/*
|--------------------------------------------------------------------------
| Base — html/body en colonne flex pleine hauteur
| html porte le flex : insensible à tout futur conflit de cascade
|--------------------------------------------------------------------------
*/

html {
    min-height: 100dvh;        /* dvh = tient compte de la barre d'adresse mobile */
    display: flex;
    flex-direction: column;

    font-family: var(--font);
    font-feature-settings: "ss01", "ss02";
}

body {
    margin: 0;
    padding: 0;
    flex: 1;                   /* occupe tout l'espace de html */
    display: flex;
    flex-direction: column;

    background: #f5f5f7;
    color: var(--text);
    font-size: var(--text-md);
    line-height: var(--leading-normal);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Safari macOS — vibrancy expérimentale abandonnée (web ne peut pas exposer le bureau) */
/* .safari-mac body { background: transparent; } */


/*
|--------------------------------------------------------------------------
| Global Links & Focus
|--------------------------------------------------------------------------
*/

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    color: var(--accent-hover);
}

a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Les champs input n'ont pas d'outline au focus — la box entière réagit visuellement */
.field:focus-visible {
    outline: none;
}


/*
|--------------------------------------------------------------------------
| Layout container
|--------------------------------------------------------------------------
*/

.layout-container {
    width: min(calc(100% - 64px), 66.666vw, 980px);
    margin: 0 auto;
}


/*
|--------------------------------------------------------------------------
| Auth body — flex:1, pousse le footer vers le bas
|--------------------------------------------------------------------------
*/

.auth-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: var(--space-1);
}


/*
|--------------------------------------------------------------------------
| Brand Header
|--------------------------------------------------------------------------
*/

.brand-header {
    height: 38px;
    display: flex;
    align-items: center;
}

.brand-name {
    font-family: "Host Grotesk", sans-serif; /* garde Host Grotesk pour le Q de Quorelix */
    font-size: 20px;
    font-weight: 520;
    letter-spacing: -0.01em;
    line-height: 1;
    color: var(--text);
}


/*
|--------------------------------------------------------------------------
| Manager Band
|--------------------------------------------------------------------------
*/

.manager-band {
    width: 100vw;
    margin-top: 2px;
    margin-bottom: var(--space-6);
    margin-left: calc(50% - 50vw);
    padding: 7px 0;   /* -5px de hauteur totale vs 10px */
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.01);
}

.brand-product {
    margin: 0;
    font-family: "Inter", sans-serif;
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 0em;
    text-align: center;
    color: #1d1d1f;
}


/*
|--------------------------------------------------------------------------
| Scene
|--------------------------------------------------------------------------
*/

.scene {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
    min-height: 560px;
    /* padding-bottom = hauteur footer (50px) : compense pour un vrai centrage visuel */
    padding-bottom: 50px;
}

.scene .layout-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.hero {
    position: relative;
    display: inline-block;
    margin-bottom: 85px;
}

.illustration {
    display: block;
    height: 340px;
}

.tagline {
    position: absolute;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%) rotate(-3deg);
    white-space: nowrap;
    font-family: "Seaside", cursive;
    font-size: clamp(48px, 8vw, 96px);
    color: #000;
    opacity: 0.9;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
}


/*
|--------------------------------------------------------------------------
| Login Shell
|--------------------------------------------------------------------------
*/

.login-shell {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: var(--auth-width);
    margin: 0 auto;
}

.login-shell::before {
    content: "";
    position: absolute;
    inset: -24px -40px;
    z-index: -1;
    pointer-events: none;
    background: radial-gradient(
        ellipse at center,
        rgba(255, 255, 255, 0.78) 0%,
        rgba(255, 255, 255, 0.38) 42%,
        rgba(255, 255, 255, 0) 75%
    );
}


/*
|--------------------------------------------------------------------------
| Login Box
|--------------------------------------------------------------------------
*/

.login-box {
    overflow: hidden;
    outline: none;                /* neutralise l'outline système Safari au :focus-within */
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
    box-shadow:
        0 8px 24px rgba(0, 0, 0, 0.05),
        0 2px 6px rgba(0, 0, 0, 0.035);
    transition:
        border-color 160ms ease,
        box-shadow 160ms ease;
}

.login-box:focus-within {
    border-color: var(--line);
    box-shadow:
        0 8px 24px rgba(0, 0, 0, 0.07),
        0 2px 6px rgba(0, 0, 0, 0.04);
}

.login-box.shake {
    animation: auth-shake 420ms ease;
}


/*
|--------------------------------------------------------------------------
| Stacked Rows
|--------------------------------------------------------------------------
*/

.row {
    position: relative;
    outline: none;
}

.row + .row {
    border-top: 1px solid var(--line);
}

.row:first-child .field {
    border-top-left-radius: 18px;
    border-top-right-radius: 18px;
}

.row:last-child .field {
    padding-right: 52px;
    border-bottom-left-radius: 18px;
    border-bottom-right-radius: 18px;
}

.row:focus-within + .row {
    border-top-color: var(--line);
}

.row:focus-within {
    background: rgba(0, 0, 0, 0.015);
}


/*
|--------------------------------------------------------------------------
| Fields
|--------------------------------------------------------------------------
*/

.field {
    width: 100%;
    height: 60px;
    padding: 0 var(--space-4);
    border: 0;
    outline: none;
    -webkit-appearance: none; /* supprime le style natif Safari au focus (bande bleue) */
    appearance: none;
    background: transparent;
    color: var(--text);
    caret-color: var(--accent);
    font: inherit;
    font-size: var(--text-md);
    transition:
        background 120ms ease,
        color 120ms ease;
}

.field::placeholder {
    color: var(--muted);
    opacity: 0.65;
}

.field:focus {
    position: relative;
    z-index: 2;
    background: #ffffff;
}

.field.is-valid   { background: rgba(0, 180, 80, 0.06); }
.field.is-invalid { background: rgba(220, 38, 38, 0.06); }

.field:-webkit-autofill,
.field:-webkit-autofill:hover,
.field:-webkit-autofill:focus,
.field:-webkit-autofill:active {
    -webkit-text-fill-color: var(--text);
    transition: background-color 9999s ease-in-out 0s;
    box-shadow: 0 0 0 1000px var(--surface) inset;
}


/*
|--------------------------------------------------------------------------
| Submit Button
|--------------------------------------------------------------------------
*/

.submit-wrap {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    z-index: 3; /* au-dessus du .field:focus qui monte à z-index:2 */
}

.submit-btn {
    width: auto;
    height: auto;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    color: var(--muted);
    box-shadow: none;
    cursor: pointer;
    opacity: 0.55;
    font: inherit;
    font-size: var(--text-sm);
    font-weight: 400;
    line-height: 1;
    transition:
        opacity 120ms ease,
        transform 120ms ease,
        color 120ms ease;
}

.field:not(:placeholder-shown) + .submit-wrap .submit-btn,
.field:focus + .submit-wrap .submit-btn {
    opacity: 1;
}

.submit-btn:hover  { color: var(--accent); transform: translateX(3px); }
.submit-btn:active { transform: translateX(3px) scale(0.95); }
.submit-btn:disabled { opacity: 0.2; cursor: default; }


/*
|--------------------------------------------------------------------------
| Secondary Links
|--------------------------------------------------------------------------
*/

.links {
    display: flex;
    justify-content: center;
    gap: var(--space-4);
    margin-top: 18px;
    color: var(--muted);
    font-size: var(--text-xs);
    line-height: var(--leading-normal);
}

.links a         { color: inherit; text-decoration: none; }
.links a:hover   { color: var(--text); }


/*
|--------------------------------------------------------------------------
| Notices
|--------------------------------------------------------------------------
*/

.notice {
    margin-top: var(--space-5);
    padding: var(--space-3) var(--space-5);
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: var(--text-sm);
    font-weight: 600;
    line-height: var(--leading-normal);
}

.notice.error {
    background: rgba(200, 40, 40, 0.12);
    color: #c0392b;
}


/*
|--------------------------------------------------------------------------
| Animation
|--------------------------------------------------------------------------
*/

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


/*
|--------------------------------------------------------------------------
| Responsive
|--------------------------------------------------------------------------
*/

@media (max-width: 900px) {
    .tagline {
        font-size: clamp(42px, 10vw, 72px);
    }
}

@media (max-width: 640px) {
    .auth-body {
        padding: var(--space-5);
    }

    .layout-container,
    .auth-footer-inner {
        width: min(calc(100% - 32px), 100%);
    }

    .brand-header {
        padding-top: 12px;
    }

    .brand-name {
        font-size: 18px;
    }

    .brand-product {
        font-size: 28px;
        letter-spacing: 0.22em;
    }

    .tagline {
        margin-bottom: var(--space-4);
        padding-left: 4px;
        font-size: clamp(34px, 11vw, 56px);
    }

    .field {
        height: 58px;
        font-size: var(--text-md);
    }

    .links {
        flex-wrap: wrap;
        gap: var(--space-3);
    }

    .auth-footer-inner {
        flex-wrap: wrap;
        height: auto;
        padding: var(--space-3) 0;
    }

    .auth-footer-links {
        flex-wrap: wrap;
        gap: 10px 12px;
    }
}


/*
|--------------------------------------------------------------------------
| Table Deco — illustration décorative select-space.php
| Position fixe bord droit, légère perspective, coupe sur le bord
|--------------------------------------------------------------------------
*/

.table-deco {
    position: fixed;
    right: -40px;            /* bien décalée vers le bord droit */
    bottom: -90px;           /* descend légèrement hors du cadre */
    pointer-events: none;
    z-index: 0;
    user-select: none;
}

.table-deco img {
    display: block;
    height: 800px;
    opacity: 0.92;
}

/*
|--------------------------------------------------------------------------
| Clavier Deco — illustration centrale select-space.php
| Centrée horizontalement, passe derrière les cards (z-index: 0)
|--------------------------------------------------------------------------
*/

@keyframes boum-splash {
    /* minuscule, flou, flashé blanc */
    0%   { transform: scale(0.05); opacity: 0;    filter: blur(12px) brightness(4); }
    /* impact — éclate avec halo lumineux */
    35%  { transform: scale(1.12); opacity: 1;    filter: blur(0px)  brightness(1.4); }
    /* stabilisation directe */
    100% { transform: scale(1);    opacity: 0.92; filter: blur(0px)  brightness(1); }
}

.clavier-deco {
    position: fixed;
    left: 50%;
    /* centrage vertical dans la zone contenu : compense header ~73px + footer 50px */
    top: calc(50% + 12px);
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 0;
    user-select: none;
}

.clavier-deco img {
    display: block;
    height: 500px;
    opacity: 0.92;
    transform-origin: center center;
    animation: boum-splash 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@media (max-width: 768px) {
    /* masqué sur mobile pour ne pas gêner le formulaire */
    .table-deco   { display: none; }
    .clavier-deco { display: none; }
}


/*
|--------------------------------------------------------------------------
| Space Button — sélecteur d'espace dans select-space.php
|--------------------------------------------------------------------------
*/

.space-prompt {
    margin: 0 0 var(--space-3);
    font-size: var(--text-sm);
    font-weight: 600;
    color: #ffffff;
    text-shadow:
        0 0 16px rgba(255, 255, 255, 0.7),
        0 1px 6px rgba(0, 0, 0, 0.55);
    text-align: center;
    letter-spacing: 0.01em;
}

.space-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    width: 100%;
}

/* Chaque espace = un bouton submit autonome, visuel identique à .login-box */
.space-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 60px;
    padding: 0 var(--space-4);
    border: 1px solid rgba(0, 0, 0, 0.13);
    border-radius: 16px;
    background: var(--surface);
    color: var(--text);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.18),
        0 2px 8px  rgba(0, 0, 0, 0.12);
    font: inherit;
    font-size: var(--text-md);
    text-align: left;
    cursor: pointer;
    transition:
        border-color 160ms ease,
        box-shadow 160ms ease,
        color 120ms ease;
}

.space-card:hover {
    border-color: rgba(0, 113, 227, 0.35);
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.22),
        0 3px 10px  rgba(0, 0, 0, 0.14);
    color: var(--accent);
}

.space-card__name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.space-card__arrow {
    flex-shrink: 0;
    margin-left: var(--space-3);
    font-size: var(--text-sm);
    color: var(--muted);
    transition: color 120ms ease, transform 120ms ease;
}

.space-card:hover .space-card__arrow {
    color: var(--accent);
    transform: translateX(3px);
}
