/*
 * Identité ciklik.co sur les pages d'authentification (resources/views/auth).
 * Chargée après libs.bundle.css et theme.bundle.css (ancien thème, partagé, non modifié) et après ciklik-brand.css,
 * qui déclare les polices Inter et Gabarito auto-hébergées et --ciklik-font-text, --ciklik-font-title, --ciklik-coral.
 * Les sélecteurs passent par .auth-body pour l'emporter sur l'ancien thème sans !important (sauf ses utilitaires).
 * Couleurs reprises de ciklik.co (page Démo) ; contrastes AA vérifiés dans les deux thèmes.
 */

.auth-body {
    --auth-bg: #fff;
    --auth-ink: #111433;
    --auth-muted: #5a5f86; /* 6,1:1 sur blanc */
    --auth-line: #e3e5f1;
    --auth-soft: #f4f5f9;
    --auth-field-bg: #fff;
    --auth-field-border: #8a8fb3; /* 3,1:1 sur blanc, bord de champ visible */
    --auth-placeholder: #7b80a6;
    --auth-link: #1d2679; /* marine, 13:1 */
    --auth-link-hover: #d92f48;
    --auth-focus: #1d2679;
    --auth-focus-ring: rgba(29, 38, 121, 0.22);
    --auth-action: rgb(var(--ciklik-coral, 217, 47, 72)); /* corail #D92F48, texte blanc 4,7:1 */
    --auth-action-hover: #c4253d;
    --auth-check: #1d2679;
    --auth-error: #b3203a;
    --auth-danger-bg: #fde8eb;
    --auth-danger-ink: #8f1028;
    --auth-success-bg: #e8f5ee;
    --auth-success-ink: #11603d;
    --auth-info-bg: #eef0fb;
    --auth-info-ink: #1d2679;
    --auth-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%235a5f86' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round' d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
    --auth-mono: ui-monospace, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
    color-scheme: light;

    min-height: 100vh;
    margin: 0;
    background-color: var(--auth-bg);
    color: var(--auth-ink);
    font-family: var(--ciklik-font-text);
    font-size: 1rem;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

@media (prefers-color-scheme: dark) {
    .auth-body {
        --auth-bg: #0e1029;
        --auth-ink: #f5f6fb; /* 17:1 */
        --auth-muted: #a3a8cf; /* 8:1 */
        --auth-line: rgba(154, 161, 220, 0.18);
        --auth-soft: #151833;
        --auth-field-bg: #151833;
        --auth-field-border: #6c71a0; /* 3,7:1 sur le champ */
        --auth-placeholder: #8a8fb3;
        --auth-link: #b4bae6; /* 9,9:1 */
        --auth-link-hover: #ff8a9b;
        --auth-focus: #9aa1dc;
        --auth-focus-ring: rgba(154, 161, 220, 0.35);
        --auth-check: #3a44a0;
        --auth-error: #ff8a9b; /* 8,3:1 */
        --auth-danger-bg: rgba(255, 80, 103, 0.14);
        --auth-danger-ink: #ffb3bf;
        --auth-success-bg: rgba(46, 180, 120, 0.16);
        --auth-success-ink: #9be3c0;
        --auth-info-bg: rgba(154, 161, 220, 0.14);
        --auth-info-ink: #c3c8ec;
        --auth-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23a3a8cf' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round' d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
        color-scheme: dark;
    }
}

/* Mise en page : formulaire à gauche, vitrine sombre de ciklik.co à droite (masquée sous 992 px) */

.auth {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    min-height: 100vh;
    min-height: 100svh;
}

.auth__main {
    display: flex;
    justify-content: center;
    padding: 28px 16px 48px;
}

.auth__inner {
    width: 100%;
    max-width: 400px;
}

.auth--wide .auth__inner {
    max-width: 520px;
}

.auth-logo {
    display: block;
    margin: 0 0 clamp(36px, 7vh, 72px);
}

.auth-logo img {
    display: block;
    width: auto;
    height: 30px;
}

.auth-title {
    margin: 0 0 8px;
    color: var(--auth-ink);
    font-family: var(--ciklik-font-title);
    font-size: clamp(30px, 7vw, 38px);
    font-weight: 700;
    line-height: 1.08;
    letter-spacing: -0.02em;
    text-wrap: balance;
}

.auth-subtitle {
    margin: 0 0 28px;
    color: var(--auth-muted);
    font-size: 16px;
    line-height: 1.5;
}

.auth-label-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 4px 12px;
}

.auth-label-row a {
    margin-bottom: 6px;
    font-size: 14px;
}

.auth-alt {
    margin: 24px 0 0;
    color: var(--auth-muted);
    font-size: 15px;
    text-align: center;
}

.auth-body h2 {
    margin: 28px 0 8px;
    color: var(--auth-ink);
    font-family: var(--ciklik-font-title);
    font-size: 22px;
    font-weight: 700;
}

/* Liens et focus */

.auth-body a {
    color: var(--auth-link);
    font-weight: 600;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

.auth-body a:hover {
    color: var(--auth-link-hover);
}

.auth-body a:focus-visible,
.auth-body .btn:focus-visible,
.auth-body .form-check-input:focus-visible {
    outline: 2px solid var(--auth-focus);
    outline-offset: 3px;
    border-radius: 6px;
}

/* Champs */

.auth-body .form-group {
    margin-bottom: 18px;
}

.auth-body label,
.auth-body .form-label {
    display: inline-block;
    margin-bottom: 6px;
    color: var(--auth-ink);
    font-size: 14px;
    font-weight: 600;
}

.auth-body .form-control {
    min-height: 48px;
    padding: 11px 14px;
    border: 1.5px solid var(--auth-field-border);
    border-radius: 10px;
    background-color: var(--auth-field-bg);
    color: var(--auth-ink);
    font-size: 16px; /* pas de zoom au focus sur iOS */
    line-height: 1.5;
}

.auth-body .form-control::placeholder {
    color: var(--auth-placeholder);
    opacity: 1;
}

.auth-body .form-control:hover {
    border-color: var(--auth-focus);
}

.auth-body .form-control:focus {
    border-color: var(--auth-focus);
    background-color: var(--auth-field-bg);
    box-shadow: 0 0 0 3px var(--auth-focus-ring);
    color: var(--auth-ink);
    outline: 0;
}

/* Remplissage automatique du navigateur : garder les couleurs du thème */
.auth-body .form-control:-webkit-autofill {
    -webkit-text-fill-color: var(--auth-ink);
    box-shadow: 0 0 0 100px var(--auth-field-bg) inset;
    caret-color: var(--auth-ink);
}

/* L'ancien thème retire la flèche des listes (appearance: none) */
.auth-body select.form-control {
    padding-right: 42px;
    background-image: var(--auth-chevron);
    background-position: right 14px center;
    background-repeat: no-repeat;
    background-size: 16px 16px;
}

.auth-body .form-control.is-invalid,
.auth-body .form-control.is-invalid:focus {
    border-color: var(--auth-error);
}

.auth-body .invalid-feedback {
    display: block;
    margin-top: 6px;
    color: var(--auth-error);
    font-size: 14px;
    font-weight: 500;
}

.auth-body .text-danger {
    color: var(--auth-error) !important;
    font-weight: 500;
}

.auth-body .text-muted {
    color: var(--auth-muted) !important;
}

/* Case à cocher */

.auth-body .form-check {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 24px;
    margin-bottom: 20px;
    padding-left: 0;
}

.auth-body .form-check-input {
    flex: none;
    float: none;
    width: 20px;
    height: 20px;
    margin: 0;
    border: 1.5px solid var(--auth-field-border);
    border-radius: 5px;
    background-color: var(--auth-field-bg);
}

.auth-body .form-check-input:checked {
    border-color: var(--auth-check);
    background-color: var(--auth-check);
}

.auth-body .form-check-input:focus {
    border-color: var(--auth-focus);
    box-shadow: 0 0 0 3px var(--auth-focus-ring);
}

.auth-body .form-check-label {
    margin: 0;
    font-weight: 500;
}

/* Boutons : corail pour l'action, comme ciklik.co */

.auth-body .btn-primary,
.auth-body .btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    min-height: 50px;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.25;
    text-decoration: none;
    box-shadow: none;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.auth-body .btn-primary {
    border: 0;
    background-color: var(--auth-action);
    color: #fff;
}

.auth-body .btn-primary:hover,
.auth-body .btn-primary:focus,
.auth-body .btn-primary:active {
    border: 0;
    background-color: var(--auth-action-hover);
    color: #fff;
    box-shadow: none;
}

.auth-body .btn-primary:hover {
    transform: translateY(-1px);
}

.auth-body .btn-primary:disabled {
    background-color: var(--auth-action);
    color: #fff;
    opacity: 0.7;
    transform: none;
}

.auth-body .btn-secondary {
    border: 1.5px solid var(--auth-field-border);
    background-color: transparent;
    color: var(--auth-ink);
}

.auth-body .btn-secondary:hover,
.auth-body .btn-secondary:focus {
    border-color: var(--auth-focus);
    background-color: var(--auth-soft);
    color: var(--auth-ink);
    box-shadow: none;
}

.auth-body .btn-link {
    color: var(--auth-link);
    font-weight: 600;
    vertical-align: baseline;
}

.auth-body .btn-link:hover {
    color: var(--auth-link-hover);
}

.auth-body .auth-submit {
    margin-top: 6px;
}

/* Messages */

.auth-body .alert {
    margin-bottom: 20px;
    padding: 12px 14px;
    border: 0;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.45;
}

.auth-body .alert-danger {
    background-color: var(--auth-danger-bg);
    color: var(--auth-danger-ink);
}

.auth-body .alert-success {
    background-color: var(--auth-success-bg);
    color: var(--auth-success-ink);
}

.auth-body .alert-info {
    background-color: var(--auth-info-bg);
    color: var(--auth-info-ink);
}

/* Double authentification : QR code sur fond blanc (lisible en sombre), codes de secours */

.auth-qr {
    display: inline-block;
    padding: 12px;
    border-radius: 12px;
    background: #fff;
}

.auth-qr svg {
    display: block;
}

.auth-codes {
    margin: 0 0 24px;
    padding: 14px 18px;
    border-radius: 10px;
    background: var(--auth-soft);
    columns: 2;
    font-family: var(--auth-mono);
    font-size: 14px;
    list-style: none;
}

/*
 * Vitrine : ouverture sombre de ciklik.co, trame de points et aperçu du tableau de bord.
 * Sous 992 px, bandeau sous le formulaire (aperçu masqué sous 560 px) ; au-delà, colonne de droite fixe.
 */

.auth-showcase {
    position: relative;
    overflow: hidden;
    padding: 48px 16px 56px;
    border-top: 1px solid rgba(154, 161, 220, 0.14);
    background: #08091a;
    color: #fff;
}

@media (max-width: 559px) {
    .auth-mock {
        display: none;
    }
}

@media (min-width: 560px) and (max-width: 991px) {
    .auth-showcase {
        padding: 56px 32px 64px;
    }

    .auth-showcase__inner {
        margin: 0 auto;
    }
}

@media (min-width: 992px) {
    .auth {
        grid-template-columns: minmax(440px, 5fr) 7fr;
    }

    .auth__main {
        align-items: center;
        padding: 48px clamp(32px, 4vw, 64px);
    }

    .auth-showcase {
        position: sticky;
        top: 0;
        display: flex;
        align-items: center;
        align-self: start;
        justify-content: center;
        height: 100vh;
        padding: 48px clamp(40px, 5vw, 96px);
        border-top: 0;
    }
}

.auth-showcase__grid {
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(154, 161, 220, 0.16) 1px, transparent 1px);
    background-size: 28px 28px;
    -webkit-mask-image: radial-gradient(ellipse at 70% 40%, #000 0, transparent 70%);
    mask-image: radial-gradient(ellipse at 70% 40%, #000 0, transparent 70%);
    pointer-events: none;
}

.auth-showcase__inner {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 28px;
    width: 100%;
    max-width: 580px;
}

.auth-showcase__title {
    margin: 0;
    color: #fff;
    font-family: var(--ciklik-font-title);
    font-size: clamp(32px, 3.4vw, 54px);
    font-weight: 800;
    line-height: 1.02;
    letter-spacing: -0.03em;
}

.auth-showcase__title span {
    color: #9aa1dc;
}

.auth-showcase__lead {
    max-width: 44ch;
    margin: 0;
    color: #a3a8cf;
    font-size: 18px;
    line-height: 1.55;
}

.auth-mock {
    overflow: hidden;
    border: 1px solid rgba(154, 161, 220, 0.2);
    border-radius: 20px;
    background: #0f1128;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
    font-family: var(--auth-mono);
    animation: auth-appear 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.auth-mock__bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    border-bottom: 1px solid rgba(154, 161, 220, 0.14);
    color: #c3c8ec;
    font-size: 12px;
}

.auth-mock__dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #2b3060;
}

.auth-mock__dot:last-of-type {
    margin-right: 6px;
}

.auth-mock__kpis {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border-bottom: 1px solid rgba(154, 161, 220, 0.14);
}

.auth-mock__kpi {
    padding: 16px 18px;
}

.auth-mock__kpi + .auth-mock__kpi {
    border-left: 1px solid rgba(154, 161, 220, 0.14);
}

.auth-mock__label {
    display: block;
    color: #a3a8cf;
    font-size: 10.5px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
}

/* Valeurs remplacées par des barres abstraites : aucun chiffre qui passe pour une vraie donnée */
.auth-mock__skel {
    display: block;
    height: 8px;
    border-radius: 9999px;
    background: rgba(154, 161, 220, 0.22);
}

.auth-mock__skel--value {
    width: 58%;
    height: 16px;
    margin: 10px 0 9px;
    background: rgba(245, 246, 251, 0.85);
}

.auth-mock__skel--wide {
    width: 74%;
}

.auth-mock__skel--up {
    width: 40%;
    background: rgba(95, 211, 155, 0.6);
}

.auth-mock__skel--note {
    width: 34%;
}

.auth-mock__chart {
    display: block;
    width: 100%;
    height: 64px;
}

.auth-mock__feed {
    margin: 0;
    padding: 6px 10px 12px;
    list-style: none;
}

.auth-mock__heading {
    padding: 10px 8px 8px;
    color: #a3a8cf;
    font-size: 10.5px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.auth-mock__item {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 10px 8px;
    border-radius: 10px;
}

.auth-mock__item--new {
    background: rgba(255, 80, 103, 0.08);
}

.auth-mock__icon {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    color: #fff;
}

.auth-mock__icon svg {
    width: 15px;
    height: 15px;
}

.auth-mock__icon--ok {
    background: #1f8f5f;
}

.auth-mock__icon--star {
    background: #b3203a;
}

.auth-mock__icon--pause {
    background: #3a44a0;
}

.auth-mock__what {
    display: block;
    overflow: hidden;
    color: #fff;
    font-family: var(--ciklik-font-text);
    font-size: 14px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.auth-mock__skel--meta {
    width: 78%;
    height: 6px;
    margin-top: 7px;
}

.auth-mock__skel--short {
    width: 52%;
}

.auth-mock__skel--time {
    width: 44px;
    height: 6px;
}

@keyframes auth-appear {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-mock {
        animation: none;
    }

    .auth-body .btn-primary,
    .auth-body .btn-secondary {
        transition: none;
    }

    .auth-body .btn-primary:hover {
        transform: none;
    }
}
