/*
 * VORIK Universal Search Sheet
 */

:root {
    --vorik-search-viewport-height: 100dvh;
}

html.vorik-search-sheet-open,
body.vorik-search-sheet-open {
    overflow: hidden;
    overscroll-behavior: none;
}

.vorik-search-sheet {
    position: fixed;
    z-index: 9999;
    inset: 0;
    width: 100%;
    height: var(
        --vorik-search-viewport-height,
        100dvh
    );
    pointer-events: none;
}

.vorik-search-sheet[hidden] {
    display: none !important;
}

.vorik-search-sheet__backdrop {
    position: absolute;
    inset: 0;
    background:
        rgba(15, 23, 42, 0.42);
    opacity: 0;
    transition:
        opacity 260ms ease;
}

.vorik-search-sheet__panel {
    position: absolute;
    inset: auto 0 0;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: var(
        --vorik-search-viewport-height,
        100dvh
    );
    max-height: var(
        --vorik-search-viewport-height,
        100dvh
    );
    overflow: hidden;
    color: #0f172a;
    background:
        linear-gradient(
            180deg,
            #ffffff 0%,
            #f8fafc 100%
        );
    border-radius: 24px 24px 0 0;
    box-shadow:
        0 -22px 70px
        rgba(15, 23, 42, 0.22);
    transform:
        translate3d(0, 102%, 0);
    transition:
        transform 330ms
        cubic-bezier(
            0.22,
            1,
            0.36,
            1
        );
    will-change: transform;
}

.vorik-search-sheet.is-visible {
    pointer-events: auto;
}

.vorik-search-sheet.is-visible
.vorik-search-sheet__backdrop {
    opacity: 1;
}

.vorik-search-sheet.is-visible
.vorik-search-sheet__panel {
    transform:
        translate3d(0, 0, 0);
}

.vorik-search-sheet__header {
    display: grid;
    grid-template-columns:
        44px minmax(0, 1fr) 44px;
    align-items: center;
    flex: 0 0 auto;
    min-height: 70px;
    padding:
        max(10px, env(safe-area-inset-top))
        16px
        8px;
    background:
        rgba(255, 255, 255, 0.96);
    border-bottom:
        1px solid rgba(148, 163, 184, 0.15);
}

.vorik-search-sheet__back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    color: #0f172a;
    background: #f1f5f9;
    border: 0;
    border-radius: 14px;
    cursor: pointer;
    transition:
        background 160ms ease,
        transform 160ms ease;
}

.vorik-search-sheet__back:active {
    transform: scale(0.94);
}

.vorik-search-sheet__back svg {
    width: 23px;
    height: 23px;
}

.vorik-search-sheet__title {
    margin: 0;
    padding: 0 12px;
    overflow: hidden;
    font-size: 18px;
    font-weight: 800;
    line-height: 1.2;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vorik-search-sheet__header-space {
    width: 42px;
    height: 42px;
}

.vorik-search-sheet__search-area {
    flex: 0 0 auto;
    padding: 14px 16px 12px;
    background: #ffffff;
}

.vorik-search-sheet__search-box {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 58px;
    padding: 0 50px 0 48px;
    background: #f1f5f9;
    border:
        1px solid rgba(
            148,
            163,
            184,
            0.22
        );
    border-radius: 18px;
    box-shadow:
        inset 0 1px 0
        rgba(255, 255, 255, 0.8);
    transition:
        border-color 160ms ease,
        box-shadow 160ms ease,
        background 160ms ease;
}

.vorik-search-sheet__search-box:focus-within {
    background: #ffffff;
    border-color:
        rgba(37, 99, 235, 0.5);
    box-shadow:
        0 0 0 4px
        rgba(37, 99, 235, 0.09),
        0 10px 28px
        rgba(15, 23, 42, 0.08);
}

.vorik-search-sheet__search-icon {
    position: absolute;
    left: 17px;
    display: inline-flex;
    width: 22px;
    height: 22px;
    color: #64748b;
}

.vorik-search-sheet__search-icon svg {
    width: 100%;
    height: 100%;
}

.vorik-search-sheet__input {
    width: 100%;
    min-width: 0;
    height: 56px;
    padding: 0;
    color: #0f172a;
    background: transparent;
    border: 0;
    outline: 0;
    font: inherit;
    font-size: 16px;
    font-weight: 650;
    line-height: 1;
    appearance: none;
}

.vorik-search-sheet__input::placeholder {
    color: #94a3b8;
    font-weight: 550;
}

.vorik-search-sheet__input::-webkit-search-cancel-button {
    display: none;
}

.vorik-search-sheet__clear {
    position: absolute;
    right: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    color: #64748b;
    background: #e2e8f0;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
}

.vorik-search-sheet__clear svg {
    width: 18px;
    height: 18px;
}

.vorik-search-sheet__body {
    flex: 1 1 auto;
    min-height: 0;
    padding:
        2px 16px
        max(
            18px,
            env(safe-area-inset-bottom)
        );
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.vorik-search-sheet__current {
    display: grid;
    grid-template-columns:
        46px minmax(0, 1fr) 24px;
    gap: 13px;
    align-items: center;
    width: 100%;
    min-height: 76px;
    padding: 10px 4px;
    color: #0f172a;
    text-align: left;
    background: transparent;
    border: 0;
    cursor: pointer;
}

.vorik-search-sheet__current-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    color: #2563eb;
    background:
        rgba(37, 99, 235, 0.1);
    border-radius: 16px;
}

.vorik-search-sheet__current-icon svg {
    width: 24px;
    height: 24px;
}

.vorik-search-sheet__current-copy {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 3px;
}

.vorik-search-sheet__current-copy strong {
    font-size: 15px;
    font-weight: 800;
}

.vorik-search-sheet__current-copy small {
    overflow: hidden;
    color: #64748b;
    font-size: 12px;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vorik-search-sheet__current-arrow {
    color: #94a3b8;
    font-size: 28px;
    font-weight: 300;
    line-height: 1;
}

.vorik-search-sheet__separator {
    height: 1px;
    margin: 2px 0 12px;
    background:
        rgba(148, 163, 184, 0.2);
}

.vorik-search-sheet__results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 36px;
    padding: 0 4px;
    color: #475569;
    font-size: 12px;
    font-weight: 850;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.vorik-search-sheet__loader {
    width: 18px;
    height: 18px;
    border:
        2px solid rgba(
            37,
            99,
            235,
            0.18
        );
    border-top-color: #2563eb;
    border-radius: 50%;
    animation:
        vorik-search-sheet-spin
        700ms linear infinite;
}

.vorik-search-sheet__status {
    padding: 20px 8px;
    color: #64748b;
    font-size: 14px;
    line-height: 1.5;
    text-align: center;
}

.vorik-search-sheet__status[hidden] {
    display: none;
}

.vorik-search-sheet__status.is-error {
    color: #b91c1c;
}

.vorik-search-sheet__results {
    display: flex;
    flex-direction: column;
}

.vorik-search-sheet__result {
    display: grid;
    grid-template-columns:
        46px minmax(0, 1fr) 24px;
    gap: 13px;
    align-items: center;
    width: 100%;
    min-height: 74px;
    padding: 10px 4px;
    color: #0f172a;
    text-align: left;
    background: transparent;
    border: 0;
    border-bottom:
        1px solid rgba(
            148,
            163,
            184,
            0.15
        );
    cursor: pointer;
    transition:
        background 150ms ease,
        transform 150ms ease;
}

.vorik-search-sheet__result:hover,
.vorik-search-sheet__result.is-active {
    background:
        rgba(37, 99, 235, 0.055);
}

.vorik-search-sheet__result:active {
    transform: scale(0.992);
}

.vorik-search-sheet__result-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    color: #334155;
    background: #f1f5f9;
    border-radius: 15px;
}

.vorik-search-sheet__result-icon svg {
    width: 23px;
    height: 23px;
}

.vorik-search-sheet__result-content {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 4px;
}

.vorik-search-sheet__result-content strong {
    overflow: hidden;
    font-size: 15px;
    font-weight: 780;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vorik-search-sheet__result-content small {
    display: block;
    overflow: hidden;
    color: #64748b;
    font-size: 12px;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vorik-search-sheet__result-arrow {
    color: #94a3b8;
    font-size: 27px;
    font-weight: 300;
    line-height: 1;
}

@keyframes vorik-search-sheet-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (min-width: 769px) {
    .vorik-search-sheet {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 28px;
    }

    .vorik-search-sheet__panel {
        position: relative;
        inset: auto;
        width: min(680px, 100%);
        height: min(
            760px,
            calc(100vh - 56px)
        );
        max-height:
            calc(100vh - 56px);
        border-radius: 26px;
        transform:
            translate3d(0, 40px, 0)
            scale(0.98);
        opacity: 0;
        transition:
            transform 280ms
            cubic-bezier(
                0.22,
                1,
                0.36,
                1
            ),
            opacity 220ms ease;
    }

    .vorik-search-sheet.is-visible
    .vorik-search-sheet__panel {
        transform:
            translate3d(0, 0, 0)
            scale(1);
        opacity: 1;
    }
}

@media (max-width: 768px) {
    .vorik-search-sheet__panel {
        border-radius: 0;
    }

    .vorik-search-sheet__backdrop {
        display: none;
    }

    .vorik-search-sheet__header {
        min-height: 66px;
        padding-left: 14px;
        padding-right: 14px;
    }

    .vorik-search-sheet__search-area {
        padding:
            10px 14px
            12px;
    }

    .vorik-search-sheet__body {
        padding-left: 14px;
        padding-right: 14px;
    }
}

@media (
    prefers-reduced-motion: reduce
) {
    .vorik-search-sheet__panel,
    .vorik-search-sheet__backdrop {
        transition-duration: 1ms;
    }
}


/* ==========================================================
   Recherches récentes
   ========================================================== */

.vorik-search-sheet__recent {
    display: block;
}

.vorik-search-sheet__recent[hidden] {
    display: none;
}

.vorik-search-sheet__section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 38px;
    padding: 0 4px;
    color: #475569;
    font-size: 12px;
    font-weight: 850;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.vorik-search-sheet__recent-clear {
    padding: 7px 4px;
    color: #2563eb;
    background: transparent;
    border: 0;
    font: inherit;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: none;
    cursor: pointer;
}

.vorik-search-sheet__recent-list {
    display: flex;
    flex-direction: column;
}

.vorik-search-sheet__recent-item {
    display: grid;
    grid-template-columns:
        44px minmax(0, 1fr) 24px;
    gap: 13px;
    align-items: center;
    width: 100%;
    min-height: 68px;
    padding: 8px 4px;
    color: #0f172a;
    text-align: left;
    background: transparent;
    border: 0;
    border-bottom:
        1px solid rgba(148, 163, 184, 0.13);
    cursor: pointer;
    transition:
        background 150ms ease,
        transform 150ms ease;
}

.vorik-search-sheet__recent-item:hover {
    background:
        rgba(37, 99, 235, 0.05);
}

.vorik-search-sheet__recent-item:active {
    transform: scale(0.992);
}

.vorik-search-sheet__recent-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    color: #64748b;
    background: #f1f5f9;
    border-radius: 14px;
}

.vorik-search-sheet__recent-icon svg {
    width: 22px;
    height: 22px;
}

.vorik-search-sheet__recent-copy {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 3px;
}

.vorik-search-sheet__recent-copy strong {
    overflow: hidden;
    font-size: 14px;
    font-weight: 780;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vorik-search-sheet__recent-copy small {
    overflow: hidden;
    color: #64748b;
    font-size: 12px;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vorik-search-sheet__recent-arrow {
    color: #94a3b8;
    font-size: 26px;
    font-weight: 300;
    line-height: 1;
}

/* ==========================================================
   GEO-013B — Mobile search focus mode
   ========================================================== */

@media (max-width: 768px) {
    /*
     * Dès que l'utilisateur commence à saisir,
     * on libère l'écran pour les autosuggestions.
     */
    .vorik-search-sheet.is-searching
    .vorik-search-sheet__current {
        display: none;
    }

    .vorik-search-sheet.is-searching
    .vorik-search-sheet__recent {
        display: none !important;
    }

    /*
     * Le premier séparateur placé après "Ma position actuelle"
     * devient inutile pendant la recherche.
     */
    .vorik-search-sheet.is-searching
    .vorik-search-sheet__current
    + .vorik-search-sheet__separator {
        display: none;
    }

    .vorik-search-sheet.is-searching
    .vorik-search-sheet__body {
        padding-top: 0;
    }

    .vorik-search-sheet.is-searching
    .vorik-search-sheet__results-header {
        min-height: 32px;
        padding-top: 2px;
    }
}

/* GEO-013B END */


/* ==========================================================
   GEO-013C — Compact current location button
   ========================================================== */

@media (max-width: 768px) {

    /*
     * Espace pour le bouton GPS lorsque l'input est vide.
     * Pendant la saisie le GPS disparaît et le bouton X
     * reprend naturellement cette zone.
     */
    .vorik-search-sheet:not(.is-searching)
    .vorik-search-sheet__search-box {
        padding-right: 58px;
    }

    .vorik-search-sheet__search-box
    .vorik-search-sheet__current {
        position: absolute;
        z-index: 2;
        top: 50%;
        right: 9px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        min-width: 40px;
        height: 40px;
        min-height: 40px;
        padding: 0;
        margin: 0;
        color: #2563eb;
        background: rgba(37, 99, 235, 0.10);
        border: 0;
        border-radius: 13px;
        transform: translateY(-50%);
    }

    .vorik-search-sheet__search-box
    .vorik-search-sheet__current-icon {
        width: 40px;
        height: 40px;
        background: transparent;
        border-radius: inherit;
    }

    .vorik-search-sheet__search-box
    .vorik-search-sheet__current-icon svg {
        width: 22px;
        height: 22px;
    }

    /*
     * Le texte reste dans le DOM pour conserver la sémantique
     * du bouton, mais n'occupe plus d'espace visuel.
     */
    .vorik-search-sheet__search-box
    .vorik-search-sheet__current-copy,
    .vorik-search-sheet__search-box
    .vorik-search-sheet__current-arrow {
        display: none;
    }

    /*
     * L'ancien séparateur de la ligne "Ma position actuelle"
     * n'a désormais plus de raison d'être.
     */
    .vorik-search-sheet__body
    > .vorik-search-sheet__separator:first-of-type {
        display: none;
    }

    /*
     * GEO-013B masque déjà le GPS pendant une recherche.
     * On le confirme ici car le bouton se trouve maintenant
     * dans la search-box.
     */
    .vorik-search-sheet.is-searching
    .vorik-search-sheet__current {
        display: none;
    }
}

/* GEO-013C END */

