/* ==========================================================================
   IDT POS — mobile enhancements
   1) Bottom navigation bar (phones only)
   2) Add Sale / POS product table -> readable cards on phones
   Loaded after the other idtpos-*.css. Everything here is gated to small
   screens, so tablet and desktop are untouched.
   ========================================================================== */

/* Hidden by default; shown only on phones */
.idt-bottom-nav {
    display: none;
}

@media (max-width: 767px) {

    /* ----------------------------------------------------------------------
       0) HEADER USER MENU — the long name wrapped and clipped off the right
       edge. Hide the name on phones and show a compact user icon instead, so
       the menu fits and the dropdown still works.
       ---------------------------------------------------------------------- */
    .main-header .navbar-custom-menu .user-menu > .dropdown-toggle > span {
        display: none !important;
    }
    .main-header .navbar-custom-menu .user-menu > .dropdown-toggle {
        padding: 0 12px !important;
        display: flex !important;
        align-items: center;
        height: 50px;
    }
    /* If a profile photo exists, keep it compact; the blade adds a stand-in icon otherwise */
    .main-header .navbar-custom-menu .user-menu > .dropdown-toggle > img.user-image {
        margin: 0 !important;
        width: 30px !important;
        height: 30px !important;
    }
    .main-header .navbar-custom-menu .user-menu > .dropdown-toggle > .idt-user-fallback {
        font-size: 24px;
        color: #ffffff;
        line-height: 1;
    }

    /* ----------------------------------------------------------------------
       1) BOTTOM NAV
       ---------------------------------------------------------------------- */
    .idt-bottom-nav {
        display: flex;
        justify-content: space-around;
        align-items: flex-end;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        height: 58px;
        background: #ffffff;
        border-top: 1px solid #e5e7eb;
        box-shadow: 0 -2px 12px rgba(15, 23, 42, 0.08);
        z-index: 1030;
        padding: 4px 4px 6px;
    }
    .idt-bn-item {
        flex: 1 1 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        color: #64748b;
        font-size: 10px;
        line-height: 1.1;
        text-decoration: none;
        padding: 6px 2px;
    }
    .idt-bn-item i {
        font-size: 17px;
    }
    .idt-bn-item span {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }
    .idt-bn-item:active,
    .idt-bn-item:focus,
    .idt-bn-item:hover {
        color: #2563eb;
        text-decoration: none;
    }

    /* Centre Home raised into a circle */
    .idt-bn-home {
        position: relative;
    }
    .idt-bn-home .idt-bn-home-circle {
        width: 48px;
        height: 48px;
        border-radius: 50%;
        background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
        color: #ffffff;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-top: -26px;
        box-shadow: 0 4px 14px rgba(37, 99, 235, 0.45);
        border: 3px solid #ffffff;
    }
    .idt-bn-home .idt-bn-home-circle i {
        font-size: 20px;
    }
    .idt-bn-home span:not(.idt-bn-home-circle) {
        margin-top: 2px;
        color: #2563eb;
        font-weight: 600;
    }

    /* Keep page content clear of the fixed bar */
    .content-wrapper {
        padding-bottom: 70px !important;
    }

    /* ----------------------------------------------------------------------
       2) ADD SALE product entry table -> horizontal-scroll table
       Match the Purchase page: on phones keep the real table (same as the
       desktop view) and let it scroll sideways inside its .table-responsive
       wrapper instead of stacking into cards. This keeps the quantity stepper
       and every other input full size. The wrapper (added in pos_form) owns
       the sideways scroll; the table just needs a min-width so the columns
       overflow rather than being crushed to fit the screen.
       ---------------------------------------------------------------------- */
    table#pos_table {
        min-width: 760px;
    }
    table#pos_table > tbody > tr.product_row > td {
        vertical-align: middle;
    }
    /* Quantity stepper: force the whole group and its number box to a solid
       width. Bootstrap gives the inner input width:1% (it fills its column on
       desktop), but in the narrow scrolled table on phones that collapses the
       value out of view — so pin an explicit width here. */
    table#pos_table > tbody > tr.product_row > td .input-group.input-number {
        width: 160px !important;
        min-width: 160px !important;
    }
    table#pos_table > tbody > tr.product_row > td .input-group.input-number .form-control {
        width: 70px !important;
        min-width: 70px !important;
        text-align: center;
    }

    /* ----------------------------------------------------------------------
       3) Combo-product form table -> stacked labelled cards
       (unchanged; this narrow table still reads better stacked on phones)
       ---------------------------------------------------------------------- */
    table.product_table thead {
        display: none;
    }
    table.product_table,
    table.product_table > tbody {
        display: block;
        width: 100%;
    }
    table.product_table > tbody > tr.product_row {
        display: block;
        border: 1px solid #e5e7eb;
        border-radius: 10px;
        padding: 8px 10px;
        margin-bottom: 10px;
        background: #ffffff;
        box-shadow: 0 1px 4px rgba(15, 23, 42, 0.05);
        overflow: hidden;
    }
    table.product_table > tbody > tr.product_row > td {
        display: flex !important;
        align-items: center;
        justify-content: flex-start;
        gap: 10px;
        width: 100% !important;
        max-width: 100%;
        box-sizing: border-box;
        border: 0 !important;
        border-bottom: 1px dashed #eef2f7 !important;
        padding: 6px 0 !important;
        text-align: left;
    }
    table.product_table > tbody > tr.product_row > td:last-child {
        border-bottom: 0 !important;
        justify-content: flex-end;
    }
    table.product_table > tbody > tr.product_row > td[data-label]::before {
        content: attr(data-label);
        font-size: 11px;
        font-weight: 600;
        color: #64748b;
        text-align: left;
        flex: 0 0 30%;
    }
    table.product_table > tbody > tr.product_row > td[data-label] .form-control,
    table.product_table > tbody > tr.product_row > td[data-label] input {
        flex: 1 1 auto;
        width: auto !important;
        max-width: none;
        box-sizing: border-box;
    }
}
