/*
 * E Security Technology - My Bar Online POS
 * Shared responsive layer for phones, tablets and desktop browsers.
 * The file only changes presentation; existing PHP requests and POS actions remain intact.
 */

html {
    width: 100%;
    min-height: 100%;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    width: 100%;
    min-width: 0;
    margin: 0;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

img,
video,
iframe,
canvas,
svg {
    max-width: 100%;
}

img,
video {
    height: auto;
}

.ui-page,
[data-role="page"] {
    width: 100%;
    min-width: 0;
    min-height: 100vh;
    overflow-x: hidden;
}

.ui-content,
[data-role="content"] {
    width: 100%;
    min-width: 0;
    padding-left: 10px !important;
    padding-right: 10px !important;
}

.ui-content > *,
[data-role="content"] > *,
form,
fieldset,
.ui-controlgroup,
.ui-controlgroup-controls {
    min-width: 0;
    max-width: 100%;
}

/* Navigation: three or four menu options share the available width. */
.ui-navbar {
    width: 100%;
    max-width: 100%;
    margin: 0 !important;
    overflow: hidden;
}

.ui-navbar ul {
    display: flex !important;
    flex-wrap: nowrap !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

.ui-navbar ul > li {
    float: none !important;
    flex: 1 1 0% !important;
    width: auto !important;
    min-width: 0 !important;
    margin: 0 !important;
}

.ui-navbar ul > li > a,
.ui-navbar .ui-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 100% !important;
    min-width: 0 !important;
    min-height: 44px !important;
    margin: 0 !important;
    padding: 7px 3px !important;
    font-size: 12px !important;
    line-height: 1.15 !important;
    text-align: center !important;
    white-space: normal !important;
    overflow-wrap: anywhere;
}

.ui-navbar .ui-btn-inner,
.ui-navbar .ui-btn-text {
    min-width: 0;
    white-space: normal !important;
    overflow-wrap: anywhere;
}

/* Form controls stay inside their cards and remain easy to tap. */
input,
select,
textarea,
button {
    max-width: 100%;
}

.ui-input-text,
.ui-select,
.ui-select .ui-btn,
.ui-input-text input,
.ui-select select,
textarea {
    max-width: 100% !important;
    min-width: 0;
}

.ui-input-text input,
.ui-select select,
textarea {
    box-sizing: border-box !important;
}

/* Keep wide/legacy tables inside the page instead of expanding the viewport. */
table {
    max-width: 100%;
}

#faturat {
    max-width: 100%;
}

#faturat table,
#details table,
.table-details table {
    max-width: 100%;
}

/* POS order screen: responsive category and product grids. */
#main,
#main .content-primary,
#kateg,
#faturaList {
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

#main #categoryTabs {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 7px !important;
}

#main #categoryTabs .category-tab {
    min-width: 0;
}

#main #categoryTabs .category-tab a {
    min-height: 64px;
    padding: 8px 4px;
    font-size: clamp(11px, 3.4vw, 15px);
    line-height: 1.2;
    overflow-wrap: anywhere;
}

#main .category-products .kats {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 7px !important;
}

#main .category-products .kats li a.artikull {
    min-width: 0;
    min-height: 70px;
    padding: 8px 4px !important;
    font-size: clamp(11px, 3.2vw, 14px) !important;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

#main .category-products .kats .ui-li-count {
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
}

#main #backCategories {
    width: 100% !important;
    min-height: 48px;
    height: auto !important;
    margin-top: 12px !important;
    padding: 13px 8px !important;
    font-size: 15px !important;
    line-height: 1.25 !important;
}

#main #sasia {
    left: 50%;
    right: auto;
    width: calc(100% - 20px);
    max-width: 620px;
    transform: translateX(-50%);
    font-size: clamp(24px, 7vw, 40px);
}

#main .content-secondary {
    float: none;
    width: 100%;
    max-width: 100%;
}

#main #fatura {
    width: 100%;
    max-width: 100%;
}

#main #fatura li.artikuj > a {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-right: 10px !important;
    white-space: normal !important;
    overflow-wrap: anywhere;
}

#main #fatura li.artikuj .ui-li-count {
    position: static !important;
    float: none !important;
    flex: 0 0 auto;
    max-width: 48%;
    margin-left: auto !important;
    white-space: nowrap;
}

/* POS total / table selector and checkout controls. */
#fund {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
    width: 100%;
    padding: 8px !important;
}

#fund .ui-block-a,
#fund .ui-block-b {
    float: none !important;
    width: auto !important;
    min-width: 0;
    margin: 0 !important;
}

#fund select,
#fund input {
    width: 100% !important;
    min-width: 0;
    margin: 0 !important;
    font-size: 16px !important;
}

/* Checkout actions: fixed two-button horizontal row on every screen. */
#fund + .checkout-actions {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
    justify-content: stretch !important;
    gap: 8px !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0px !important;
    padding: 0px 8px 8px !important;
    box-sizing: border-box !important;
    direction: ltr !important;
    overflow: visible !important;
}

#fund + .checkout-actions > a.checkout-action {
    display: flex !important;
    flex: 1 1 0 !important;
    flex-basis: 0 !important;
    flex-grow: 1 !important;
    flex-shrink: 1 !important;
    float: none !important;
    clear: none !important;
    position: static !important;
    width: 50% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: 60px !important;
    min-height: 60px !important;
    max-height: 60px !important;
    margin: 10px !important;
    padding: 8px 10px !important;
    box-sizing: border-box !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    text-decoration: none !important;
    text-transform: uppercase;
    font-family: Arial, Helvetica, sans-serif !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    text-shadow: none !important;
    border-radius: 20px !important;
}

#fund + .checkout-actions > #banak {
    color: #222 !important;
    border: 2px solid #e6c53d !important;
    background: linear-gradient(#fff18b, #ffdc48) !important;
}

#fund + .checkout-actions > #banak:active {
    background: linear-gradient(#f4d64e, #e9bf29) !important;
}

#fund + .checkout-actions > #kasa {
    color: #fff !important;
    border: 2px solid #111 !important;
    background: linear-gradient(#444, #222) !important;
}

#fund + .checkout-actions > #kasa:active {
    background: linear-gradient(#222, #111) !important;
}

/* Table selector page. */
#faturat a.table-round {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: clamp(52px, 16vw, 66px) !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    aspect-ratio: 1 / 1;
    margin: 0 !important;
    padding: 0 !important;
    font-size: clamp(13px, 4vw, 17px) !important;
}

/* Invoice detail panels loaded through AJAX. */
#details,
#faturaDetajePanel,
.table-details {
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

#faturaDetajePanel .fd-products {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 420px) {
    .ui-content,
    [data-role="content"] {
        padding-left: 8px !important;
        padding-right: 8px !important;
    }

    .ui-navbar ul > li > a,
    .ui-navbar .ui-btn {
        min-height: 43px !important;
        padding: 6px 2px !important;
        font-size: 11px !important;
    }

    .ui-navbar .ui-icon {
        display: none !important;
    }

    #main #categoryTabs {
        gap: 5px !important;
    }

    #main #categoryTabs .category-tab a {
        min-height: 58px;
        padding: 6px 3px;
    }

    #main .category-products .kats {
        gap: 5px !important;
    }

    #main .category-products .kats li a.artikull {
        min-height: 64px;
        padding: 7px 3px !important;
    }

    #main #fatura li.artikuj > a {
        gap: 5px;
        font-size: 13px !important;
    }

    #main #fatura li.artikuj .ui-li-count {
        max-width: 46%;
        font-size: 11px !important;
    }

    #fund {
        gap: 5px;
        padding: 6px !important;
    }

    #fund + .checkout-actions {
        gap: 5px !important;
    }

    #fund + .checkout-actions > a.checkout-action {
        height: 56px !important;
        min-height: 56px !important;
        max-height: 56px !important;
        padding: 6px 4px !important;
        font-size: 12px !important;
    }

    .filter-grid {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    .filter-field.full {
        grid-column: auto !important;
    }

    .invoice-top {
        flex-wrap: wrap;
    }

    .invoice-amount {
        font-size: 16px;
    }
}

@media (max-width: 340px) {
    #main #categoryTabs .category-tab a {
        min-height: 54px;
        font-size: 11px;
    }

    #main .category-products .kats li a.artikull {
        min-height: 60px;
        font-size: 11px !important;
    }

    /* Keep the 56px checkout sizing and shared horizontal button row. */
    #fund + .checkout-actions > a.checkout-action {
        height: 56px !important;
        min-height: 56px !important;
        max-height: 56px !important;
        padding: 6px 4px !important;
        font-size: 12px !important;
    }

    #fund + .checkout-actions {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
    }

    .brand-header h2 {
        overflow-wrap: anywhere;
    }

    .login-key {
        width: 100% !important;
        max-width: 100% !important;
    }
}

/* Tablet: use the extra width without making POS buttons excessively large. */
@media (min-width: 600px) {
    #main #categoryTabs {
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
        gap: 10px !important;
    }

    #main .category-products .kats {
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
        gap: 10px !important;
    }

    #main #categoryTabs .category-tab a {
        min-height: 72px;
        font-size: 15px;
    }

    #main .category-products .kats li a.artikull {
        min-height: 78px;
        font-size: 14px !important;
    }
}

/* Large tablets and desktops. */
@media (min-width: 1024px) {
    #main #categoryTabs {
        grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    }

    #main .category-products .kats {
        grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    }

    #fund,
    #fund + .ui-navbar {
        max-width: 1200px;
        margin-left: auto;
        margin-right: auto;
    }
}

/* Landscape phones: retain comfortable touch sizes without horizontal overflow. */
@media (max-width: 900px) and (orientation: landscape) {
    #main #categoryTabs .category-tab a {
        min-height: 54px;
    }

    #main .category-products .kats li a.artikull {
        min-height: 60px;
    }
}
