/* =====================================================================
 * v6.7 — Correções de interface e homepage
 *
 *  1) Chat no telemóvel: input a 16px (evita zoom iOS) e formulário
 *     sempre visível acima do teclado;
 *  2) Botão «Perto de mim» no canto superior direito da searchbar,
 *     amarelo no tema escuro;
 *  3) Grelha de horários dos profissionais (modal) compacta e moderna;
 *  4) Topbar do painel (admin + empresa) limpa no telemóvel;
 *  5) Carrosséis por categoria na página inicial.
 *
 * Carregado SEMPRE depois das folhas anteriores.
 * ===================================================================== */

/* ---------------------------------------------------------------------
 * 1) Chat VIX — telemóvel sem zoom e botão enviar sempre visível
 * ------------------------------------------------------------------ */
.vix__input {
    font-size: 16px;
}

.vix__form {
    flex: 0 0 auto;
    position: relative;
    z-index: 3;
    background: var(--vix-bg, #fff);
}

.vix__quick {
    flex: 0 0 auto;
    background: var(--vix-bg, #fff);
}

.vix__foot {
    flex: 0 0 auto;
}

.vix__panel {
    overscroll-behavior: contain;
}

@media (max-width: 480px) {
    .vix__panel {
        left: 8px;
        right: 8px;
        width: auto;
        bottom: 86px;
        max-height: calc(100dvh - 110px);
        max-height: calc(100svh - 110px);
    }

    .vix__panel.is-keyboard {
        max-height: none;
    }

    .vix__input {
        font-size: 16px;
        transform: translateZ(0);
    }
}

/* ---------------------------------------------------------------------
 * 2) Searchbar — «Perto de mim» no canto superior direito
 * ------------------------------------------------------------------ */
.searchbar {
    position: relative;
}

.searchbar:has(.searchbar__near),
.searchbar.searchbar--near {
    padding-top: 42px;
}

.searchbar__near {
    position: absolute;
    top: 10px;
    right: 12px;
    margin-top: 0;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 999px;
    border: 1px solid rgba(109, 40, 217, .35);
    background: rgba(109, 40, 217, .08);
    color: inherit;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
    white-space: nowrap;
}

.searchbar__near:hover {
    background: rgba(109, 40, 217, .16);
}

.searchbar__near.is-busy {
    opacity: .6;
    pointer-events: none;
}

.searchbar__field .searchbar__near {
    /* o botão sai do campo «Onde?» e fica no canto da barra */
    display: none;
}

.searchbar > .searchbar__near {
    display: inline-flex;
}

[data-theme="dark"] .searchbar__near,
html[data-theme="dark"] .searchbar__near,
body.theme-dark .searchbar__near {
    background: #facc15;
    border-color: #eab308;
    color: #1f2937;
    box-shadow: 0 6px 16px rgba(250, 204, 21, .28);
}

[data-theme="dark"] .searchbar__near:hover,
html[data-theme="dark"] .searchbar__near:hover {
    background: #fde047;
}

@media (max-width: 1024px) {
    .searchbar:has(.searchbar__near),
    .searchbar.searchbar--near {
        padding-top: 44px;
    }

    .searchbar__near {
        top: 8px;
        right: 10px;
    }
}

/* ---------------------------------------------------------------------
 * 3) Horários do profissional — cartões compactos no modal
 * ------------------------------------------------------------------ */
.modal__form--wide {
    width: min(720px, calc(100vw - 24px));
    max-height: min(92vh, 860px);
}

.modal__body--wide {
    grid-template-columns: 1fr 1fr;
}

.schedule-grid.schedule-grid--v64,
.schedule-grid {
    --sched-day: auto;
    --sched-closed: auto;
    --sched-col: 1fr;

    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    margin-top: 8px;
    padding: 4px 2px 6px;
    border: 0;
    border-radius: 0;
    background: transparent;
    overflow: visible;
    max-height: min(48vh, 380px);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.schedule-grid__head {
    display: none;
}

.schedule-grid__row,
.schedule-grid.schedule-grid--v64 .schedule-grid__row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
        "day closed"
        "hours hours"
        "break break";
    align-items: center;
    gap: 8px 10px;
    padding: 12px 14px;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 16px;
    background: color-mix(in srgb, var(--surface, #fff) 88%, var(--surface-2, #f8fafc));
    box-shadow: 0 8px 18px -16px rgba(15, 23, 42, .45);
}

.schedule-grid__row + .schedule-grid__row,
.schedule-grid__head + .schedule-grid__row {
    border-top: 1px solid var(--border, #e5e7eb);
}

.schedule-grid__row:nth-child(even) {
    background: color-mix(in srgb, var(--surface, #fff) 92%, var(--brand-50, #f5f3ff));
}

.schedule-grid__row:hover {
    border-color: color-mix(in srgb, var(--brand-500, #7c3aed) 35%, var(--border, #e5e7eb));
    background: color-mix(in srgb, var(--brand-50, #f5f3ff) 55%, var(--surface, #fff));
}

.schedule-grid__day {
    grid-area: day;
    justify-self: start;
    min-height: 32px;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: .78rem;
    box-shadow: none;
}

.sched-closed {
    grid-area: closed;
    justify-self: end;
    padding: 5px 8px;
    font-size: .72rem;
}

.sched-hours {
    grid-area: hours;
}

.sched-break {
    grid-area: break;
}

.sched-hours,
.sched-break {
    display: grid;
    grid-template-columns: minmax(72px, auto) minmax(0, 1fr) 12px minmax(0, 1fr);
    align-items: center;
    gap: 6px;
    width: 100%;
    min-width: 0;
}

.sched-hours::before,
.sched-break::before {
    content: attr(data-label);
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--muted, #64748b);
    white-space: nowrap;
}

.sched-hours .input,
.sched-break .input {
    width: 100%;
    max-width: none;
    min-width: 0;
    height: 36px;
    padding: 4px 8px;
    font-size: 14px;
}

.sched-sep,
.sched-hours > span,
.sched-break > span {
    text-align: center;
}

@media (max-width: 860px) {
    .schedule-grid.schedule-grid--v64 .schedule-grid__row,
    .schedule-grid__row {
        grid-template-columns: 1fr;
        grid-template-areas:
            "day"
            "closed"
            "hours"
            "break";
        padding: 12px;
    }

    .schedule-grid__day,
    .sched-closed {
        justify-self: stretch;
        justify-content: center;
        grid-column: auto;
    }

    .sched-hours,
    .sched-break {
        grid-column: auto;
    }
}

@media (max-width: 480px) {
    .sched-hours,
    .sched-break {
        grid-template-columns: 1fr 12px 1fr;
    }

    .sched-hours::before,
    .sched-break::before {
        grid-column: 1 / -1;
        min-width: 0;
    }
}

[data-theme="dark"] .schedule-grid {
    background: transparent;
    border-color: transparent;
}

[data-theme="dark"] .schedule-grid__row {
    background: rgba(15, 23, 42, .55);
    border-color: rgba(148, 163, 184, .22);
}

/* ---------------------------------------------------------------------
 * 4) Topbar dos painéis — telemóvel
 * ------------------------------------------------------------------ */
@media (max-width: 860px) {
    .app-topbar {
        gap: 8px;
        padding: 10px 12px;
        flex-wrap: nowrap;
    }

    .app-topbar__title,
    .app-topbar .search,
    .app-topbar #global-search,
    .app-topbar .search--global {
        display: none !important;
    }

    .app-topbar__user {
        display: none;
    }

    .app-topbar__actions {
        margin-left: auto;
        gap: 6px;
        min-width: 0;
    }

    .app-topbar__actions .btn--ghost {
        padding-inline: 10px;
    }
}

/* ---------------------------------------------------------------------
 * 5) Carrosséis por categoria (página inicial)
 * ------------------------------------------------------------------ */
.cat-rail {
    display: grid;
    gap: 10px;
}

.cat-rail__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.cat-rail__title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 800;
}

.cat-rail__all {
    font-size: .82rem;
    font-weight: 650;
    color: var(--muted, #64748b);
    text-decoration: none;
    white-space: nowrap;
}

.cat-rail__all:hover {
    color: var(--brand-600, #6d28d9);
    text-decoration: underline;
}

.cat-rail .new-scroller__track,
.cat-rail__track {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding: 4px 2px 12px;
    scrollbar-width: none;
}

.cat-rail__track::-webkit-scrollbar {
    display: none;
}

.cat-rail .card-company,
.cat-rail .card-company--mini {
    flex: 0 0 220px;
    width: 220px;
    scroll-snap-align: start;
    margin: 0;
}

.cat-rail .card-company__media {
    height: 110px;
}

.cat-rail .card-company__desc {
    display: none;
}
