/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #8b5a2b; /* Coffee Color */
    --primary-dark: #6b4420;
    --secondary: #1e293b;
    --bg-light: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #334155;
    --text-muted: #64748b;
    --danger: #ef4444;
    --success: #10b981;
    --border: #e2e8f0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-light);
    color: var(--text-main);
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Glassmorphism Sidebar */
.sidebar {
    width: 80px;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 0;
    gap: 30px;
    z-index: 10;
}

.sidebar .logo {
    width: 50px;
    height: 50px;
    background: var(--primary);
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-weight: bold;
    font-size: 20px;
}

.sidebar .nav-item {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-muted);
}

.sidebar .nav-item:hover, .sidebar .nav-item.active {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 90, 43, 0.3);
}

/* Main Content Area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow-y: auto;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.topbar h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--secondary);
}

.status-indicator {
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-indicator.online {
    background: #dcfce7;
    color: #166534;
}

.status-indicator.offline {
    background: #fee2e2;
    color: #991b1b;
}

/* Category Filter */
.categories {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    overflow-x: auto;
    padding-bottom: 5px;
}

.cat-btn {
    padding: 8px 20px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: white;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
}

.cat-btn.active, .cat-btn:hover {
    background: var(--secondary);
    color: white;
    border-color: var(--secondary);
}

/* Products Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
}

.product-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.05);
    border-color: var(--primary);
}

.product-img {
    width: 100%;
    height: 120px;
    border-radius: 12px;
    object-fit: cover;
    margin-bottom: 12px;
}

.product-info h3 {
    font-size: 15px;
    margin-bottom: 4px;
    color: var(--text-main);
}

.product-info p {
    color: var(--primary);
    font-weight: 700;
    font-size: 16px;
}

/* Tables Grid */
.tables-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 20px;
}

.table-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.table-card:hover {
    transform: translateY(-5px);
}

.table-card h3 {
    font-size: 18px;
    margin-bottom: 10px;
    color: var(--secondary);
}

.table-card .status-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.table-card.available { border-color: #10b981; }
.table-card.available .status-badge { background: #dcfce7; color: #166534; }

.table-card.occupied { border-color: #ef4444; }
.table-card.occupied .status-badge { background: #fee2e2; color: #991b1b; }

.table-card.reserved { border-color: #f59e0b; }
.table-card.reserved .status-badge { background: #fef3c7; color: #92400e; }

/* Cart / Bill Section */
.cart-section {
    width: 350px;
    background: var(--card-bg);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 20px;
    box-shadow: -5px 0 15px rgba(0,0,0,0.02);
}

.cart-header {
    margin-bottom: 20px;
}

.cart-header h2 {
    font-size: 20px;
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-item-info h4 {
    font-size: 14px;
    margin-bottom: 4px;
}

.cart-item-info p {
    color: var(--primary);
    font-weight: 600;
    font-size: 13px;
}

.qty-control {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-light);
    border-radius: 8px;
    padding: 4px 8px;
}

.qty-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: var(--text-main);
    width: 24px;
    height: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 4px;
}

.qty-btn:hover {
    background: #e2e8f0;
}

.cart-summary {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px dashed var(--border);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 14px;
    color: var(--text-muted);
}

.summary-row.total {
    font-size: 18px;
    font-weight: 700;
    color: var(--secondary);
    margin-top: 10px;
}

.pay-btn {
    width: 100%;
    padding: 16px;
    border-radius: 12px;
    background: var(--primary);
    color: white;
    border: none;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 15px;
    transition: background 0.3s;
}

.pay-btn:hover {
    background: var(--primary-dark);
}

.pay-btn:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
}

.print-btn {
    width: 100%;
    padding: 12px;
    border-radius: 12px;
    background: var(--secondary);
    color: white;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
    display: none;
}

/* Modal CSS */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    justify-content: center;
    align-items: center;
    z-index: 100;
}
.modal.active {
    display: flex;
}
.modal-content {
    background: white;
    padding: 30px;
    border-radius: 16px;
    width: 90%;
    max-width: 400px;
    text-align: center;
}
.modal-content select {
    width: 100%;
    padding: 10px;
    margin: 15px 0;
    border-radius: 8px;
    border: 1px solid var(--border);
}

/* --- RECEIPT PRINTING STYLES (Hide everything except receipt when printing) --- */
.receipt-wrapper {
    display: none; /* Hidden on screen */
}

@media print {
    body * {
        visibility: hidden;
    }
    .receipt-wrapper, .receipt-wrapper * {
        visibility: visible;
    }
    .receipt-wrapper {
        display: block;
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        max-width: 80mm; /* Standard thermal printer width */
        font-family: monospace;
        font-size: 12px;
        color: black;
    }
    
    .receipt-header {
        text-align: center;
        margin-bottom: 10px;
        border-bottom: 1px dashed black;
        padding-bottom: 10px;
    }
    .receipt-header h2 { font-size: 16px; margin: 0; }
    
    .receipt-items {
        width: 100%;
        margin-bottom: 10px;
    }
    .receipt-items th, .receipt-items td {
        text-align: left;
        padding: 4px 0;
    }
    .receipt-items .right { text-align: right; }
    
    .receipt-total {
        border-top: 1px dashed black;
        padding-top: 10px;
        margin-top: 5px;
    }
    .receipt-total .row {
        display: flex;
        justify-content: space-between;
        font-weight: bold;
    }
    .receipt-footer {
        text-align: center;
        margin-top: 15px;
        font-size: 10px;
    }
}

/* Responsive Mobile */
@media (max-width: 768px) {
    body { flex-direction: column; }
    .sidebar { width: 100%; height: 60px; flex-direction: row; justify-content: center; padding: 0 10px; }
    .cart-section { width: 100%; height: 50vh; border-left: none; border-top: 1px solid var(--border); }
    .products-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}
