/*
 * Small-screen overrides for the whole app (admin, customer portal), loaded last in app.blade.php.
 *
 * Every rule lives inside a max-width query on Velzon's own breakpoints (1199.98 / 991.98 /
 * 767.98 / 575.98), so nothing here can apply on a desktop-width screen (≥1200px) — the desktop
 * UI stays exactly as it was. Page-specific fixes belong in that page's scoped <style>.
 */

/* ── Tablet and below ─────────────────────────────────────────────────────────────────────── */
@media (max-width: 1199.98px) {
    /* Topbar search: custom.min.css fixes the input at 564px, which (plus the 200px sidebar and
       the icons) pushes the header past the screen edge below ~1050px. Let it shrink instead. */
    #page-topbar .navbar-header > .d-flex:has(> .app-search) {
        flex: 1 1 auto;
        min-width: 0;
        margin-right: 12px;
    }
    #page-topbar .app-search {
        width: 100%;
        max-width: 564px;
    }
    #page-topbar .app-search .form-control {
        width: 100%;
    }
    /* Results panel is 130% of the input; keep it on screen (sidebar 200px + gutters). */
    #page-topbar .searchbarsuggestion {
        max-width: calc(100vw - 240px);
    }
}

/* ── Below desktop: shared list toolbars ──────────────────────────────────────────────────── */
@media (max-width: 991.98px) {
    /* Status tabs and column/bulk-action rows above every list (custom.min.css) don't wrap.
       Scoped to .page-content: the header's notification panel reuses these classes with
       50%/50% tabs that must stay on one line. */
    .page-content .payment-top-filters,
    .page-content .payment-columns-filter {
        flex-wrap: wrap;
    }
}

/* ── Phones ───────────────────────────────────────────────────────────────────────────────── */
@media (max-width: 767.98px) {
    /* Nothing inside a page may be wider than the screen just because of an image. */
    .page-content img {
        max-width: 100%;
    }
}

@media (max-width: 575.98px) {
    /* Velzon already makes topbar dropdowns full-width below 600px; custom.min.css's
       min-width: 430px on the notification panel defeated it on every phone. */
    #page-topbar .notification-dropdown {
        min-width: 0;
    }

    /* Customer bell: opened by v-if (no Popper), anchored right:0 to the bell — pin it to the
       topbar's edges instead so the panel spans the screen. */
    #page-topbar .cn-bell {
        position: static;
    }
    #page-topbar .cn-bell__menu {
        left: 12px;
        right: 12px;
        width: auto;
        max-width: none;
    }

    /* List status tabs: two per row instead of one squeezed row. */
    .page-content .payment-top-filters > li {
        flex: 1 1 calc(50% - 10px);
    }
}

/* Phone sidebar is an off-canvas drawer. A desktop collapse (data-sidebar-size=sm) must not
   shrink it to the 70px icon rail or hide its labels. Loaded after the theme so it wins. */
@media (max-width: 767.98px) {
    :is([data-layout=vertical], [data-layout=semibox])[data-sidebar-size=sm] .navbar-menu {
        position: fixed;
        width: min(260px, 100vw) !important;
        padding-top: 0;
    }
    :is([data-layout=vertical], [data-layout=semibox])[data-sidebar-size=sm] .navbar-menu .navbar-nav .nav-link span {
        display: inline;
    }
}
