:root {
    /* KMSPOS SaaS Color Palette - Blue & White */
    --primary: #0D47A1;
    /* Thick Blue for primary actions */
    --primary-dark: #0A3680;
    --primary-light: #42A5F5;
    /* Light Blue for accents */
    --secondary: #1565C0;
    /* Secondary Blue */
    --bg-dark: #F0F4F8;
    /* Light gray background */
    --bg-card: #FFFFFF;
    /* White cards */
    --text-light: #1A1A2E;
    /* Dark text on light background */
    --text-muted: #6B7280;

    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;

    --font-main: 'Inter', system-ui, sans-serif;

    --radius: 12px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 25px rgba(13, 71, 161, 0.15);
    --border: #E5E7EB;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-dark);
    color: var(--text-light);
    height: 100vh;
    overflow-y: auto;
    /* Allow scrolling */
    -webkit-overflow-scrolling: touch;
    /* Smooth scroll on iOS */
}

/* Utilities */
.hidden {
    display: none !important;
}

.btn {
    display: inline-block;
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.2s;
    text-decoration: none;
    text-align: center;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-secondary {
    background: #1565C0;
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-warning {
    background: var(--warning);
    color: #000;
}

.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade {
    animation: fadeIn 0.3s ease-out forwards;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    body {
        height: auto;
        min-height: 100vh;
    }

    .table-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 15px !important;
        padding-bottom: 80px;
    }

    .header {
        position: sticky;
        top: 0;
        z-index: 100;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    }

    /* Waiter Order Page Mobile */
    .main-layout {
        flex-direction: column !important;
        /* height: auto !important;  <-- REMOVED to fix scroll */
    }

    .categories {
        width: 100% !important;
        height: auto !important;
        display: flex !important;
        overflow-x: auto !important;
        border-right: none !important;
        border-bottom: 1px solid #333 !important;
    }

    .cat-item {
        padding: 10px 15px !important;
        flex: 0 0 80px !important;
    }

    /* .products-area handled by order.php */

    .product-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .cart-panel {
        width: 100% !important;
        border-left: none !important;
        border-top: 2px solid var(--primary) !important;
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        /* max-height removed to allow 80vh from order.php */
        /* z-index removed to allow order.php to control it */
    }

    .qty-controls button {
        width: 40px !important;
        height: 40px !important;
        font-size: 1.2rem;
    }

    .btn {
        padding: 12px 20px;
    }
}

/* Language Selector */
.lang-selector {
    display: flex;
    gap: 5px;
    align-items: center;
}

.lang-btn {
    padding: 5px 10px;
    border: 1px solid #444;
    background: transparent;
    color: var(--text-muted);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
}

.lang-btn:hover {
    background: var(--primary);
}

.lang-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Modification Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: var(--bg-card);
    padding: 30px;
    border-radius: var(--radius);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.mod-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #333;
}

.mod-item:last-child {
    border-bottom: none;
}

.qty-stepper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.stepper-btn {
    background: var(--bg-dark);
    border: 1px solid #555;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
}

.stepper-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
}

.void-btn {
    color: var(--danger);
    background: none;
    border: 1px solid var(--danger);
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.8rem;
}

.void-btn.active {
    background: var(--danger);
    color: white;
}

.mod-total {
    margin-top: 20px;
    text-align: right;
    font-size: 1.2rem;
    font-weight: bold;
}

.deleted-item {
    text-decoration: line-through;
    opacity: 0.5;
}

@media print {
    body * {
        visibility: hidden;
    }

    .bill-preview,
    .bill-preview * {
        visibility: visible;
    }

    .bill-preview {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        margin: 0;
        padding: 10px;
        background: white;
        color: black;
        overflow: visible;
    }

    .bill-actions,
    .btn,
    button,
    input,
    select,
    .sidebar,
    .kds-header {
        display: none !important;
    }

    .bill-item,
    .bill-total {
        display: flex !important;
        /* Force flex back */
    }

    /* Hide scrollbars */
    ::-webkit-scrollbar {
        display: none;
    }
}

/* Product Dietary Dots */
.product-dot {
    display: inline-block;
    width: 14px;
    height: 14px;
    min-width: 14px;
    min-height: 14px;
    border-radius: 50%;
    vertical-align: middle;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.dot-veg {
    background: #27ae60 !important;
}

.dot-egg {
    background: #f1c40f !important;
}

.dot-nonveg {
    background: #e74c3c !important;
}