/* ==================== CSS RESET & BASE STYLES ==================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-red: #ed4446;
    --primary-green: #24c55e;
    --primary-orange: #f59e0b;
    --primary-blue: #3b82f6;
    --bg-light: #f8fafc;
    --bg-white: #ffffff;
    --text-dark: #1e293b;
    --text-gray: #64748b;
    --text-light: #94a3b8;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius: 8px;
    --radius-lg: 12px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
}

/* ==================== LOADING OVERLAY ==================== */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
}

.loading-spinner {
    text-align: center;
    padding: 2rem;
}

.loading-spinner i {
    font-size: 3rem;
    color: var(--primary-red);
    margin-bottom: 1rem;
}

.loading-spinner p {
    color: var(--text-gray);
    font-size: 1.1rem;
}

/* ==================== HEADER ==================== */

.app-header {
    background: #ffffffe8;
    color: var(--primary-red);
    padding: 0.4rem 0;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-content h1 {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-tabs {
    display: flex;
    gap: 0.5rem;
}

.tab-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.tab-btn.active {
    background: var(--primary-red);
    color: white;
    box-shadow: var(--shadow-md);
}

/* ==================== MAIN LAYOUT ==================== */

.app-main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ==================== CUSTOMER LAYOUT ==================== */

.customer-layout {
    display: grid;
    grid-template-columns: 2.3fr 1fr;
    gap: 2rem;
    min-height: 70vh;
}
/* Thêm class này để bảo vệ khung Menu không bị nở rộng */
.menu-section {
    min-width: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

@media (max-width: 768px) {
    .customer-layout {
        grid-template-columns: 1fr;
    }
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.8rem;
    flex-wrap: wrap;
}

.section-header h2 {
    color: var(--text-dark);
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filters {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.search-input {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.9rem;
    min-width: 300px;
    transition: border-color 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.filter-select {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: white;
    font-size: 0.9rem;
    cursor: pointer;
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary-blue);
}

/* ==================== MENU GRID ==================== */

.menu-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.7rem;
    margin-bottom: 2rem;
    align-items: start;
}

.menu-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.menu-card-header {
    display: flex;
    justify-content: flex-start;
    align-items: start;
}

.menu-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.4rem; 
}

.menu-status {
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.menu-status.active {
    background: rgba(36, 197, 94, 0.1);
    color: var(--primary-green);
}

.menu-status.inactive {
    background: rgba(237, 68, 70, 0.1);
    color: var(--primary-red);
}

.menu-description {
    color: var(--text-gray);
    font-size: 0.7rem; 
    line-height: 1.4;
}

.menu-category {
    color: var(--primary-blue);
    font-weight: 500;
    font-size: 0.75rem; 
    margin-bottom: 0.75rem; 
}

.price-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.price-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.1rem 0.4rem 0.1rem 0.4rem;
    background: var(--bg-light);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

.size {
    font-weight: 500;
    color: var(--text-dark);
    font-size: 0.7rem;
}

.price {
    font-weight: 600;
    color: var(--primary-red);
    font-size: 0.95rem;
}

.add-to-cart-btn {
    background: var(--primary-red);
    color: white;
    border: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.add-to-cart-btn:hover {
    background: #e06666;
    transform: scale(1.1);
}

/* ==================== ORDER SECTION ==================== */

.order-section {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.cart-panel, .tables-panel {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.cart-panel h3, .tables-panel h3 {
    color: var(--text-dark);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.empty-cart {
    text-align: center;
    color: var(--text-light);
    padding: 2rem;
    font-style: italic;
}

.cart-items {
    margin-bottom: 1.5rem;
}

.cart-item {
    display: flex;
    align-items: center;
    padding: 0.2rem 0;
    border-bottom: 1px solid var(--border-color);
}

.cart-item-info {
    flex: 1;
}

.cart-item-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cart-item-total {
    font-weight: 600;
    color: var(--primary-red);
    min-width: 80px;
    text-align: right;
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-item-info h4 {
    font-size: 0.9rem;
    font-weight: 600;
}

.cart-item-info p {
    font-size: 0.65rem;
    color: var(--text-gray);
}

.cart-item-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cart-item-controls button {
    width: 25px;
    height: 25px;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
}

.cart-item-controls button:hover {
    background: var(--bg-light);
}

.remove-btn {
    background: var(--primary-red) !important;
    color: white !important;
    border-color: var(--primary-red) !important;
}

.quantity {
    min-width: 20px;
    text-align: center;
    font-weight: 500;
}

.cart-summary {
    border-top: 2px solid var(--border-color);
    padding-top: 0.4rem;
}

.cart-total {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 1rem;
    text-align: right;
}

.checkout-btn {
    background: var(--primary-green);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin: 0 auto;
}

.checkout-btn:hover {
    background: #059669;
}

/* ==================== AVAILABLE TABLES ==================== */

.available-tables-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
}

.table-option {
    background: var(--bg-light);
    padding: 1rem;
    border-radius: var(--radius);
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.table-option:hover {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--primary-red);
}

.table-option h4 {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.table-option p {
    font-size: 0.85rem;
    color: var(--text-gray);
}

/* ==================== MANAGEMENT LAYOUT ==================== */

.management-layout {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 2rem;
    min-height: 70vh;
}

@media (max-width: 768px) {
    .management-layout {
        grid-template-columns: 1fr;
    }
    
    .management-sidebar {
        order: 2;
    }
}

.management-sidebar {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    height: fit-content;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav li {
    margin-bottom: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-gray);
    text-decoration: none;
    border-radius: var(--radius);
    transition: all 0.2s ease;
    font-weight: 500;
}

.nav-link:hover {
    background: var(--bg-light);
    color: var(--text-dark);
}

.nav-link.active {
    background: var(--primary-red);
    color: white;
}

.management-content {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.content-section {
    display: none;
}

.content-section.active {
    display: block;
}

.management-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.management-header h2 {
    color: var(--text-dark);
    font-size: 1.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ==================== BUTTONS ==================== */

.btn-primary {
    background: var(--primary-blue);
    color: white;
    border: none;
    padding: 0.75rem;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary:hover {
    background: #2563eb;
}

.btn-secondary {
    background: var(--text-light);
    color: white;
    border: none;
    padding: 0.75rem;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-secondary:hover {
    background: #64748b;
}

.btn-edit, .btn-delete {
    background: none;
    border: none;
    padding: 0.5rem;
    font-size: 1rem;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.btn-edit {
    color: var(--primary-orange);
}

.btn-delete {
    color: var(--primary-red);
}

.btn-edit:hover, .btn-delete:hover {
    background: rgba(0,0,0,0.1);
}

/* ==================== DATA TABLE ==================== */

.table-container {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.data-table th {
    background: var(--bg-light);
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-dark);
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    padding: 0.3rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.data-table tr:hover {
    background: var(--bg-light);
}

.status {
    background: rgba(245, 158, 11, 0.1);
    color: var(--primary-orange);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status.active {
    background: rgba(36, 197, 94, 0.1);
    color: var(--primary-green);
}

.status.inactive {
    background: rgba(237, 68, 70, 0.1);
    color: var(--primary-red);
}

/* ==================== TABLE MANAGEMENT ==================== */

.tables-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.table-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--border-color);
    transition: all 0.3s ease;
}

.table-card.available {
    border-left-color: var(--primary-green);
    background: rgba(36, 197, 94, 0.02);
}

.table-card.occupied {
    border-left-color: var(--primary-red);
    background: rgba(237, 68, 70, 0.02);
}

.table-card.reserved {
    border-left-color: var(--primary-orange);
    background: rgba(245, 158, 11, 0.02);
}

.table-card.maintenance {
    border-left-color: var(--text-light);
    background: rgba(148, 163, 184, 0.02);
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.table-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
}

.table-status {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    background: var(--bg-light);
    color: var(--text-gray);
}

.table-info p {
    margin-bottom: 0.5rem;
    color: var(--text-gray);
    font-size: 0.9rem;
}

.table-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

/* ==================== PAGINATION ==================== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2rem;
    flex-wrap: wrap; /* Thêm dòng này để tự động rớt dòng nếu màn hình quá nhỏ */
    align-items: center; /* Thêm dòng này để căn giữa chữ và nút */
}

.pagination button {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    background: white;
    color: var(--text-gray);
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    min-width: 36px; /* Đảm bảo các nút vuông vức đều nhau */
}

.pagination button:hover {
    background: var(--bg-light);
    border-color: var(--primary-blue);
    color: var(--primary-blue);
}

.pagination button.active {
    background: var(--primary-blue);
    color: white;
    border-color: var(--primary-blue);
}

/* Thêm class mới cho dấu ba chấm */
.pagination-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    color: var(--text-gray);
    font-weight: bold;
    letter-spacing: 2px;
}

/* ==================== MODALS ==================== */
/* ==================== LAYOUT CHIA CỘT POPUP CHỌN BÀN (TỐI ƯU 12 CỘT) ==================== */
#availableTablesModalContainer {
    display: flex;
    gap: 10px; /* Giảm gap để lấy thêm không gian ngang */
    align-items: flex-start;
}

.area-vong {
    flex: 2.2; /* Tăng nhẹ tỉ lệ cho Võng để đủ chỗ 12 cột */
    margin-bottom: 0 !important;
}

.area-ban {
    flex: 0.8; /* Thu hẹp nhẹ phần Bàn */
    margin-bottom: 0 !important;
}

/* QUAN TRỌNG: Quay lại 12 cột cho Võng */
.area-vong .table-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr); 
    gap: 3px; /* Gap cực nhỏ để ép 12 ô vào hàng ngang */
}

/* Khu vực Bàn: giữ 4 cột */
.area-ban .table-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
}

/* Thu nhỏ thẻ bàn/võng tối đa */
.table-item {
    aspect-ratio: 1/1; 
    border-radius: 4px;
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center;
    cursor: pointer; 
    padding: 1px;
    min-height: 45px; /* Giảm thêm chiều cao để ép vào 1 màn hình */
    border: 1px solid transparent;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

/* Thu nhỏ font chữ và icon để không bị vỡ khung khi ô quá nhỏ */
.table-icon { font-size: 0.7rem; margin-bottom: 1px; }
.table-name { font-weight: 700; font-size: 0.55rem; }
.table-status-text { font-size: 0.45rem; }

.area-title { 
    font-size: 0.8rem; 
    font-weight: bold;
    padding: 2px 0;
    margin-bottom: 5px;
    border-bottom: 1px solid var(--border-color);
}

/* Ép Modal rộng tối đa và cao sát màn hình */
#tableSelectionModal .modal-content {
    max-width: 98% !important;
    width: 98% !important;
    max-height: 98vh !important;
}

#tableSelectionModal .modal-body {
    overflow: hidden !important; 
    padding: 5px 10px !important;
}

@media (max-width: 1024px) {
    /* Với màn hình nhỏ hơn, nếu 12 cột quá chật thì tự giảm xuống 6 */
    .area-vong .table-grid { grid-template-columns: repeat(6, 1fr); }
}

.table-item.available { background: #e0f2fe; color: #0369a1; border-color: #bae6fd; }
.table-item.available:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--primary-blue); }
.table-item.occupied { background: #fee2e2; color: #991b1b; border-color: #fecaca; cursor: not-allowed; }

/* Thu nhỏ Icon và Chữ */
.table-icon { font-size: 1.1rem; margin-bottom: 0px; }
.table-name { font-weight: 700; font-size: 0.75rem; }
.table-status-text { font-size: 0.6rem; }

.area-title { 
    font-size: 0.9rem; 
    padding: 5px 10px; 
    margin-bottom: 10px; 
}

/* Responsive cho màn hình máy tính bảng và điện thoại */
@media (max-width: 1024px) {
    .area-vong .table-grid { grid-template-columns: repeat(6, 1fr); }
}
@media (max-width: 600px) {
    .area-vong .table-grid { grid-template-columns: repeat(4, 1fr); }
    .area-ban .table-grid { grid-template-columns: repeat(2, 1fr); }
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.show {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: white;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 460px !important;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.modal.show .modal-content {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background: white;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-light);
    cursor: pointer;
    padding: 0.25rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    background: var(--bg-light);
    color: var(--text-dark);
}

.modal-body {
    padding: 1.5rem;
}

/* ==================== FORMS ==================== */

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-dark);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.9rem;
    transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

/* ==================== PRICE INPUTS ==================== */

.prices-container {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1rem;
    background: var(--bg-light);
}

.price-input-group {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    align-items: center;
}

.price-input-group button {
    background: var(--primary-red);
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ==================== DASHBOARD ==================== */

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-white);
    padding: 1rem;
    border-radius: var(--radius-lg);
    text-align: center;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.stat-card h3 {
    color: var(--text-gray);
    margin-bottom: 0.1rem;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-red);
    margin: 0;
}
/* Hiệu ứng vẽ đường biểu đồ (Draw line animation) */
.path-animate {
  stroke-dasharray: 2000;
  stroke-dashoffset: 2000;
  animation: drawLine 2s ease-in-out forwards;
}

@keyframes drawLine {
  to {
    stroke-dashoffset: 0;
  }
}

/* Hiệu ứng trồi lên của các điểm chấm (Point animation) */
.point-animate {
  opacity: 0;
  animation: fadeInPoint 0.5s ease-in forwards;
}

@keyframes fadeInPoint {
  to {
    opacity: 1;
  }
}

/* ==================== REPORTS & SETTINGS ==================== */

.reports-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.report-card {
    background: var(--bg-white);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    text-align: center;
}

.report-card h3 {
    margin-bottom: 1rem;
    color: var(--text-dark);
}

.report-card p {
    color: var(--text-gray);
    margin-bottom: 1.5rem;
}

.settings-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.setting-group {
    background: var(--bg-light);
    padding: 2rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.setting-group h3 {
    margin-bottom: 1.5rem;
    color: var(--text-dark);
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.settings-form button {
    width: auto;
    padding: 0.75rem 1.5rem;
    margin: 0 auto;
    display: block;
}

/* ==================== NOTIFICATIONS ==================== */

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    color: white;
    font-weight: 500;
    z-index: 3000;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
    max-width: 300px;
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

.notification.success {
    background: var(--primary-green);
}

.notification.error {
    background: var(--primary-red);
}

.notification.info {
    background: var(--primary-blue);
}

/* ==================== FILTERS BAR ==================== */

.filters-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    align-items: center;
    flex-wrap: wrap;
}

/* ==================== RESPONSIVE DESIGN ==================== */

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .section-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filters {
        width: 100%;
    }
    
    .search-input {
        min-width: auto;
        width: 100%;
    }
    
    .menu-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .management-sidebar {
        position: fixed;
        top: 0;
        left: -250px;
        height: 100vh;
        z-index: 1500;
        transition: left 0.3s ease;
    }
    
    .tables-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
    
    .price-input-group {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .modal-content {
        width: 95%;
        margin: 1rem;
    }

    #menuPickerContainer .menu-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 480px) {
    .app-main {
        padding: 1rem 0.5rem;
    }
    
    .management-content {
        padding: 1rem;
    }
    
    .dashboard-stats {
        grid-template-columns: 1fr;
    }

    #menuPickerContainer .menu-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }
    
    #menuPickerContainer .menu-card {
        padding: 0.75rem !important;
    }
    
    #menuPickerContainer .menu-card h4 {
        font-size: 0.8rem !important;
    }
}

/* ==================== ANIMATIONS ==================== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.menu-card,
.table-card,
.stat-card {
    animation: fadeIn 0.6s ease forwards;
}

/* ==================== UTILITIES ==================== */

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.table-option.selected {
    background: rgba(237, 68, 70, 0.1);
    border-color: var(--primary-red);
    color: var(--primary-red);
}

.menu-card-image {
    width: 100%;
    height: 90px;
    overflow: hidden;
    border-radius: var(--radius) var(--radius) 0 0;
    background: var(--bg-light);
    position: relative; 
}

.menu-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

.menu-status-overlay {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.5rem;
    font-weight: 500;
    z-index: 10;
}

.menu-status-overlay.active {
    background: rgba(36, 197, 94, 0.9);
    color: white;
}

.menu-status-overlay.inactive {
    background: rgba(237, 68, 70, 0.9);
    color: white;
}

.menu-card {
    background: #fffbf8;
    border-radius: var(--radius-lg);
    padding: 0.4rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    cursor: pointer;
    overflow: hidden; 
    display: flex;
    flex-direction: column; 
    height: 100%;
}

.menu-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.menu-card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.price-options {
    margin-top: auto; /* THÊM - đẩy giá xuống dưới */
}

.qr-section {
    text-align: center;
    margin: 2rem 0;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
}

.bank-info {
    margin-top: 1rem;
    text-align: left;
}
/* ==================== INVOICE FIX ==================== */
.invoice-header {
    text-align: center;
    margin-bottom: 0.3rem;
    padding-bottom: 0.2rem;
    border-bottom: 1px dashed var(--border-color);
}

.invoice-header h3 {
    margin-bottom: 2px;
    font-size: 1.1rem;
}

.invoice-header p {
    margin: 1px 0;
    font-size: 0.75rem; 
}

/* Dòng chứa ngày và khung số bàn */
.invoice-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 5px 0;
    text-align: left;
    font-size: 0.75rem;
}

/* Định dạng khung viền cho số bàn */
.table-badge {
    border: 2px solid #000;
    padding: 2px 8px;
    font-weight: 900;
    border-radius: 6px;
    font-size: 0.9rem;
    white-space: nowrap;
}

/* Thu nhỏ khoảng cách giữa các dòng món ăn */
.invoice-item, .invoice-table-header {
    display: grid;
    grid-template-columns: 50% 15% 35%; 
    align-items: center;
    padding: 0.2rem 0; /* Đã thu nhỏ từ 0.5rem */
    font-size: 0.75rem;
}

.invoice-item {
    border-bottom: 1px dashed var(--border-color);
}

.invoice-table-header {
    font-weight: 700;
    border-bottom: 1px solid black;
    padding-bottom: 3px;
    margin-bottom: 3px;
    text-transform: uppercase;
}

.invoice-item span:nth-child(1), .invoice-table-header span:nth-child(1) { text-align: left; padding-right: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.invoice-item span:nth-child(2), .invoice-table-header span:nth-child(2) { text-align: center; font-weight: 600; }
.invoice-item span:nth-child(3), .invoice-table-header span:nth-child(3) { text-align: right; font-weight: 600; padding-right: 2mm; }

/* Thu nhỏ khoảng cách phần tổng cộng */
.invoice-summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2px;
    font-size: 0.75rem;
}

.invoice-total {
    text-align: right;
    margin-top: 0.3rem;
    padding-top: 0.3rem;
    border-top: 1px solid black;
    font-size: 1rem;
    font-weight: bold;
}

.category-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    /* Các thuộc tính chống vỡ khung */
    overflow-x: auto;         /* Cho phép cuộn ngang */
    white-space: nowrap;      /* Ngăn chữ xuống dòng */
    flex-wrap: nowrap;        /* Ép các tab nằm trên 1 hàng */
    -webkit-overflow-scrolling: touch; /* Cuộn mượt trên di động */
    padding-bottom: 8px;      /* Tránh bị che mất đường line khi cuộn */
    min-width: 0;             /* Quan trọng: ngăn chặn ép rộng container cha */
}

/* Ẩn hoặc làm mỏng thanh cuộn để giao diện chuyên nghiệp hơn */
.category-tabs::-webkit-scrollbar {
    height: 4px;
}
.category-tabs::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

.category-tab {
    background: none;
    border: none;
    padding: 0.75rem 1.2rem;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-gray);
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
    flex-shrink: 0;           /* Ngăn các tab bị co nhỏ chữ */
    display: inline-block;
}

.category-tab.active {
    color: var(--primary-red);
    border-bottom-color: var(--primary-red);
}

.category-tab:hover {
    color: var(--text-dark);
}

.order-details-section {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1rem;
    background: var(--bg-light);
}

.order-details-header {
    margin-bottom: 1rem;
}

.order-detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: white;
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    border: 1px solid var(--border-color);
}

.order-detail-info {
    flex: 1;
}

.order-detail-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.order-total {
    text-align: right;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.add-to-order-btn {
    background: var(--primary-red);
    color: white;
    border: none;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.add-to-order-btn:hover {
    background: #e06666;
    transform: scale(1.1);
}

.tables-visual-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
    padding: 1rem 0;
}

.table-visual-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 0.8rem;
    text-align: center;
    box-shadow: var(--shadow-sm);
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
}

.table-visual-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.table-visual-card.available {
    border-color: var(--primary-green);
    background: rgba(36, 197, 94, 0.02);
}

.table-visual-card.occupied {
    border-color: var(--primary-red);
    background: rgba(237, 68, 70, 0.02);
}

.table-visual-card.reserved {
    border-color: var(--primary-orange);
    background: rgba(245, 158, 11, 0.02);
}

.table-visual-card.maintenance {
    border-color: var(--text-light);
    background: rgba(148, 163, 184, 0.02);
}

.table-visual {
    position: relative;
    margin-bottom: 1rem;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.table-shape {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #8B4513;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    z-index: 2;
}

.table-shape.circle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
}

.table-shape.rectangle {
    width: 60px;
    height: 40px;
    border-radius: 8px;
}

.table-number {
    color: white;
    font-weight: bold;
    font-size: 0.9rem;
}

.chairs-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.chair {
    position: absolute;
    width: 12px;
    height: 12px;
    background: #654321;
    border-radius: 2px;
    border: 1px solid #4a3018;
}

.chair-0 { top: 10px; left: 50%; transform: translateX(-50%); }
.chair-1 { top: 50%; right: 10px; transform: translateY(-50%); }
.chair-2 { bottom: 10px; left: 50%; transform: translateX(-50%); }
.chair-3 { top: 50%; left: 10px; transform: translateY(-50%); }
.chair-4 { top: 20px; right: 20px; }
.chair-5 { bottom: 20px; right: 20px; }
.chair-6 { bottom: 20px; left: 20px; }
.chair-7 { top: 20px; left: 20px; }

.table-info-compact {
    text-align: left;
}

.table-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.table-type {
    font-weight: 500;
    color: var(--text-dark);
    font-size: 0.9rem;
}

.table-status-badge {
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 500;
}

.table-status-badge.available {
    background: var(--primary-green);
    color: white;
}

.table-status-badge.occupied {
    background: var(--primary-red);
    color: white;
}

.table-status-badge.reserved {
    background: var(--primary-orange);
    color: white;
}

.table-status-badge.maintenance {
    background: var(--text-light);
    color: white;
}

.customer-info, .time-info {
    font-size: 0.6rem;
    color: var(--text-gray);
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-bottom: 0;
}

.time-info {
    text-align: right;
    font-size: 0.6rem;
}

.customer-time-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.table-actions-compact {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 0.75rem;
}

@media (max-width: 768px) {
    .table-visual-card {
        padding: 0.6rem;
    }
    
    .tables-visual-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 0.75rem;
    }
    
    .table-visual-card {
        padding: 0.6rem;
    }
}

.table-header-actions {
  display: flex;
  gap: 1rem;
}

.table-visual-card {
  position: relative;
  cursor: pointer;
}

.delete-btn-overlay {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  background: var(--primary-red);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  z-index: 10;
  transition: all 0.2s ease;
}

.delete-btn-overlay.hidden {
  display: none;
}

.delete-btn-overlay:hover {
  transform: scale(1.1);
}

.settings-form input,
.settings-form select {
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    padding: 0.4rem;
    transition: all 0.2s ease;
    background: white;
}

.settings-form input:focus,
.settings-form select:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    transform: translateY(-1px);
}

.settings-form input:hover,
.settings-form select:hover {
    border-color: var(--text-gray);
}

.order-detail-controls button {
    width: 25px;
    height: 25px;
    border: 1px solid var(--border-color);
    background: var(--bg-light);
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.order-detail-controls button:hover {
    background: var(--primary-blue);
    color: white;
}


.table-option-visual:hover {
  background: rgba(59, 130, 246, 0.1);
  border-color: var(--primary-blue);
}

.table-option-visual.selected {
  background: rgba(237, 68, 70, 0.1);
  border-color: var(--primary-red);
}

.table-shape-mini {
  position: relative;
  background: #8B4513;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.table-shape-mini.circle {
  width: 30px;
  height: 30px;
  border-radius: 50%;
}

.table-shape-mini.rectangle {
  width: 35px;
  height: 25px;
  border-radius: 4px;
}

.table-number-mini {
  color: white;
  font-weight: bold;
  font-size: 0.7rem;
}

.chairs-container-mini {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

.chair-mini {
  position: absolute;
  width: 8px;
  height: 8px;
  background: #654321;
  border-radius: 1px;
  border: 1px solid #4a3018;
}

.chair-mini.chair-0 { top: 8px; left: 50%; transform: translateX(-50%); }
.chair-mini.chair-1 { top: 50%; right: 8px; transform: translateY(-50%); }
.chair-mini.chair-2 { bottom: 8px; left: 50%; transform: translateX(-50%); }
.chair-mini.chair-3 { top: 50%; left: 8px; transform: translateY(-50%); }
.chair-mini.chair-4 { top: 15px; right: 15px; }
.chair-mini.chair-5 { bottom: 15px; left: 15px; }

.table-info-mini {
  text-align: center;
}

.table-type-mini {
  font-weight: 500;
  font-size: 0.8rem;
  color: var(--text-dark);
}

.table-capacity-mini {
  font-size: 0.7rem;
  color: var(--text-gray);
}

.restaurant-info {
    display: flex;
    flex-direction: column;
}

.restaurant-details {
    font-size: 0.8rem;
    color: #333;
    white-space: nowrap;
}

.restaurant-details span:empty {
    display: none;
}

.header-logo {
  height: 32px;
  width: auto;
  margin-right: 0.5rem;
  vertical-align: middle;
}

.status.pending {
    background: rgba(245, 158, 11, 0.1);
    color: var(--primary-orange);
}

.status.confirmed {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary-blue);
}

.status.preparing {
    background: rgba(139, 69, 19, 0.1);
    color: #8B4513;
}

.status.completed {
    background: rgba(36, 197, 94, 0.1);
    color: var(--primary-green);
}

.status.cancelled {
    background: rgba(237, 68, 70, 0.1);
    color: var(--primary-red);
}

.report-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.report-card.stat {
    background: var(--bg-white);
    padding: 1rem;
    border-radius: var(--radius-lg);
    text-align: center;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--primary-blue);
}

.report-card.stat h3 {
    font-size: 0.9rem;
    color: var(--text-gray);
    margin-bottom: 0.1rem;
    text-transform: uppercase;
}

.report-card.stat .stat-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-red);
}

.charts-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

.chart-card {
    background: var(--bg-white);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.chart-card h4 {
    margin-bottom: 1rem;
    color: var(--text-dark);
}

.menu-item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.menu-item-row:last-child {
    border-bottom: none;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-light);
    border-radius: 4px;
    overflow: hidden;
    margin: 0.25rem 0;
}

.progress-fill {
    height: 100%;
    background: var(--primary-blue);
    transition: width 0.3s ease;
}

@media (max-width: 768px) {
    .charts-container {
        grid-template-columns: 1fr;
    }
}

.size-buttons {
    display: grid;
    grid-template-columns: repeat(var(--size-count, 2), minmax(0, 1fr));
    gap: 0.45rem;
    width: 100%;
    max-width: 100%;
    margin-bottom: 0;
    align-items: stretch;
}
.size-buttons::-webkit-scrollbar {
  display: none;
}

.size-selector {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    margin-bottom: 0.75rem;
}

.size-selector-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #94a3b8;
    padding-left: 0.2rem;
}

.size-btn {
    background: #ffffff;
    border: 1px solid #dce5ef;
    padding: 0.42rem 0.5rem;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #475569;
  cursor: pointer;
    transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 34px;
}

.size-btn:hover {
    border-color: #bcc9d8;
    background: #f8fafc;
    transform: translateY(-1px);
}

.size-btn.active {
    border-color: rgba(237, 68, 70, 0.45);
    background: linear-gradient(180deg, #fff7f7 0%, #ffffff 100%);
  color: var(--primary-red);
    box-shadow: 0 6px 14px rgba(237, 68, 70, 0.16);
}

.single-price-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.55rem;
    background: linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
    border-radius: 12px;
  border: 1px solid var(--border-color);
}

.price-display {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.price-caption {
    font-size: 0.68rem;
    color: #94a3b8;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.single-price {
    font-weight: 700;
  color: var(--primary-red);
    font-size: 1.05rem;
}

.single-price-container .add-to-cart-btn {
    width: 34px;
    height: 34px;
    min-width: 34px;
    border-radius: 50%;
    box-shadow: 0 8px 16px rgba(237, 68, 70, 0.28);
}

.single-price-container .add-to-cart-btn:hover {
    transform: scale(1.08);
}

.size-btn.disabled {
    opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.out-of-stock {
    color: #9f1239;
    background: #ffe4e6;
    border: 1px solid #fecdd3;
    border-radius: 999px;
    padding: 0.2rem 0.55rem;
  font-weight: 600;
    font-size: 0.75rem;
    white-space: nowrap;
}

.quick-empty-btn {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 24px;
  height: 24px;
  background: var(--primary-green);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  z-index: 10;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
}

.quick-empty-btn:hover {
  transform: scale(1.1);
  background: #059669;
}

.reports-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

.report-section {
    background: var(--bg-white);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.report-section h4 {
    margin-bottom: 1rem;
    color: var(--text-dark);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Items table */
.items-table {
    max-height: 390px;
    overflow-y: auto;
}

.table-header, .table-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1.5fr 0.8fr;
    gap: 1rem;
    align-items: center;
}

.table-header {
    font-weight: 600;
    color: var(--text-dark);
    border-bottom: 2px solid var(--border-color);
    position: sticky;
    top: 0;
    background: var(--bg-white);
}

.table-row {
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
}

.table-row:hover {
    background: var(--bg-light);
}

.item-name {
    font-weight: 500;
    color: var(--text-dark);
}

.item-quantity, .item-percentage {
    text-align: center;
    font-weight: 500;
}

.item-revenue {
    color: var(--primary-red);
    font-weight: 600;
    text-align: right;
}

/* Payment cards */
.payment-cards {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.payment-card {
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-light);
    transition: all 0.2s ease;
}

.payment-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.payment-method {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.payment-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.payment-orders {
    font-size: 0.9rem;
    color: var(--text-gray);
}

.payment-revenue {
    font-weight: 600;
    color: var(--primary-red);
    text-align: right;
}

.payment-percentage {
    grid-column: span 2;
    text-align: center;
    font-weight: 600;
    color: var(--primary-blue);
    margin-top: 0.25rem;
}

@media (max-width: 768px) {
    .reports-grid {
        grid-template-columns: 1fr;
    }
    
    .table-header, .table-row {
        grid-template-columns: 2fr 1fr 1fr;
    }
    
    .item-percentage {
        display: none;
    }
}

.dashboard-analytics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}

.chart-container {
  background: var(--bg-white);
  padding: 1rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

.chart-container.full-width {
  grid-column: 1 / -1;
}

.chart-container h4 {
  margin-bottom: 1rem;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Revenue by day chart */
.revenue-chart {
  display: flex;
  align-items: end;
  gap: 0.5rem;
  height: 200px;
  padding: 1rem 0;
}

.day-revenue {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
}

.revenue-bar {
  background: linear-gradient(to top, var(--primary-red), rgba(237, 68, 70, 0.6));
  width: 100%;
  border-radius: 4px 4px 0 0;
  margin: auto 0 0.5rem 0;
  min-height: 4px;
}

.day-label {
  font-size: 0.8rem;
  color: var(--text-gray);
  margin-bottom: 0.25rem;
}

.revenue-amount {
  font-size: 0.7rem;
  color: var(--primary-red);
  font-weight: 600;
}

/* Status chart */
.status-chart {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.status-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  justify-content: space-between;
}

.status-bar {
  height: 20px;
  background: var(--primary-blue);
  border-radius: 10px;
  min-width: 20px;
}

.status-label {
  flex: 1;
  white-space: nowrap; 
  overflow: hidden; 
  text-overflow: ellipsis; 
  max-width: 120px;
  font-size: 0.8rem;
}

.status-count {
  font-weight: 600;
  color: var(--primary-red);
  margin-left: auto;
}

/* Top items chart */
.top-items-chart {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.item-row {
  display: grid;
  grid-template-columns: 30px 1fr 60px 40px;
  gap: 0.5rem;
  align-items: center;
}

.item-rank {
  font-weight: 700;
  color: var(--primary-orange);
}

.item-name {
  font-size: 0.9rem;
}

.item-bar {
  height: 16px;
  background: var(--primary-green);
  border-radius: 8px;
  min-width: 16px;
}

.item-quantity {
  font-weight: 600;
  text-align: center;
}

/* Hourly chart */
.hourly-chart {
  display: flex;
  align-items: end;
  gap: 0.25rem;
  height: 180px;
  padding: 1rem 0;
}

.hour-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
}

.hour-bar {
  background: linear-gradient(to top, var(--primary-blue), rgba(59, 130, 246, 0.6));
  width: 100%;
  border-radius: 2px 2px 0 0;
  margin: auto 0 0.25rem 0;
}

.hour-label {
  font-size: 0.7rem;
  color: var(--text-gray);
  margin-bottom: 0.25rem;
}

.hour-revenue {
  font-size: 0.6rem;
  color: var(--primary-blue);
  font-weight: 600;
}

@media (max-width: 768px) {
  .dashboard-analytics {
    grid-template-columns: 1fr;
  }
  
  .hour-column {
    min-width: 20px;
  }
  
  .hour-revenue {
    display: none;
  }
}

.cart-items {
    max-height: 245px; /* Giới hạn chiều cao cho khoảng 5 sản phẩm */
    overflow-y: auto;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 0.5rem;
}

.cart-summary {
    position: sticky;
    bottom: 0;
    background: var(--bg-white);
    border-top: 2px solid var(--border-color);
    padding-top: 0.4rem;
    margin-top: auto;
}

.cart-items::-webkit-scrollbar {
    width: 6px;
}

.cart-items::-webkit-scrollbar-track {
    background: var(--bg-light);
    border-radius: 3px;
}

.cart-items::-webkit-scrollbar-thumb {
    background: var(--text-light);
    border-radius: 3px;
}

.cart-items::-webkit-scrollbar-thumb:hover {
    background: var(--text-gray);
}

#customerMenuContainer {
  max-height: 70vh;
  overflow-y: auto;
  padding-right: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1rem;
}

#customerMenuContainer::-webkit-scrollbar {
  width: 8px;
}

#customerMenuContainer::-webkit-scrollbar-track {
  background: var(--bg-light);
  border-radius: 4px;
}

#customerMenuContainer::-webkit-scrollbar-thumb {
  background: var(--text-light);
  border-radius: 4px;
}

.hourly-chart-line {
  width: 100%;
}

.line-chart {
  width: 100%;
  height: 200px;
  background: white;
}

.hourly-values {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
  font-size: 0.8rem;
}

.hour-value {
  color: var(--text-gray);
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--primary-red);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
}

@media (max-width: 768px) {
    .mobile-menu-btn {
        display: block;
    }
    
    .management-sidebar {
        position: fixed;
        top: 0;
        left: -280px;
        height: 100vh;
        width: 280px;
        z-index: 1500;
        transition: left 0.3s ease;
        background: white;
        box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    }
    
    .management-sidebar.show {
        left: 0;
    }
    
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 1400;
        display: none;
    }
    
    .sidebar-overlay.show {
        display: block;
    }
}

@media (max-width: 768px) {
    .table-container {
    }
    .table-container {
        overflow-x: auto;
        position: relative;
        max-width: 100vw;
    }
    
    .data-table {
        min-width: 900px; /* Đảm bảo table không bị co lại */
        width: auto;
    }
    
    .data-table th,
    .data-table td {
        white-space: nowrap; /* Không cho text xuống dòng */
        padding: 0.5rem;
    }
    
    /* Fixed header cho table */
    .data-table thead th {
        position: sticky;
        top: 0;
        background: var(--bg-light);
        z-index: 10;
    }
    
    /* Action buttons không xuống dòng */
    .data-table td:last-child {
        min-width: 100px;
    }
    
    .data-table td:last-child .btn-edit,
    .data-table td:last-child .btn-delete {
        display: inline-block;
        margin: 0 2px;
    }
}

@media (max-width: 768px) {
    .management-content {
    }
    .management-content {
        padding: 1rem 0.5rem;
        overflow-x: hidden; /* Ngăn content chính bị scroll ngang */
    }
    
    .filters-bar {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 0.5rem;
    }
    
    .search-input {
        min-width: 200px;
    }
}
/* ==================== PRINT STYLES (CẤU HÌNH IN HÓA ĐƠN) ==================== */
@media print {
    @page {
        size: 80mm auto; /* Khổ giấy 80mm */
        margin: 0; /* Bỏ lề mặc định của trình duyệt */
    }
    
    body {
        width: 100%;
        margin: 0;
        padding: 0;
    }

    /* 1. Ẩn toàn bộ giao diện trang web mặc định */
    body * {
        visibility: hidden;
        height: 0; 
        overflow: hidden;
    }

    /* 2. Chỉ hiển thị Modal Hóa đơn và nội dung bên trong */
    #invoiceModal,
    #invoiceModal .modal-content,
    #invoiceModal .modal-body,
    #invoiceContent,
    #invoiceContent *,
    #qrCodeSection,
    #qrCodeSection * {
        visibility: visible;
        height: auto;
        overflow: visible;
    }

    /* 3. Căn chỉnh Modal bao ngoài cùng chiếm full chiều rộng trình duyệt khi in */
    #invoiceModal {
        position: absolute;
        left: 0;
        top: 0;
        width: 100% !important; 
        margin: 0;
        padding: 0;
        background: white !important;
        z-index: 99999;
        display: block !important;
    }

    /* 4. CHỐNG MẤT LỀ PHẢI: Ép vùng chứa nội dung chính xác 72mm (vùng in thực tế của máy 80mm) */
    #invoiceModal .modal-content {
        box-shadow: none !important;
        border: none !important;
        width: 72mm !important;
        max-width: 72mm !important; 
        margin: 0 auto !important; /* Canh giữa nội dung */
        padding: 0 !important; 
        box-sizing: border-box !important; 
        transform: none !important;
        position: static;
    }

    /* 5. Ẩn các nút bấm không cần thiết */
    #invoiceModal .modal-header,
    #invoiceModal .close-btn,
    #invoiceModal .form-actions {
        display: none !important;
    }

    /* 6. CHỐNG MẤT THÔNG TIN NGÂN HÀNG: Tạo khoảng trắng dài 40mm ở cuối bill để máy đẩy qua dao cắt */
    #invoiceModal .modal-body {
        padding: 0 !important;
        padding-bottom: 50mm !important; 
    }
    
    /* 7. Định dạng mã QR không bị ngắt trang */
    .qr-section {
        page-break-inside: avoid;
        margin-top: 10px;
    }

    /* 8. Ẩn thông tin chữ của ngân hàng khi in (Chỉ giữ lại mã QR) */
    .bank-info {
        display: none !important;
    }
    
    .bank-info p {
        margin: 4px 0;
        line-height: 1.4;
    }
    
    /* 9. Đảm bảo chữ đen sắc nét trên giấy nhiệt */
    * {
        color: black !important;
        -webkit-print-color-adjust: exact;
    }
}
/* ==================== KITCHEN VIEW ==================== */

/* 1. Thiết lập khung chính cố định chiều cao theo màn hình */
.kitchen-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    /* Quan trọng: Tính toán chiều cao cố định (Full màn hình - Chiều cao Header) */
    height: calc(100vh - 160px); 
    min-height: 500px;
    padding-bottom: 10px;
}

/* 2. Cột chứa danh sách */
.kitchen-column {
    background: var(--bg-light);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Ẩn phần thừa của khung ngoài */
    box-shadow: var(--shadow-sm);
}

.kitchen-col-header {
    background: var(--text-dark);
    color: white;
    padding: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    text-align: center;
    font-size: 1.1rem;
    flex-shrink: 0; /* Không cho header bị co lại */
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 10;
}

.drink-column .kitchen-col-header { background: var(--primary-blue); }
.food-column .kitchen-col-header { background: var(--primary-red); }

/* 3. Vùng chứa các món ăn (Có thanh cuộn) */
.kitchen-items-container {
    padding: 1rem;
    overflow-y: auto; /* Kích hoạt thanh cuộn dọc */
    flex: 1; /* Chiếm toàn bộ không gian còn lại */
    display: flex;
    flex-direction: column;
    gap: 1rem;
    
    /* Tùy chỉnh thanh cuộn cho đẹp (Firefox) */
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f1f5f9;
}

/* Tùy chỉnh thanh cuộn (Chrome, Edge, Safari) */
.kitchen-items-container::-webkit-scrollbar {
    width: 8px;
}

.kitchen-items-container::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.kitchen-items-container::-webkit-scrollbar-thumb {
    background-color: #94a3b8;
    border-radius: 4px;
    border: 2px solid #f1f5f9;
}

.kitchen-items-container::-webkit-scrollbar-thumb:hover {
    background-color: #64748b;
}

/* 4. Style cho vé (Ticket) - QUAN TRỌNG NHẤT */
.kitchen-ticket {
    /* CHÌA KHÓA FIX LỖI: flex-shrink: 0 ngăn thẻ bị co lại khi danh sách dài */
    flex-shrink: 0; 
    
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border-left: 5px solid var(--text-gray);
    display: flex;
    overflow: hidden;
    animation: fadeIn 0.3s ease;
    transition: transform 0.2s, box-shadow 0.2s;
    min-height: 110px; /* Đảm bảo chiều cao tối thiểu cho mỗi thẻ */
}

.kitchen-ticket:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.kitchen-ticket.priority-high {
    border-left-color: var(--primary-red);
    background: #fff5f5; /* Nền đỏ nhạt để cảnh báo */
}

/* Các thành phần con giữ nguyên */
.ticket-image {
    width: 100px; /* Tăng kích thước ảnh chút cho đẹp */
    height: auto;
    object-fit: cover;
    background: #eee;
}

.ticket-content {
    flex: 1;
    padding: 0.8rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.ticket-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-gray);
    font-weight: 600;
}

.ticket-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
    line-height: 1.3;
}

.ticket-detail {
    font-size: 0.95rem;
    color: var(--text-dark);
    display: flex;
    align-items: center;
}

.ticket-action {
    padding: 0.5rem;
    width: 70px; /* Cố định chiều rộng vùng nút bấm */
    display: flex;
    align-items: center;
    justify-content: center;
    border-left: 1px solid var(--border-color);
    background: #fafafa;
}

.btn-kitchen-done {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: 2px solid #e2e8f0;
    background: white;
    color: #cbd5e1;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-kitchen-done:hover {
    background: var(--primary-green);
    border-color: var(--primary-green);
    color: white;
    transform: scale(1.1);
    box-shadow: 0 4px 6px rgba(36, 197, 94, 0.2);
}

/* Responsive cho Mobile */
@media (max-width: 768px) {
    .kitchen-layout {
        grid-template-columns: 1fr; /* Về 1 cột */
        height: auto; /* Chiều cao tự động */
        min-height: auto;
        padding-bottom: 20px;
    }
    
    .kitchen-column {
        height: 500px; /* Cố định chiều cao mỗi cột trên mobile để scroll được */
        margin-bottom: 1rem;
    }
}
/* ==================== HORIZONTAL MENU PICKER ==================== */

.menu-list-layout {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    padding-right: 5px; /* Để tránh thanh cuộn che nội dung */
}

.menu-item-horizontal {
    display: flex;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 0.8rem;
    gap: 1rem;
    align-items: center;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.menu-item-horizontal:hover {
    border-color: var(--primary-blue);
    box-shadow: var(--shadow-md);
    transform: translateX(2px);
}

.item-h-image {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    border-radius: var(--radius);
    overflow: hidden;
    background: #f1f5f9;
    border: 1px solid #eee;
}

.item-h-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.item-h-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0; /* Giúp text truncate hoạt động */
}

.item-h-name {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
}

.item-h-desc {
    font-size: 0.85rem;
    color: var(--text-gray);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.item-h-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
    min-width: 140px; /* Đảm bảo khu vực nút bấm đủ rộng */
}

.item-h-sizes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    justify-content: flex-end;
}

.item-h-price-row {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-top: auto;
}

.item-h-price {
    font-weight: 700;
    color: var(--primary-red);
    font-size: 1rem;
}

/* Responsive cho Mobile */
@media (max-width: 600px) {
    .menu-item-horizontal {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .item-h-image {
        width: 100%;
        height: 120px;
    }
    
    .item-h-actions {
        width: 100%;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        margin-top: 0.5rem;
    }
}
/* ==================== STAFF MANAGEMENT ==================== */
.staff-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.5rem;
}

.staff-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-align: center;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.staff-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-blue);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.staff-card:hover::before {
    transform: scaleX(1);
}

.staff-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: rgba(59, 130, 246, 0.3);
}

.staff-avatar {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-blue), #2563eb);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 1.5rem;
    color: white;
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3);
}

.staff-card h3 {
    font-size: 1.1rem;
    color: var(--text-dark);
    margin-bottom: 0.2rem;
}

.staff-position {
    color: var(--text-gray);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.staff-contact {
    font-size: 0.85rem;
    color: var(--text-gray);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.staff-role-badge {
    display: inline-block;
    padding: 0.2rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.staff-role-badge.admin {
    background: rgba(245, 158, 11, 0.1);
    color: var(--primary-orange);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.staff-role-badge.user {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary-blue);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.staff-actions {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}
/* ==================== LOGIN OVERLAY ==================== */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(237, 68, 70, 0.9), rgba(59, 130, 246, 0.9));
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.login-box {
    background: white;
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.login-box h2 {
    color: var(--text-dark);
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.login-box .form-group {
    text-align: left;
}

.login-box .btn-primary {
    width: 100%;
    margin-top: 1rem;
    padding: 0.8rem;
    font-size: 1.1rem;
    justify-content: center; /* Thêm dòng này để căn giữa chữ */
    text-align: center;      /* Thêm dòng này để căn giữa chữ */
}

.user-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-light);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    border: 1px solid var(--border-color);
    margin-right: 0.5rem;
}
