/**
 * CORN CITY POS - Responsive & Mobile Styles
 */

@media (max-width: 991.98px) {
    html, body {
        overflow-x: hidden;
        max-width: 100vw;
    }
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-wrapper {
        margin-left: 0;
    }

    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 1040;
        display: none;
    }

    .sidebar-overlay.show { display: block; }

    body:not(.pos-page) .pos-container {
        flex-direction: column;
        height: auto;
    }

    body:not(.pos-page) .pos-categories {
        width: 100%;
        max-width: none;
        min-width: 0;
        display: flex;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 6px;
        gap: 6px;
        white-space: nowrap;
    }

    body:not(.pos-page) .category-btn {
        display: inline-flex;
        width: auto;
        min-width: 90px;
        margin-bottom: 0;
        flex-shrink: 0;
    }

    body:not(.pos-page) .pos-cart {
        width: 100%;
        max-width: none;
        min-width: 0;
        max-height: none;
        min-height: 300px;
    }

    body:not(.pos-page) .pos-items-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        max-height: none;
    }

    .stat-card .stat-value { font-size: 1.4rem; }

    .kitchen-orders {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 575.98px) {
    body:not(.pos-page) .main-content { padding: 12px; }

    .login-card { padding: 25px; }

    body:not(.pos-page) .pos-items-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 8px;
    }

    body:not(.pos-page) .menu-item-card { padding: 8px; }
    body:not(.pos-page) .menu-item-card .item-img { width: 45px; height: 45px; font-size: 1.4rem; }
    body:not(.pos-page) .menu-item-card .item-name { font-size: 0.75rem; }

    body:not(.pos-page) .cart-item { padding: 8px 5px; }

    .content-card { padding: 15px; }

    .table-responsive { font-size: 0.85rem; }

    .topbar { padding: 0 12px; }
    .page-heading { font-size: 1.1rem; }
}

/* Touch-friendly targets (non-POS pages) */
@media (hover: none) and (pointer: coarse) {
    body:not(.pos-page) .menu-item-card { min-height: 100px; }
    body:not(.pos-page) .category-btn { min-height: 48px; padding: 14px; }
    body:not(.pos-page) .qty-control button { width: 36px; height: 36px; }
    body:not(.pos-page) .payment-btn { min-height: 48px; padding: 14px; }
    .nav-item { min-height: 48px; }
    body:not(.pos-page) .btn { min-height: 44px; }
}

/* Legacy pos-fullscreen class (alias) */
.pos-fullscreen .sidebar,
.pos-fullscreen .topbar,
.pos-fullscreen .cashier-topbar { display: none; }
.pos-fullscreen .main-wrapper { margin-left: 0; }
.pos-fullscreen .main-content { padding: 0; }
body.pos-fullscreen.pos-page .main-content,
body.pos-browser-fullscreen.pos-page .main-content {
    height: 100dvh;
    max-height: 100dvh;
}

/* Landscape tablet — non-POS fallback */
@media (min-width: 768px) and (max-width: 991.98px) and (orientation: landscape) {
    body:not(.pos-page) .pos-container {
        flex-direction: row;
        flex-wrap: wrap;
        height: calc(100dvh - var(--topbar-height) - 80px);
    }
}
