/* ==========================================================================
   RestoPOS - Modern Hotel POS Styling (Bootstrap 5 Utility Companion)
   Inspired by Petpooja POS UI/UX
   ========================================================================== */

:root {
    --resto-primary: #3b82f6;
    --resto-primary-hover: #2563eb;
    --resto-dark: #0f172a;
    --resto-sidebar-bg: #0f172a;
    --resto-sidebar-hover: #1e293b;
    --resto-sidebar-active: #2563eb;
    --resto-sidebar-width: 230px;
    --resto-sidebar-collapsed-width: 72px;
    --resto-header-height: 64px;
    --resto-bg: #f8fafc;
    --resto-card-border: #e2e8f0;
    --resto-veg: #16a34a;
    --resto-nonveg: #dc2626;
    --resto-accent: #f97316;
}

body {
    background-color: var(--resto-bg);
    color: #1e293b;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Main Layout Structure */
.resto-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* Sidebar Styles */
.resto-sidebar {
    width: var(--resto-sidebar-width);
    background-color: var(--resto-sidebar-bg);
    color: #94a3b8;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    transition: width 0.25s ease, transform 0.25s ease;
    z-index: 1040;
    min-height: 100vh;
    border-right: 1px solid #1e293b;
}

.resto-sidebar.collapsed {
    width: var(--resto-sidebar-collapsed-width);
}

.resto-sidebar.collapsed .sidebar-text,
.resto-sidebar.collapsed .sidebar-badge,
.resto-sidebar.collapsed .sidebar-user-info {
    display: none !important;
}

.resto-sidebar.collapsed .sidebar-brand {
    justify-content: center;
    padding: 1rem 0;
}

.resto-sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 0.75rem 0;
}

.resto-sidebar.collapsed .nav-link i {
    margin-right: 0 !important;
    font-size: 1.25rem;
}

.sidebar-brand {
    padding: 1.25rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #ffffff;
    font-weight: 700;
    font-size: 1.15rem;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.resto-sidebar .nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.15rem;
    color: #94a3b8;
    font-weight: 500;
    font-size: 0.92rem;
    border-radius: 0.5rem;
    margin: 0.2rem 0.75rem;
    transition: all 0.15s ease;
    text-decoration: none;
}

.resto-sidebar .nav-link i {
    font-size: 1.15rem;
    margin-right: 0.85rem;
    flex-shrink: 0;
}

.resto-sidebar .nav-link:hover {
    color: #ffffff;
    background-color: var(--resto-sidebar-hover);
}

.resto-sidebar .nav-link.active {
    color: #ffffff;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

/* Sidebar User Profile Footer */
.sidebar-user {
    margin-top: auto;
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #334155;
    color: #38bdf8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

/* Main Content Wrapper */
.resto-main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background-color: var(--resto-bg);
}

/* Top Header Bar */
.resto-topbar {
    height: var(--resto-header-height);
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    position: sticky;
    top: 0;
    z-index: 1030;
}

/* Veg / Non-Veg Indicator Badges */
.badge-veg, .badge-nonveg {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid;
    background: #ffffff;
}
.badge-veg {
    border-color: var(--resto-veg);
}
.badge-veg::after {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--resto-veg);
}
.badge-nonveg {
    border-color: var(--resto-nonveg);
}
.badge-nonveg::after {
    content: '';
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 8px solid var(--resto-nonveg);
}

/* Dish Card in POS */
.dish-card {
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    user-select: none;
    display: flex;
    flex-direction: column;
    height: 100%;
}
.dish-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px -4px rgba(0, 0, 0, 0.08);
    border-color: #cbd5e1;
}
.dish-card:active {
    transform: scale(0.98);
}
.dish-image-wrapper {
    position: relative;
    width: 100%;
    padding-top: 60%;
    overflow: hidden;
    background-color: #f1f5f9;
}
.dish-image-wrapper img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.dish-diet-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 2;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}
.dish-code-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(15, 23, 42, 0.75);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    backdrop-filter: blur(2px);
}
.dish-body {
    padding: 0.75rem 0.85rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    justify-content: space-between;
}
.dish-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 0.35rem;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
    height: 2.25rem;
    transition: color 0.15s ease;
}
.dish-card:hover .dish-title {
    color: #2563eb;
}
.dish-price {
    font-size: 1.05rem;
    font-weight: 700;
    color: #16a34a;
}

/* POS Food Item Full Name Floating Tooltip */
.dish-pos-tooltip .tooltip-inner {
    background-color: #0f172a;
    color: #ffffff;
    font-size: 0.84rem;
    font-weight: 600;
    padding: 7px 12px;
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.35);
    max-width: 280px;
    line-height: 1.35;
    text-align: center;
    letter-spacing: 0.01em;
}
.dish-pos-tooltip .tooltip-arrow::before {
    border-top-color: #0f172a;
}
.dish-pos-tooltip.bs-tooltip-bottom .tooltip-arrow::before {
    border-bottom-color: #0f172a;
}

/* Category Sidebar / List */
.category-pill-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.65rem 0.9rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #475569;
    border: 1px solid transparent;
    background-color: transparent;
    text-align: left;
    transition: all 0.15s ease;
    margin-bottom: 0.35rem;
}
.category-pill-btn:hover {
    background-color: #f1f5f9;
    color: #0f172a;
}
.category-pill-btn.active {
    background-color: #2563eb;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}
.category-pill-btn.active .badge {
    background-color: rgba(255, 255, 255, 0.25) !important;
    color: #ffffff !important;
}

/* Cart Panel (Right Column) */
.cart-panel {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
}
.cart-items-container {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    padding: 0.5rem 0.65rem;
}
.cart-items-container::-webkit-scrollbar {
    width: 4px;
}
.cart-items-container::-webkit-scrollbar-track {
    background: transparent;
}
.cart-items-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
.cart-items-container::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}
.cart-item-row {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.4rem 0.6rem;
    margin-bottom: 0.35rem;
    transition: all 0.15s ease;
}
.cart-item-row:hover {
    border-color: #cbd5e1;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.cart-qty-btn {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    font-size: 0.85rem;
    font-weight: 700;
    padding: 0;
    line-height: 1;
    transition: all 0.15s ease;
}
.cart-qty-btn:hover {
    background: #e2e8f0;
}
.cart-qty-btn:active {
    transform: scale(0.92);
}

/* Order Type Toggle Buttons */
.order-type-btn {
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    border-radius: 6px;
    padding: 0.35rem 0.5rem;
    text-align: center;
    font-weight: 600;
    font-size: 0.78rem;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}
.order-type-btn:hover {
    border-color: #cbd5e1;
    background: #ffffff;
}
.order-type-btn.active {
    border-color: #ef4444;
    background: #ef4444;
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.25);
}

/* Payment Mode Buttons */
.pay-mode-btn {
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    border-radius: 6px;
    padding: 0.32rem 0.35rem;
    text-align: center;
    font-weight: 600;
    font-size: 0.74rem;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}
.pay-mode-btn:hover {
    border-color: #cbd5e1;
    background: #ffffff;
}
.pay-mode-btn.active {
    border-color: #10b981;
    background: #10b981;
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.25);
}

/* Thermal Receipt Styling (58mm and 80mm preview) */
.thermal-receipt-preview {
    background: #ffffff;
    color: #000000;
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    line-height: 1.35;
    margin: 0 auto;
    padding: 16px 14px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    border: 1px dashed #cbd5e1;
    border-radius: 4px;
}
.thermal-80mm {
    width: 320px;
}
.thermal-58mm {
    width: 240px;
    font-size: 11px;
}
.receipt-divider {
    border-top: 1px dashed #000000;
    margin: 8px 0;
}
.receipt-double-divider {
    border-top: 2px solid #000000;
    margin: 8px 0;
}
.receipt-table {
    width: 100%;
    border-collapse: collapse;
}
.receipt-table th, .receipt-table td {
    padding: 2px 0;
    font-size: inherit;
}

/* Print Only Styles */
@media print {
    body * {
        visibility: hidden !important;
    }
    .print-area, .print-area * {
        visibility: visible !important;
    }
    .print-area {
        position: absolute;
        left: 0;
        top: 0;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        box-shadow: none !important;
        border: none !important;
    }
    @page {
        margin: 0;
    }
}

/* Sidebar Backdrop Overlay */
.sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(2px);
    z-index: 1039;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}
.sidebar-backdrop.show {
    opacity: 1;
    visibility: visible;
}

/* Bill Option Select Box (Task 2) */
.bill-option-wrapper select {
    background-position: right 0.5rem center;
    padding-right: 1.75rem;
}
.bill-option-wrapper select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.2);
}

/* Diet Filter Buttons (Task 3: Top Icon, Bottom Wording) */
.diet-filter-btn {
    min-height: 44px;
    transition: all 0.15s ease;
}
.btn-check:checked + .btn-outline-secondary.diet-filter-btn {
    background-color: #475569 !important;
    border-color: #475569 !important;
    color: #ffffff !important;
    box-shadow: 0 2px 6px rgba(71, 85, 105, 0.35);
}
.btn-check:checked + .btn-outline-success.diet-filter-btn {
    background-color: #16a34a !important;
    border-color: #16a34a !important;
    color: #ffffff !important;
    box-shadow: 0 2px 6px rgba(22, 163, 74, 0.35);
}
.btn-check:checked + .btn-outline-danger.diet-filter-btn {
    background-color: #dc2626 !important;
    border-color: #dc2626 !important;
    color: #ffffff !important;
    box-shadow: 0 2px 6px rgba(220, 38, 38, 0.35);
}

/* Responsive adjustments */
@media (max-width: 991.98px) {
    .resto-sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        bottom: 0;
        z-index: 1045;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    }
    .resto-sidebar.show {
        left: 0;
    }
    .cart-panel {
        height: auto;
        position: static;
        border-left: none;
        border-top: 1px solid #e2e8f0;
    }
}

@media (max-width: 575.98px) {
    .resto-topbar {
        padding: 0 0.75rem;
    }
    .dish-title {
        font-size: 0.88rem;
    }
    .dish-price {
        font-size: 0.98rem;
    }
}

@media (max-width: 420px) {
    .resto-topbar {
        padding: 0 0.4rem;
    }
    .bill-option-wrapper select {
        min-width: 110px !important;
        font-size: 0.75rem !important;
        padding-left: 0.35rem !important;
    }
    .order-type-btn {
        font-size: 0.7rem !important;
        padding: 0.3rem 0.2rem !important;
    }
    .pay-mode-btn {
        font-size: 0.68rem !important;
        padding: 0.25rem 0.15rem !important;
    }
    .dish-body {
        padding: 0.5rem 0.6rem;
    }
    .dish-title {
        font-size: 0.82rem;
    }
    .dish-price {
        font-size: 0.92rem;
    }
}

/* ==========================================================================
   POS Full-Screen & Essae POS Monitor Responsive Mode
   ========================================================================== */
body.pos-fullscreen .resto-sidebar {
    position: fixed;
    left: -100%;
    top: 0;
    bottom: 0;
    z-index: 1045;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

body.pos-fullscreen .resto-sidebar.show {
    left: 0;
}

body.pos-fullscreen #sidebarCloseBtn {
    display: inline-flex !important;
}

body.pos-fullscreen .cart-qty-btn {
    width: 25px;
    height: 25px;
}

@media (min-width: 992px) {
    body.pos-fullscreen {
        height: 100vh;
        overflow: hidden;
    }
    body.pos-fullscreen .resto-wrapper {
        height: 100vh;
        min-height: 0;
    }
    body.pos-fullscreen .resto-main {
        height: 100vh;
        min-height: 0;
        overflow: hidden;
    }
    body.pos-fullscreen .resto-topbar {
        height: 52px;
        flex-shrink: 0;
        padding: 0 0.85rem;
    }
    body.pos-fullscreen main {
        flex: 1 1 0;
        min-height: 0;
        display: flex;
        flex-direction: column;
        padding: 0.5rem !important;
        overflow: hidden;
    }
    body.pos-fullscreen footer {
        flex-shrink: 0;
        padding-top: 0.3rem !important;
        padding-bottom: 0.3rem !important;
        font-size: 0.74rem;
    }
    body.pos-fullscreen .dish-image-wrapper {
        padding-top: 52%;
    }
    body.pos-fullscreen .dish-body {
        padding: 0.5rem 0.6rem;
    }
    body.pos-fullscreen .dish-title {
        font-size: 0.88rem;
        margin-bottom: 0.25rem;
    }
    body.pos-fullscreen .dish-price {
        font-size: 0.96rem;
    }
}

/* Essae 15" 4:3 (1024x768) & 15.6" (1280x800 / 1366x768) Compact Height Polish */
@media (min-width: 992px) and (max-height: 820px) {
    body.pos-fullscreen .resto-topbar {
        height: 48px;
    }
    body.pos-fullscreen .category-pill-btn {
        padding: 0.45rem 0.65rem;
        font-size: 0.82rem;
        margin-bottom: 0.25rem;
    }
    body.pos-fullscreen .diet-filter-btn {
        min-height: 38px;
    }
    body.pos-fullscreen .dish-image-wrapper {
        padding-top: 48%;
    }
    body.pos-fullscreen .dish-body {
        padding: 0.42rem 0.55rem;
    }
    body.pos-fullscreen .cart-item-row {
        padding: 0.32rem 0.5rem !important;
        margin-bottom: 0.25rem !important;
    }
}

/* ==========================================================================
   Virtual Number Pad for Touch POS Monitors (Task 1)
   ========================================================================== */
.numpad-key {
    min-height: 52px;
    border-radius: 8px;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    transition: transform 0.08s ease, background-color 0.08s ease, box-shadow 0.08s ease;
}
.numpad-key:active {
    transform: scale(0.95);
    background-color: #e2e8f0 !important;
}
.numpad-key.btn-success:active {
    background-color: #15803d !important;
}
.numpad-key.btn-outline-danger:active {
    background-color: #dc2626 !important;
    color: #fff !important;
}
.numpad-screen {
    background-color: #0f172a;
    border: 1px solid #334155;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4);
}
.numpad-chip-btn {
    min-height: 28px;
    font-size: 0.74rem;
    font-weight: 600;
    padding: 0.2rem 0.55rem;
    border-radius: 6px;
    touch-action: manipulation;
    transition: transform 0.08s ease;
}
.numpad-chip-btn:active {
    transform: scale(0.94);
}



