/* Page d'accueil — hero plein écran + carte à onglets (connexion/inscription).
   Onglets en CSS pur (radios cachées + labels) : la CSP du site interdit le JS
   inline, et aucun JS externe n'est nécessaire pour ce simple basculement.
   Palette : tokens.css (--thermal/--ocre/--ink/--vapeur) ; Tajawal/Gulzar
   chargées uniquement sur cette page (voir routes.php). */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.home-hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: stretch;
    overflow: hidden;
}

.home-hero__bg {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.home-hero__bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Voile plus opaque du côté de la carte (droite, en RTL) pour la lisibilité,
   plus transparent du côté de l'illustration pour la laisser respirer. */
.home-hero__scrim {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to left,
        rgba(22, 33, 31, 0.72) 0%,
        rgba(22, 33, 31, 0.52) 38%,
        rgba(31, 110, 106, 0.38) 65%,
        rgba(31, 110, 106, 0.20) 100%
    );
}

/* ── Panneau droit : logo (mobile) + carte ── */
.home-hero__panel {
    position: relative;
    z-index: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

@media (min-width: 768px) {
    .home-hero__panel {
        width: 460px;
        flex-shrink: 0;
        padding: 2.5rem 2rem;
    }
}

.home-hero__logo-mobile {
    width: 92px;
    height: 92px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
    margin-bottom: 1.25rem;
}

@media (min-width: 768px) {
    .home-hero__logo-mobile {
        display: none;
    }
}

/* ── Carte à onglets ── */
.home-card {
    width: 100%;
    max-width: 420px;
    background: rgba(255, 255, 255, 0.96);
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
    overflow: hidden;
}

.home-tab-radio {
    /* Cachées visuellement mais focusables au clavier (flèches du groupe radio). */
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    clip: rect(0 0 0 0);
    overflow: hidden;
}

.home-card__tabs {
    display: flex;
}

.home-card__tab {
    flex: 1;
    text-align: center;
    padding: 1.05rem 0.5rem;
    font-family: var(--font-body);
    font-size: 1.02rem;
    font-weight: 700;
    cursor: pointer;
    background: rgba(31, 110, 106, 0.10);
    color: rgba(22, 33, 31, 0.65);
    border-bottom: 2px solid transparent;
    transition: background 0.15s ease, color 0.15s ease;
    user-select: none;
}

.home-card__tab:hover {
    background: rgba(31, 110, 106, 0.16);
}

/* Onglet actif */
#tab-new:checked ~ .home-card__tabs .home-card__tab--new,
#tab-old:checked ~ .home-card__tabs .home-card__tab--old {
    background: var(--thermal);
    color: var(--vapeur);
    border-bottom-color: var(--ocre);
}

/* Focus clavier visible sur l'onglet correspondant */
#tab-new:focus-visible ~ .home-card__tabs .home-card__tab--new,
#tab-old:focus-visible ~ .home-card__tabs .home-card__tab--old {
    outline: 3px solid var(--focus);
    outline-offset: -3px;
}

/* Panneaux */
.home-card__panel {
    display: none;
    padding: 1.6rem 1.9rem 1.9rem;
    text-align: right;
}

#tab-new:checked ~ .home-card__panel--new,
#tab-old:checked ~ .home-card__panel--old {
    display: block;
}

.home-card__hint {
    font-size: 0.85rem;
    color: rgba(22, 33, 31, 0.65);
    margin: 0 0 1.3rem;
    text-align: center;
}

/* Champs "soulignés" dans l'esprit de la maquette */
.home-field {
    margin-bottom: 1.15rem;
}

.home-field label {
    display: block;
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--thermal);
    margin-bottom: 0.3rem;
}

.home-field input {
    width: 100%;
    min-height: 44px;
    border: none;
    border-bottom: 1.5px solid rgba(31, 110, 106, 0.35);
    border-radius: 0;
    background: transparent;
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--ink);
    padding: 0 0.15rem;
}

.home-field input:focus {
    outline: none;
    border-bottom-color: var(--ocre);
    box-shadow: 0 1.5px 0 0 var(--ocre);
}

.home-field input:focus-visible {
    outline: none;
}

.home-field input::placeholder {
    color: rgba(22, 33, 31, 0.45);
}

/* Champ code OTP : chiffres espacés, centrés (le code est en chiffres latins). */
.home-field__code {
    direction: ltr;
    text-align: center;
    font-size: 1.35rem;
    letter-spacing: 0.5em;
    font-family: var(--font-mono);
}

.home-field .field-error {
    display: block;
    margin-top: 0.3rem;
}

.home-field--split {
    display: flex;
    gap: 1rem;
}

.home-field--split > div {
    flex: 1;
}

.home-card__submit {
    display: block;
    width: 100%;
    min-height: 52px;
    margin-top: 1.5rem;
    background: var(--thermal);
    color: var(--vapeur);
    border: none;
    border-radius: 10px;
    font-family: var(--font-body);
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: filter 0.15s ease;
}

.home-card__submit:hover {
    filter: brightness(1.1);
}

.home-card__alt {
    text-align: center;
    font-size: 0.88rem;
    color: rgba(22, 33, 31, 0.65);
    margin: 1.2rem 0 0;
}

.home-card__alt-link {
    color: var(--focus);
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
}

.home-card__alt-link:hover {
    text-decoration: underline;
}

/* Appel visible vers le formulaire de réclamation "طلب استرجاع الدخول"
   (CIN d'ancien client non reconnu) — sur la page d'accueil directement (pas
   dans un onglet), auparavant accessible uniquement en 2 clics via l'étape
   OTP de l'onglet "ancien client". */
.home-legacy-cta {
    width: 100%;
    max-width: 420px;
    margin-top: 1rem;
    padding: 1rem 1.1rem 1.15rem;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(198, 134, 47, 0.35);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
    text-align: center;
}

.home-legacy-cta__icon {
    color: var(--ocre-deep);
    margin-bottom: 0.4rem;
}

.home-legacy-cta__title {
    margin: 0 0 0.3rem;
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--ink);
}

.home-legacy-cta__hint {
    margin: 0;
    font-size: 0.8rem;
    line-height: 1.6;
    color: rgba(22, 33, 31, 0.68);
}

.home-legacy-cta__btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    width: auto;
    min-height: 40px;
    margin-top: 0.85rem;
    padding: 0 1.1rem;
    font-size: 0.88rem;
}

.home-legacy-cta__btn svg {
    transform: scaleX(-1); /* flèche pointant vers la gauche en RTL */
}

/* Popup ciblé de récupération d'accès ancien client — anatomie et décoration
   reprises à l'identique du modal "mساعدة الحجز" de la maquette fournie
   (overlay plein écran + carte, en-tête sticky, icône + accroche + titre,
   grille de champs 2 colonnes, upload personnalisé, encart confidentialité,
   rangée de boutons) : seule la présentation change, chaque champ/texte
   métier existant (nature du problème, نوم/prénom, CIN, téléphone, unité,
   période, justificatif) reste strictement identique. <dialog> natif conservé
   (accessibilité: piège de focus, Échap, ::backdrop) au lieu du overlay/JS
   manuel de la maquette — le rendu "plein écran" est équivalent. */
.legacy-access-open {
    padding: 0;
    border: 0;
    background: transparent;
    font-family: inherit;
    font-size: inherit;
}

.legacy-access-dialog {
    position: fixed;
    width: min(92vw, 620px);
    max-height: calc(100vh - 40px);
    margin: auto;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 26px;
    background: var(--vapeur);
    color: var(--ink);
    box-shadow: 0 28px 80px rgba(16, 75, 77, 0.28);
    overflow-y: auto;
    text-align: right;
    animation: legacy-access-in 0.35s ease both;
}

.legacy-access-dialog::backdrop {
    background: rgba(16, 75, 77, 0.45);
    backdrop-filter: blur(3px);
}

@keyframes legacy-access-in {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
    .legacy-access-dialog {
        animation: none;
    }
}

/* En-tête sticky (repère "مساعدة الحجز" + fermeture) — distinct du bloc
   accroche/titre qui suit, comme dans la maquette. */
.legacy-access-dialog__topbar {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(22, 33, 31, 0.13);
    background: rgba(251, 250, 246, 0.95);
    backdrop-filter: blur(12px);
}

.legacy-access-dialog__topbar-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.legacy-access-dialog__topbar-label svg {
    color: var(--ocre);
}

.legacy-access-dialog__close {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    color: var(--muted);
    background: transparent;
    cursor: pointer;
}

.legacy-access-dialog__close:hover {
    color: var(--deep-teal);
    background: #e8f0eb;
}

.legacy-access-dialog__body {
    padding: 24px 20px 28px;
}

.legacy-access-dialog__heading {
    display: flex;
    gap: 16px;
}

.legacy-access-dialog__icon {
    display: grid;
    place-items: center;
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    border-radius: 16px;
    color: var(--thermal);
    background: #e5f0eb;
}

.legacy-access-dialog__kicker {
    margin: 0;
    color: var(--ocre-deep);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.14em;
}

.legacy-access-dialog__heading h2 {
    margin: 8px 0 0;
    color: var(--deep-teal);
    font-size: 25px;
    letter-spacing: -0.025em;
}

.legacy-access-dialog__description {
    max-width: 500px;
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.8;
}

.legacy-access-dialog form {
    margin-top: 24px;
}

.legacy-access-form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.legacy-access-field {
    display: block;
}

.legacy-access-field--full {
    grid-column: span 2;
}

.legacy-access-field > span:first-child {
    display: block;
    margin-bottom: 8px;
    color: var(--ink);
    font-size: 12px;
    font-weight: 700;
}

.legacy-access-dialog input:not([type="file"]),
.legacy-access-dialog select {
    width: 100%;
    min-height: 44px;
    padding: 12px 14px;
    border: 1px solid rgba(16, 75, 77, 0.18);
    border-radius: 12px;
    color: var(--ink);
    background: #fffdf9;
    font-family: var(--font-body);
    font-size: 0.95rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.legacy-access-dialog input:not([type="file"]):hover,
.legacy-access-dialog select:hover {
    border-color: rgba(31, 110, 106, 0.42);
}

.legacy-access-dialog input:not([type="file"]):focus,
.legacy-access-dialog select:focus {
    outline: none;
    border-color: var(--thermal);
    box-shadow: 0 0 0 3px rgba(31, 110, 106, 0.16);
    background: #fff;
}

.legacy-access-dialog input::placeholder {
    color: #a0aaa6;
}

.legacy-access-optional {
    display: inline-block;
    margin-right: 8px;
    padding: 2px 8px;
    border-radius: 999px;
    color: var(--ocre-deep);
    background: #f1e3c7;
    font-size: 10px;
    font-weight: 600;
}

.legacy-access-file-label {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid rgba(16, 75, 77, 0.18);
    border-radius: 12px;
    color: #7e8986;
    background: #fffdf9;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.legacy-access-file-label:hover,
.legacy-access-file-label:focus-within {
    border-color: rgba(31, 110, 106, 0.42);
    background: #fff;
}

.legacy-access-file-label svg {
    flex: 0 0 auto;
    color: var(--thermal);
}

.legacy-access-file-name {
    min-width: 0;
    overflow: hidden;
    flex: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.9rem;
}

.legacy-access-help {
    color: rgba(22, 33, 31, 0.6);
    font-weight: 400;
    font-size: 0.8rem;
    display: block;
    margin-top: 0.35rem;
}

.legacy-access-privacy-note {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: 12px;
    color: #5f7470;
    background: #f0f4ef;
    font-size: 12px;
    line-height: 1.7;
}

.legacy-access-privacy-note svg {
    flex: 0 0 auto;
    margin-top: 2px;
    color: var(--thermal);
}

.legacy-access-button-row {
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 20px;
}

.legacy-access-button-row .btn {
    width: auto;
    min-height: 46px;
    padding: 0.7rem 1.3rem;
    border-radius: 12px;
    font-size: 0.9rem;
}

.legacy-access-button-row .btn:hover {
    transform: translateY(-1px);
}

/* Scanner caméra (App\Security côté serveur + assets/js/jsQR.min.js côté
   client) — option "rapide", la saisie manuelle du code reste toujours
   disponible juste en dessous comme repli. */
.legacy-access-scan {
    margin-top: 4px;
}

.legacy-access-scan__toggle {
    width: 100%;
}

.legacy-access-scan__viewport {
    position: relative;
    margin-top: 12px;
    border-radius: 16px;
    overflow: hidden;
    background: #000;
    aspect-ratio: 4 / 3;
}

.legacy-access-scan__video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.legacy-access-scan__frame {
    position: absolute;
    inset: 15%;
    border: 3px solid rgba(255, 255, 255, 0.85);
    border-radius: 16px;
    box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.35);
    pointer-events: none;
}

.legacy-access-scan__hint {
    position: absolute;
    inset-inline: 0;
    bottom: 44px;
    margin: 0;
    text-align: center;
    color: #fff;
    font-size: 12px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
    pointer-events: none;
}

.legacy-access-scan__stop {
    position: absolute;
    inset-inline: 0;
    bottom: 10px;
    margin: 0 auto;
    width: fit-content;
    color: #fff;
    text-decoration: underline;
    background: rgba(0, 0, 0, 0.35);
    border-radius: 999px;
    padding: 4px 14px;
}

.legacy-access-scan__error {
    margin: 10px 0 0;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--etat-reservee-bg, #F7E5DF);
    color: var(--etat-reservee-fg, #7A2E1D);
    font-size: 0.82rem;
}

.legacy-access-scan__divider {
    position: relative;
    margin: 16px 0;
    text-align: center;
    color: var(--muted);
    font-size: 0.78rem;
}

.legacy-access-scan__divider::before,
.legacy-access-scan__divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: calc(50% - 90px);
    border-top: 1px solid rgba(22, 33, 31, 0.13);
}

.legacy-access-scan__divider::before { inset-inline-start: 0; }
.legacy-access-scan__divider::after { inset-inline-end: 0; }

/* Résultat de vérification — liste de faits (icône + libellé + valeur),
   même langage que .reconduction-item__fact / .detail de la maquette. */
.legacy-access-result {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin: 0;
    padding: 20px 0;
    border-top: 1px solid rgba(22, 33, 31, 0.13);
    border-bottom: 1px solid rgba(22, 33, 31, 0.13);
}

.legacy-access-result dt {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    color: #788785;
    font-size: 11px;
}

.legacy-access-result dt svg {
    flex: none;
    color: var(--thermal);
}

.legacy-access-result dd {
    margin: 4px 0 0;
    color: var(--ink);
    font-size: 14px;
    font-weight: 700;
}

@media (max-width: 560px) {
    .legacy-access-result {
        grid-template-columns: 1fr;
    }
}

/* Confirmation d'envoi — même anatomie que .success de la maquette. */
.legacy-access-success {
    padding: 8px 0 32px;
    text-align: center;
    animation: legacy-access-rise 0.55s ease both;
}

@keyframes legacy-access-rise {
    from { opacity: 0; transform: translateY(9px); }
    to { opacity: 1; transform: translateY(0); }
}

.legacy-access-success__icon {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    margin: 0 auto;
    border-radius: 50%;
    color: var(--thermal);
    background: #e2efe9;
}

.legacy-access-success h2 {
    margin-top: 20px;
    color: var(--deep-teal);
    font-size: 25px;
}

.legacy-access-success p {
    max-width: 380px;
    margin: 10px auto 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.8;
}

.legacy-access-success .btn {
    width: auto;
    min-width: 160px;
    margin: 24px auto 0;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
}

@media (max-width: 560px) {
    .legacy-access-dialog {
        border-radius: 24px;
    }

    .legacy-access-dialog__body {
        padding: 22px 16px 24px;
    }

    .legacy-access-dialog__heading {
        gap: 0;
    }

    .legacy-access-dialog__icon {
        display: none;
    }

    .legacy-access-form-grid {
        grid-template-columns: 1fr;
    }

    .legacy-access-field--full {
        grid-column: span 1;
    }

    .legacy-access-button-row {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .legacy-access-button-row .btn {
        width: 100%;
    }
}

.home-hero__copyright {
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.78rem;
    text-align: center;
    margin-top: 1.25rem;
}

.home-hero__verify-link {
    padding: 0;
    border: 0;
    background: transparent;
    color: rgba(255, 255, 255, 0.55);
    font-family: inherit;
    font-size: inherit;
    text-decoration: underline;
    cursor: pointer;
}

.home-hero__verify-link:hover {
    color: rgba(255, 255, 255, 0.85);
}

/* ── Panneau gauche (desktop) : bloc calligraphique décoratif ── */
.home-hero__decor {
    position: relative;
    z-index: 1;
    flex: 1;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    text-align: center;
    pointer-events: none;
}

@media (min-width: 768px) {
    .home-hero__decor {
        display: flex;
    }
}

.home-hero__decor-logo {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
    margin: 0 auto 2rem;
}

.home-hero__decor-title {
    font-family: 'Gulzar', serif;
    font-size: clamp(3rem, 6vw, 5.5rem);
    line-height: 1.2;
    margin: 0;
    color: rgba(255, 255, 255, 0.96);
    -webkit-text-stroke: 1.2px rgba(198, 134, 47, 0.85);
    text-shadow: 0 0 18px rgba(198, 134, 47, 0.35), 0 6px 40px rgba(0, 0, 0, 0.45);
}

.home-hero__decor-tagline {
    display: inline-block;
    font-family: 'Tajawal', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    color: rgba(214, 168, 84, 0.95);
    background: rgba(198, 134, 47, 0.08);
    border: 1px solid rgba(198, 134, 47, 0.35);
    border-radius: 3px;
    padding: 0.45rem 1.1rem;
    margin: 1.4rem 0 0;
    letter-spacing: 0.02em;
}

.home-hero__decor-sep {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1.4rem;
}

.home-hero__decor-sep span {
    display: block;
    width: 2.5rem;
    height: 1px;
    background: rgba(255, 255, 255, 0.25);
}

.home-hero__decor-sep span.dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.35);
}

.home-hero__decor-kicker {
    font-family: 'Tajawal', sans-serif;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.82rem;
    letter-spacing: 0.15em;
    margin: 0.9rem 0 0;
}

@media (prefers-reduced-motion: reduce) {
    .home-card__tab,
    .home-card__submit {
        transition: none;
    }
}
