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

/* --- Global App Styles --- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

/* IMPORTANT: Ensure html and body are the main scrollable containers */
html, body {
    height: 100%; /* Full height */
    /* Removed overflow-y: auto; here to rely on browser's default scrolling for the main document */
    margin: 0;
    padding: 0;
}

body {
    font-family: "Battambang", cursive, sans-serif; /* Changed to Battambang for all text as requested */
    background-color: #f0f2f5;
    color: #2c3e50;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Ensure all text elements use Battambang */
body, h1, h2, h3, h4, input, textarea, select, button, span, p, a, li {
    font-family: "Battambang", cursive, sans-serif;
}

.message {
    font-weight: bold;
    text-align: center;
    margin-top: 15px;
    padding: 10px;
    border-radius: 8px;
}

.success-message {
    color: #28a745;
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
}

.error-message {
    color: #dc3545;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
}

.empty-state {
    text-align: center;
    color: #95a5a6;
    padding: 30px;
    font-style: italic;
}

.hidden {
    display: none !important;
}

/* --- Dashboard Wrapper (Flexbox for Sidebar Layout) --- */
.dashboard-wrapper {
    display: flex;
    /* Removed min-height: 100vh; here, as html/body now control overall height and scroll */
    background-color: #f0f2f5; /* Consistent background */
    position: relative; /* Needed for mobile sidebar overlay */
    overflow-x: hidden; /* Prevent horizontal scroll when sidebar opens */
    min-height: 100vh; /* Ensure wrapper pushes footer down if content is short */
}

/* --- Sidebar Styles --- */
.sidebar {
    width: 250px; /* Default full width for sidebar */
    background-color: #2c3e50; /* Dark background for sidebar */
    color: #ecf0f1; /* Light text */
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    transition: width 0.3s ease, transform 0.3s ease; /* Smooth transition for collapse and mobile slide */
    flex-shrink: 0; /* Prevent sidebar from shrinking */
    
    /* Changed to fixed for true stickiness on larger screens */
    position: fixed; 
    top: 0; 
    left: 0; /* Position from left */
    height: 100vh; /* Takes full viewport height */
    overflow-y: auto; /* Enable scrolling if sidebar content overflows */
    z-index: 100; /* Ensure it's above other content */
}

.sidebar-header {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h2 {
    margin: 0;
    font-size: 1.5em;
    color: #ecf0f1;
    white-space: nowrap; /* Prevent wrapping */
    overflow: hidden; /* Hide overflow when collapsed */
    text-overflow: ellipsis;
}

.sidebar.collapsed .sidebar-header h2 {
    display: none; /* Hide title when collapsed */
}

.toggle-sidebar-btn {
    background: none;
    border: none;
    color: #ecf0f1;
    font-size: 1.5em;
    cursor: pointer;
    padding: 5px;
    border-radius: 5px;
    transition: background-color 0.2s;
}
.toggle-sidebar-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}
.sidebar.collapsed .toggle-sidebar-btn {
    width: 100%; /* Make button full width in collapsed state */
    justify-content: center;
}

.sidebar-nav {
    flex-grow: 1; /* Take up available space */
    padding: 20px 0;
}

.sidebar-nav .nav-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #bdc3c7; /* Lighter grey for inactive items */
    text-decoration: none;
    font-size: 1.1em;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
    border: none; /* Remove button default border */
    background: none; /* Remove button default background */
    width: 100%; /* Ensure button takes full width */
    text-align: left;
}

.sidebar-nav .nav-item i {
    font-size: 1.3em;
    margin-right: 15px;
    width: 25px; /* Fixed width for icons */
    text-align: center;
}

.sidebar.collapsed .sidebar-nav .nav-item i {
    margin-right: 0;
}

.sidebar.collapsed .sidebar-nav .nav-item span {
    display: none; /* Hide text when collapsed */
}

.sidebar-nav .nav-item:hover {
    background-color: #34495e; /* Darker on hover */
    color: #ecf0f1;
}

.sidebar-nav .nav-item.active {
    background-color: #3498db; /* Blue for active item */
    color: white;
    font-weight: 600;
    border-left: 5px solid #e74c3c; /* Red highlight for active */
    padding-left: 15px; /* Adjust padding due to border */
}

.sidebar.collapsed .sidebar-nav .nav-item.active {
    border-left: none; /* Remove border when collapsed */
    border-radius: 5px; /* Add slight rounding */
    margin: 0 10px; /* Add margin to center */
    width: auto;
    padding: 12px; /* Adjust padding for collapsed state */
    justify-content: center;
}


.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logout-btn {
    background-color: #e74c3c; /* Red logout button */
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 8px;
    width: 100%;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
.sidebar-logout-btn:hover {
    background-color: #c0392b;
}

.sidebar.collapsed .sidebar-logout-btn span {
    display: none; /* Hide text when collapsed */
}
.sidebar.collapsed .sidebar-logout-btn {
    width: 50px; /* Smaller button when collapsed */
    height: 50px;
    border-radius: 50%;
    padding: 0;
}


/* --- Main Content Area --- */
.main-content {
    flex-grow: 1; /* Take remaining width */
    display: flex;
    flex-direction: column;
    z-index: 1; /* Ensure it's below the sidebar on mobile overlay */
    /* Removed overflow-y: auto; here, as html/body now control scrolling */
    
    /* Initial margin for desktop/tablet */
    margin-left: 250px; /* Default margin for full sidebar */
    transition: margin-left 0.3s ease; /* Smooth transition for margin change */
}

.main-header {
    background-color: #fff;
    padding: 15px 25px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #eee;
    
    /* Sticky header for general use */
    position: sticky;
    top: 0;
    z-index: 99; /* Below sidebar, above content */
}

.main-header h1 {
    margin: 0;
    font-size: 1.8em;
    color: #34495e;
}

/* Hide mobile toggle button on desktop */
#toggleSidebarBtnMobile {
    display: none;
}

.content-area {
    padding: 25px;
    flex-grow: 1;
    /* Removed overflow-y: auto; here */
}

/* --- Section Titles & Cards (Reused from previous styles, adjusted for new layout) --- */
.card-section {
    background-color: #fff;
    padding: 30px;
    border-radius: 15px; /* Slightly less rounded than before for a sharper look */
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
    margin-bottom: 25px; /* Space between sections */
}

.section-title {
    text-align: left; /* Align to left within content area */
    font-size: 1.8em;
    font-weight: 700;
    color: #34495e; /* Darker grey for section titles */
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee; /* Lighter border */
}

.section-subtitle {
    font-size: 1.2em;
    font-weight: 600;
    color: #555;
    margin-top: 25px;
    margin-bottom: 15px;
    border-bottom: 1px dashed #eee; /* Dashed border for subtitle */
    padding-bottom: 8px;
}

/* --- Forms & Inputs (Adjusted for new aesthetic) --- */
.form-card {
    display: flex;
    flex-direction: column;
    gap: 15px; /* Slightly smaller gap */
    max-width: 500px; /* Default max-width for forms */
    margin: 0 auto;
    padding: 20px; /* Add padding to form card itself */
    border: 1px solid #f0f0f0; /* Light border */
    border-radius: 10px; /* Rounded corners */
    background-color: #fdfdfd; /* Slightly off-white background */
}

label {
    font-weight: 500; /* Slightly lighter font weight */
    color: #444;
    margin-bottom: 3px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
textarea,
select,
input[type="file"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e0e0e0; /* Lighter border */
    border-radius: 8px; /* Rounded corners */
    font-size: 1em;
    background-color: #ffffff;
    transition: all 0.2s ease;
}

input:focus, textarea:focus, select:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2); /* Softer focus ring */
    outline: none;
}

.file-input-label {
    background-color: #f8f8f8; /* Lighter background for file input */
    color: #34495e;
    padding: 10px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    text-align: center;
    transition: background-color 0.2s ease;
}

.file-input-label:hover {
    background-color: #eef0f2;
}

.image-preview {
    border: 2px dashed #bdc3c7;
    border-radius: 10px;
    padding: 10px;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f9f9f9;
}

.current-logo-img, .menu-item-preview-img {
    max-width: 100%;
    max-height: 120px; /* Slightly smaller preview */
    border-radius: 8px;
    object-fit: contain;
}

/* --- Buttons (Adjusted for new aesthetic) --- */
.primary-btn {
    background-color: #3498db; /* Blue for primary actions */
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 8px; /* Rounded corners */
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: background-color 0.2s, transform 0.1s;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.2); /* Softer shadow */
    width: 100%;
}

.primary-btn:hover {
    background-color: #2980b9;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(52, 152, 219, 0.3);
}

.secondary-btn {
    background-color: #6c757d; /* Darker grey for secondary */
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 6px;
    font-size: 0.9em;
    font-weight: 500;
}
.secondary-btn:hover {
    background-color: #5a6268;
}

.delete-btn {
    background-color: #e74c3c; /* Red for delete */
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 6px;
    font-size: 0.9em;
    font-weight: 500;
}
.delete-btn:hover {
    background-color: #c0392b;
}

/* --- Table Styles (Refined) --- */
.styled-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 0.9em;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05); /* Softer shadow */
    border-radius: 10px; /* Slightly less rounded */
    overflow: hidden;
}

.styled-table thead tr {
    background-color: #3498db; /* Blue header */
    color: #ffffff;
    text-align: left;
}

.styled-table th,
.styled-table td {
    padding: 12px 15px;
    border: none;
}

.styled-table tbody tr {
    border-bottom: 1px solid #f0f0f0; /* Lighter border */
    transition: background-color 0.2s;
}

.styled-table tbody tr:nth-of-type(even) {
    background-color: #f9f9f9; /* Even lighter grey for even rows */
}

.styled-table tbody tr:last-of-type {
    border-bottom: 2px solid #3498db;
}
.styled-table tbody tr:hover {
    background-color: #ecf0f1;
}

.table-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap; /* Allow buttons to wrap */
}

/* --- Modals (Consistent Styling) --- */
.modal-content {
    background-color: #fff;
    padding: 30px;
    border-radius: 15px; /* Consistent rounding */
    box-shadow: 0 8px 30px rgba(0,0,0,0.2); /* Stronger shadow for modals */
}

.modal-header h2 {
    color: #34495e; /* Dark grey for modal titles */
}

.close-button {
    color: #7f8c8d;
    font-size: 1.8em;
}
.close-button:hover {
    color: #555;
}

/* --- Responsive Design for Admin Dashboard --- */
/* Desktop (>= 1024px) */
@media (min-width: 1024px) {
    .sidebar {
        width: 250px; /* Full width on large screens */
        position: fixed; /* Changed to fixed for true stickiness */
        top: 0;
        left: 0;
        height: 100vh;
        transform: translateX(0); /* Ensure it's not translated */
    }
    .sidebar.collapsed { /* Collapsed state for desktop */
        width: 70px;
    }
    .sidebar.collapsed .sidebar-header h2,
    .sidebar.collapsed .sidebar-nav .nav-item span,
    .sidebar.collapsed .sidebar-logout-btn span {
        display: none;
    }
    .sidebar.collapsed .sidebar-nav .nav-item {
        justify-content: center;
        padding: 12px;
    }
    .sidebar.collapsed .sidebar-nav .nav-item i {
        margin-right: 0;
    }
    .sidebar.collapsed .sidebar-logout-btn {
        width: 50px;
        height: 50px;
        border-radius: 50%;
        padding: 0;
    }
    .sidebar.collapsed .sidebar-logout-btn i {
        margin-right: 0;
    }

    #toggleSidebarBtn { /* Desktop toggle button */
        display: block;
    }
    #toggleSidebarBtnMobile { /* Mobile toggle button (hidden on desktop) */
        display: none;
    }
    .dashboard-wrapper.sidebar-open .main-content::before { /* Hide overlay on desktop */
        display: none;
    }

    /* Adjust main content margin for fixed sidebar */
    .main-content {
        margin-left: 250px; /* Default margin for full sidebar */
    }
    .main-content.sidebar-collapsed-margin { /* New class for collapsed sidebar margin */
        margin-left: 70px;
    }

    /* Force 4 columns on larger desktops for admin menu grid */
    #tab-menu .menu-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    /* Force 4 columns on larger desktops for customer order menu grid */
    .order-container .menu-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Tablet & Smaller Desktop (768px to 1399px) - Show 2 or 3 cards per row */
@media (min-width: 768px) and (max-width: 1399px) {
    .container {
        padding: 20px;
    }
    /* Admin Dashboard Menu Grid specific (tab-menu) */
    #tab-menu .menu-grid {
        /* Adjusted minmax to ensure 2 or 3 columns fit without cutoff */
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); /* Adjusted for better fit on tablets */
        gap: 15px;
    }

    /* CUSTOMER ORDER PAGE MENU GRID ON TABLETS */
    .order-container .menu-grid {
        /* Adjusted minmax to ensure 2 or 3 columns fit without cutoff */
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); /* Adjusted for better fit on tablets */
        gap: 15px;
        justify-content: unset; /* Ensure it takes full width */
    }

    /* Keep other grids as they were or adjust as needed */
    .dashboard-overview-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); /* Adjusted min-width for overview cards */
        gap: 15px; /* Slightly smaller gaps */
    }
    #tab-tables .table-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); /* Aim for 3-4 columns on iPad */
        gap: 15px;
    }
    /* ADDED: Max width to table cards to prevent excessive stretching when alone */
    #tab-tables .table-card {
        max-width: 250px; /* Limit the max width of individual table cards */
        margin: 0 auto; /* Center individual cards if they don't fill the row */
    }
    #tab-orders .order-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); /* Adjust for more suitable order card width */
        gap: 15px;
    }

    .section-title {
        font-size: 1.8em;
    }
    .section-description {
        font-size: 0.95em;
    }
    .modal-content {
        width: 80%; /* Slightly narrower for better centering */
        max-width: 700px; /* Prevent it from getting too wide */
    }
    .modal-content.product-quick-view-content {
        max-width: 400px;
    }

    /* Order page menu item name font size adjustment */
    .order-container .menu-card .menu-card-content h3 {
        font-size: 1em; /* Adjust this value as needed */
    }
    
    /* Ensure main content has the correct margin based on sidebar collapsed state */
    /* This rule ensures the main content shifts correctly */
    .main-content { 
        margin-left: 250px; /* Default margin for full sidebar */
    }

    /* When sidebar is collapsed, apply the smaller margin */
    .main-content.sidebar-collapsed-margin {
        margin-left: 70px;
    }

    /* Ensure sidebar is correctly positioned and transitions its width */
    .sidebar {
        width: 250px; /* Default full width */
        transform: translateX(0); /* Ensure it's in view by default */
    }

    .sidebar.collapsed {
        width: 70px; /* Collapsed width */
    }

    /* Adjusted form-card max-width for tablet/small laptop to prevent cutoff */
    /* Removed specific max-width for #tab-menu .form-card to allow it to be more flexible */
    #tab-menu .form-card { 
        max-width: none; /* Allow it to take full available width */
        margin: 0; /* Remove auto margin to align left */
        padding: 15px; /* Adjust padding if needed */
    }
    .content-area {
        /* Adjusted padding for content area to give more space */
        padding: 15px 25px; /* Added more horizontal padding */
    }
    /* Ensure search container and category buttons are flexible */
    #tab-menu .search-container,
    #tab-menu .category-buttons {
        padding: 0; /* Remove padding that might cause overflow */
        margin-left: 0;
        margin-right: 0;
    }
    /* Adjust menu grid to be more flexible on tablets */
    #tab-menu .menu-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); /* Adjusted min-width for more flexibility */
        gap: 15px;
    }
}

/* Mobile (<= 767px) - Show 2 cards per row */
@media (max-width: 767px) {
    .dashboard-wrapper {
        flex-direction: column; /* Stack sidebar and content vertically */
        position: relative;
    }
    .sidebar {
        position: fixed; /* Position fixed for off-canvas */
        top: 0;
        left: 0;
        width: 250px; /* Full width for the sidebar when open */
        height: 100vh; /* Full viewport height */
        transform: translateX(-100%); /* Start off-canvas (hidden) */
        transition: transform 0.3s ease-in-out; /* Smooth slide effect */
        box-shadow: 4px 0 15px rgba(0, 0, 0, 0.2);
        z-index: 200; /* Ensure it's above everything when open */
        flex-direction: column; /* Ensure vertical layout for sidebar content */
    }

    /* NEW: Class to open sidebar */
    .dashboard-wrapper.sidebar-open .sidebar {
        transform: translateX(0); /* Slide into view */
    }

    /* Overlay for main content when sidebar is open */
    .dashboard-wrapper.sidebar-open .main-content::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.5); /* Dim the main content */
        z-index: 150; /* Between sidebar and main content */
        cursor: pointer;
    }

    .sidebar-header {
        justify-content: space-between; /* Keep toggle button visible */
    }
    .sidebar-header h2 {
        display: block; /* Show title on mobile sidebar */
    }
    .sidebar-nav .nav-item span {
        display: inline-block; /* Show text on mobile sidebar */
    }
    .sidebar-logout-btn {
        display: flex; /* Show logout button on mobile sidebar */
        width: 100%;
        border-radius: 8px;
        padding: 10px 15px;
    }
    .sidebar-logout-btn span {
        display: inline-block;
    }
    .order-app-header .table-info {
    font-size: 0.9em; /* Reduced font size for table number */
    white-space: nowrap; /* Prevent table info from wrapping */
}

    #toggleSidebarBtn { /* Hide desktop toggle on mobile */
        display: none;
    }
    #toggleSidebarBtnMobile { /* Show mobile toggle */
        display: block;
        color: #34495e; /* Match header text color */
        font-size: 1.8em; /* Larger for easy tapping */
    }

    .main-header {
        position: sticky; /* Keep main header sticky */
        top: 0;
        z-index: 99; /* Ensure it's above main content */
        justify-content: flex-start; /* Align header content to start */
        gap: 15px;
    }
    .main-header h1 {
        font-size: 1.5em;
    }

    /* Reset main content margin for mobile (no sidebar offset) */
    .main-content {
        margin-left: 0; 
    }

    .content-area {
        padding: 15px;
    }
    .card-section {
        padding: 20px;
        border-radius: 10px;
    }
    .section-title {
        font-size: 1.6em;
    }
    .form-card {
        padding: 15px;
        gap: 10px;
    }
    .styled-table {
        font-size: 0.8em;
    }
    .styled-table th, .styled-table td {
        padding: 8px;
    }
    .table-actions button {
        padding: 6px 10px;
        font-size: 0.75em;
    }
    .dashboard-overview-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); /* More compact cards */
        gap: 10px;
    }
    .overview-card {
        padding: 15px;
        border-radius: 10px;
    }
    .overview-card h3 {
        font-size: 0.9em;
    }
    .overview-card .value {
        font-size: 1.8em;
    }
    /* ADMIN DASHBOARD MENU GRID ON MOBILE - Force 2 columns */
    #tab-menu .menu-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .menu-card-content h3 {
        font-size: 0.9em;
    }
    .menu-card-content p {
        font-size: 0.75em;
    }
    .menu-card-content .price {
        font-weight: 700;
        color: #2980b9;
        font-size: 1em;
    }
    .menu-card-actions button {
        font-size: 0.7em;
        padding: 6px;
    }
    .table-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
    /* ADDED: Max width to table cards to prevent excessive stretching when alone on mobile */
    #tab-tables .table-card {
        max-width: 200px; /* Limit the max width of individual table cards on mobile */
        margin: 0 auto; /* Center individual cards if they don't fill the row */
    }
    .table-id-label {
        font-size: 1em;
    }
    .qr-code-container {
        padding: 3px;
    }
    .order-grid {
        grid-template-columns: 1fr; /* Single column for orders on very small screens */
    }

    /* CUSTOMER ORDER PAGE MENU GRID ON MOBILE - Force 2 columns */
    .order-container .menu-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); /* Adjusted for better fit */
        gap: 10px;
        justify-content: center; /* Center items when there's only one or odd number */
    }
    /* ADDED: Max width to menu cards to prevent excessive stretching when alone */
    .order-container .menu-card {
        max-width: 250px; /* Limit the max width of individual menu cards */
        width: 100%; /* Ensure it respects its container */
    }
    .order-container .menu-card .menu-card-content h3 {
        font-size: 0.7em;
    }
}

/* Specific styles for the product quick view modal */
.product-quick-view-content {
    /* Adjust as needed for admin dashboard modals */
}

/* Styles for the new remark display in admin modal */
.admin-item-remark {
    font-size: 0.85em;
    color: #666;
    margin-top: 4px;
    margin-bottom: 0;
    font-style: italic;
    padding-left: 4px;
    border-left: 2px solid #ccc;
}
.modal-footer {
    display: flex;
    justify-content: flex-end; /* Align buttons to the right */
    gap: 10px;
    padding-top: 15px;
    border-top: 1px solid #eee;
    margin-top: 15px;
}
.modal-footer .primary-btn, .modal-footer .secondary-btn {
    width: auto; /* Allow buttons to size based on content */
    padding: 10px 20px;
}
/* Ensure they stack nicely on very small screens if needed */
@media (max-width: 480px) {
    .modal-footer {
        flex-direction: column; /* Stack buttons vertically */
        align-items: stretch; /* Make them full width */
    }
}

/* OUT OF STOCK OVERLAY */
.out-of-stock-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5); /* Semi-transparent dark overlay */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5; /* Below the tag, above the image */
    border-radius: 12px; /* Match card rounding */
}

.out-of-stock-tag {
    background-color: #7f8c8d;
    color: white;
    font-weight: bold;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.8em;
    text-transform: uppercase;
    transform: rotate(5deg);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}
/* Add this class to the menu-card when item is out of stock */
.out-of-stock-card {
    filter: grayscale(80%); /* Visually indicate out of stock */
    opacity: 0.7;
    pointer-events: none; /* Disable clicks on the card */
}

/* Hide the default app-header from admin.html as we have a new main-header */
.app-header {
    display: none;
}


/* .app-header {
    background-color: #fff;
    padding: 15px 20px;
    border-bottom: 1px solid #e0e0e0;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
} */
.app-header h1 {
    font-size: 1.8em;
    margin: 0;
    color: #34495e;
}
.header-btn {
    padding: 8px 16px;
    font-size: 14px;
    background-color: #e74c3c;
    border-radius: 8px;
    font-weight: 600;
}
.header-btn:hover {
    background-color: #c0392b;
}

/* --- Order Page Header (Mobile App Style) --- */
.order-app-header {
    background-color: #fff;
    color: #333;
    padding: 15px 15px 15px 20px; /* Example: 15px top/right/bottom, 20px left */
    /* Or, for more space: */
    /* padding: 15px 15px 15px 25px; */ /* 25px left padding */
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid #eee;
}

.order-app-header .header-left {
    flex-grow: 1; /* Allows it to take available space */
    display: flex;
    align-items: center;
    justify-content: flex-start; /* Align content to the left */
    gap: 15px; /* Space between logo and text */
}

.order-app-header .header-right {
    flex-basis: auto; /* Allow content to dictate width */
    display: flex;
    align-items: center;
    justify-content: flex-end; /* Align content to the right */
     padding-right: 5px; 
}

.order-app-header .header-text-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start; /* Align text to the left */
    justify-content: center;
    gap: 2px;
}

.order-app-header h1 {
    font-size: 1.4em; /* Smaller title for mobile app feel */
    font-weight: 600;
    margin: 0;
    color: #333;
}

.order-app-header .table-info {
    font-size: 1.1em; /* Reduced font size for table number */
    font-weight: bold; /* Made font bold */
    color: #e74c3c;
    margin: 0;
    white-space: nowrap; /* Prevent table info from wrapping */
}
/* Add this new rule */
.order-app-header .table-info .fas {
    margin-right: 5px; /* Adds space to the right of the icon */
    font-size: 1.2em; /* Adjust icon size relative to text if needed */
}

/* Removed back button as requested */
.order-app-header .back-button {
    display: none;
}

/* Store logo container in header */
.store-logo-container {
    height: 60px; /* Fixed height for consistency */
    width: 60px; /* Fixed width for a square logo */
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px; /* Slightly rounded corners */
    overflow: hidden; /* Ensures logo respects container boundaries */
    flex-shrink: 0; /* Prevents logo from shrinking on smaller screens */
    /* box-shadow: 0 2px 5px rgba(0,0,0,0.1); */
}

.store-logo {
    height: 100%;
    width: 100%;
    object-fit: contain; /* Scales logo to fit within its container */
}


/* Floating cart button */
.floating-cart-btn {
    position: fixed;
    bottom: 80px; /* Adjusted to be above the new bottom nav */
    right: 20px;
    width: 55px;
    height: 55px;
    border-radius: 50%;
    background-color: #e74c3c; /* Red color from sample */
    color: white;
    font-size: 1.5em;
    border: none;
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.25);
    display: flex; /* Ensure it's always flex for centering */
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    z-index: 100;
}

.floating-cart-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.cart-badge {
    position: absolute;
    top: 0px; /* Adjusted position */
    right: 0px; /* Adjusted position */
    background-color: #3498db; /* Blue for badge */
    color: white;
    font-size: 0.7em; /* Slightly larger for visibility */
    font-weight: 700;
    border-radius: 50%;
    padding: 3px 7px;
    min-width: 20px; /* Ensure it's circular */
    text-align: center;
    transform: translate(30%, -30%);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 15px; /* Reduced padding for mobile app feel */
    display: flex;
    flex-direction: column;
    gap: 20px; /* Reduced gap */
    position: relative;
    z-index: 10;
    padding-bottom: 90px; /* Space for fixed bottom navigation */
}

.card-section {
    background-color: #fff;
    padding: 25px;
    border-radius: 20px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}
.card-section.menu-section {
    margin-top: 0; /* No negative margin needed with new header */
    border-radius: 0; /* Remove border radius as it's not a separate card anymore */
    box-shadow: none; /* Remove box shadow */
    padding: 0; /* Remove padding */
}

.section-title {
    text-align: center; /* Aligned left as per sample */
    font-size: 1.8em;
    font-weight: 700;
    color: #333; /* Darker color for titles */
    margin-bottom: 20px;
    padding-bottom: 0; /* No border bottom */
    border-bottom: none;
}

.section-subtitle {
    text-align: center;
    font-size: 1.4em;
    font-weight: 600;
    color: #34495e;
    margin-top: 40px;
    margin-bottom: 20px;
}

.section-description {
    text-align: center;
    color: #6b7280;
    font-style: italic;
    margin-top: -15px;
    margin-bottom: 30px;
}

/* --- Forms & Inputs --- */
.form-card {
    display: flex;
    flex-direction: column;
    gap: 18px;
    max-width: 600px;
    margin: 0 auto;
}

label {
    font-weight: 600;
    color: #555;
    margin-bottom: 5px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
textarea,
select,
input[type="file"] {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #bdc3c7;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s ease;
}

input:focus, textarea:focus, select:focus {
    border-color: #3498db;
    box-shadow: 0 0 8px rgba(52, 152, 219, 0.3);
    outline: none;
}

.file-input-label {
    background-color: #ecf0f1;
    color: #34495e;
    padding: 12px 15px;
    border: 1px solid #bdc3c7;
    border-radius: 10px;
    cursor: pointer;
    font-size: 16px;
    text-align: center;
    transition: background-color 0.3s ease;
}

.file-input-label:hover {
    background-color: #e0e6ea;
}

input[type="file"] {
    display: none;
}

.image-preview {
    border: 2px dashed #bdc3c7;
    border-radius: 10px;
    padding: 10px;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f9f9f9;
}

.current-logo-img, .menu-item-preview-img {
    max-width: 100%;
    max-height: 150px;
    border-radius: 8px;
    object-fit: contain;
}

/* --- Buttons --- */
.primary-btn {
    background-color: #e74c3c; /* Red color for primary actions */
    color: white;
    padding: 14px 25px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: 700;
    transition: background-color 0.3s, transform 0.1s;
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.2); /* Red shadow */
}

.primary-btn:hover {
    background-color: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.3);
}

.secondary-btn {
    background-color: #95a5a6;
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: background-color 0.3s;
}

.secondary-btn:hover {
    background-color: #7f8c8d;
}

.full-width {
    width: 100%;
}


/* --- Grids (Menu, Tables, Orders) --- */
.menu-grid, .table-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    padding: 0 10px;
    display: grid;
}

.order-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.order-table-card {
    background-color: #fff;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, background-color 0.3s;
}
.order-table-card.new-order-highlight {
    background-color: #e6f7ff;
    border: 2px solid #3498db;
    animation: pulse-highlight 1.5s ease-out forwards;
}

@keyframes pulse-highlight {
    0% { transform: scale(1); box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08); }
    50% { transform: scale(1.02); box-shadow: 0 8px 25px rgba(52, 152, 219, 0.4); }
    100% { transform: scale(1); box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08); }
}

.order-table-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.table-info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.table-info-header h3 {
    margin: 0;
    font-size: 1.4em;
    color: #2980b9;
}

.pending-badge {
    background-color: #e74c3c;
    color: white;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 0.8em;
    font-weight: bold;
    min-width: 30px;
    text-align: center;
}

.view-table-orders-btn {
    margin-top: 15px;
    padding: 10px 15px;
    font-size: 0.9em;
}

/* --- Modals --- */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center; /* Changed to center */
    justify-content: center;
    padding: 10px;
}
.modal-content {
    background-color: #fefefe;
    padding: 20px;
    border: 1px solid #888;
    width: 90%;
    max-width: 600px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    margin-top: 80px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f2f5;
    margin-bottom: 15px;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5em;
    color: #e74c3c; /* Changed to your primary red color for "Your Order" title */
}

.close-button {
    color: #e74c3c; /* Your main red color */
    font-size: 1.8em; /* Keep this size, or adjust if needed */
    font-weight: 700; /* Changed to bold (700) for stronger presence */
    cursor: pointer;
    transition: color 0.2s, transform 0.1s;
    line-height: 1;
    padding: 5px;
    background: none;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    width: 30px;
    height: 30px;
}

.close-button:hover,
.close-button:focus {
    color: #c0392b; /* Darker red on hover/focus */
    transform: scale(1.05);
    outline: none;
}
.modal-body {
    flex-grow: 1;
    overflow-y: auto;
    padding-right: 5px;
    margin-right: -5px;
}

.modal-order-item {
    background-color: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.modal-order-item h4 {
    margin-top: 0;
    margin-bottom: 8px;
    color: #34495e;
    font-size: 1em;
    border-bottom: 1px dashed #e0e0e0;
    padding-bottom: 5px;
}

.modal-order-item ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.modal-order-item ul li {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
    font-size: 0.9em;
    color: #555;
}

.modal-item-img {
    width: 30px;
    height: 30px;
    object-fit: cover;
    border-radius: 5px;
    flex-shrink: 0;
}

.modal-order-actions {
    margin-top: 10px;
}

.order-status-select {
    width: 100%;
    padding: 8px;
    border-radius: 8px;
    border: 1px solid #bdc3c7;
    background-color: #fff;
    font-size: 0.9em;
    box-sizing: border-box;
}

.modal-total-price {
    font-size: 1.3em;
    font-weight: 700;
    text-align: center; /* Centered for column layout */
    color: #28a745;
    margin: 0;
    padding-bottom: 0;
}

/* --- Menu Item Card (Admin Dashboard) --- */
.menu-card {
    background-color: #fff;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    position: relative; 
}
.menu-card-image {
    width: 100%;
    aspect-ratio: 1 / 1;
    height: auto;
    object-fit: cover;
}
.menu-card-content {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex-grow: 1;
}

/* menu admin scroll bar */

.menu-card-content h3 {
    text-align: left;
    margin: 0;
    font-size: 1.1em;
    color: #2c3e50;
    font-weight: 700;
}
.menu-card-content p {
    margin: 0;
    color: #666;
    font-size: 0.85em;
}
.menu-card-content .price {
    font-weight: 700;
    color: #2980b9;
    font-size: 1em;
}
.menu-card-actions {
    display: flex;
    gap: 5px;
    margin-top: 8px;
    padding: 10px;
    border-top: 1px solid #f0f2f5;
}
.menu-card-actions button {
    flex: 1;
    padding: 6px;
    font-size: 0.9em;
}


/* --- Redesigned Menu Cards for the ORDER PAGE ONLY (Grid Layout) --- */
.order-container .menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); /* Two columns on mobile, adapts */
    gap: 15px; /* Spacing between cards */
    padding: 0;
    justify-content: center; /* Center items in the grid */
}

.order-container .menu-card {
    display: flex;
    flex-direction: column; /* Stack elements vertically */
    padding: 0; /* Remove padding from card itself */
    gap: 0;
    border-radius: 12px; /* Rounded corners for cards */
    overflow: hidden; /* Ensures image corners are rounded */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08); /* Soft shadow */
    background-color: #fff;
    position: relative;
    max-width: 250px; /* Limit max width for individual cards */
    width: 100%; /* Ensure it takes full width within its max-width */
}

.order-container .menu-card .menu-card-image-wrapper {
    width: 100%;
    /* Enforce 1:1 aspect ratio for images */
    aspect-ratio: 1 / 1; 
    height: auto; /* Let height be determined by aspect-ratio */
    overflow: hidden;
    position: relative; /* For best seller/out of stock tags */
    border-radius: 12px 12px 0 0; /* Rounded top corners */
}

.order-container .menu-card .menu-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px 12px 0 0; /* Rounded top corners */
}

.order-container .menu-card .menu-card-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 10px 12px; /* Padding inside content area */
    gap: 5px;
}

.order-container .menu-card .menu-card-content h3 {
    font-size: 1em;
    /* font-weight: bold; */
    color: #000000;
    margin: 0;
    white-space: normal;
    word-break: break-word;
}

.order-container .menu-card .description {
    font-size: 0.85em;
    color: #777;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Limit description to 2 lines */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.order-container .menu-card .price-and-add-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-top: 10px; /* Space between description and price/button */
}

.order-container .menu-card .price {
    font-size: 1.1em; /* Larger price */
    font-weight: 700;
    color: #e74c3c; /* Red price from sample */
    margin: 0;
}

.order-container .menu-card .add-to-order-btn {
    background-color: #e74c3c; /* Red add button */
    color: white;
    border: none;
    border-radius: 50%; /* Circular button */
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1 / 1; /* Ensures it's always a perfect square */
    font-size: 1.2em; /* Plus icon size */
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3);
    transition: transform 0.2s, background-color 0.2s;
}

.order-container .menu-card .add-to-order-btn:hover {
    background-color: #c0392b;
    transform: scale(1.05);
}

/* --- Table QR Code Card --- */
.table-card {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 15px;
    padding: 10px;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.08);
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.table-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.table-id-label {
    font-size: 1.2em;
    color: #34495e;
    font-weight: 700;
    margin: 0;
}

.qr-code-container {
    padding: 8px;
    background-color: #fff;
    border: 1px solid #bdc3c7;
    border-radius: 10px;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.05);
    display: inline-block;
}

.table-card-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    padding: 0 10px 10px;
}

.order-link-btn {
    background-color: #4caf50;
    color: white;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    width: 100%;
    padding: 8px;
    font-size: 0.9em;
}

.order-link-btn:hover {
    background-color: #45a049;
}

.delete-table-btn {
    background-color: #dc3545;
    width: 100%;
    padding: 8px;
    font-size: 0.9em;
}

.delete-table-btn:hover {
    background-color: #c82333;
}

.clear-table-btn {
    background-color: #f39c12;
    color: white;
    width: 100%;
    padding: 8px;
    font-size: 0.9em;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s;
}

.clear-table-btn:hover {
    background-color: #e67e22;
}


/* --- Orders Card (Admin) --- */
.order-card {
    background-color: #ecf0f1;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.order-card h3 {
    margin: 0;
    font-size: 1.6em;
    color: #2980b9;
    text-align: left;
}

.order-card p {
    margin: 0;
    color: #666;
}

.order-card ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.order-card ul li {
    background-color: #fff;
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 8px;
    border-left: 5px solid #3498db;
    font-size: 0.95em;
    font-weight: 600;
}

.order-card select {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #bdc3c7;
    background-color: #fff;
    font-size: 1em;
    box-sizing: border-box;
}

/* --- Category Buttons (Mobile App Look) --- */
.category-buttons {
    display: flex;
    flex-wrap: nowrap; /* Prevent wrapping */
    gap: 10px;
    justify-content: flex-start; /* Align to start */
    margin-bottom: 20px;
    padding: 0 5px 10px; /* Add some padding for scrollable area */
    overflow-x: auto; /* Enable horizontal scrolling */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    scrollbar-width: none; /* Hide scrollbar for Firefox */
    -ms-overflow-style: none;  /* Hide scrollbar for IE and Edge */
}

.category-buttons::-webkit-scrollbar {
    display: none; /* Hide scrollbar for Chrome, Safari, Opera */
}

.category-btn {
    background-color: #f0f0f0; /* Light grey background */
    color: #000000;
    border: 1px solid #ddd;
    padding: 8px 18px; /* Adjusted padding */
    border-radius: 20px; /* Pill-shaped buttons */
    font-weight: 500; /* Medium weight */
    transition: all 0.3s ease;
    flex-shrink: 0; /* Prevents buttons from shrinking */
    font-size: 1.2em;
}

.category-btn:hover {
    background-color: #e0e0e0;
}

.category-btn.active {
    background-color: #e74c3c; /* Red active state */
    color: white;
    border-color: #e74c3c;
}

/* --- Order Page Specific Styles --- */
.order-container {
    padding-bottom: 100px; /* Increased padding to accommodate bottom nav and ensure content is visible */
}

.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.6);
}

.modal-open {
    overflow: hidden; /* Prevents body scroll when modal is open */
}

.modal-drawer {
    padding-top: 0;
    align-items: center; /* Changed to center */
}

.modal-content-drawer {
    margin: 0;
    position: absolute;
    bottom: 0;
    right: 0;
    width: 100%;
    height: 85%;
    max-height: 90vh;
    background-color: #ffffff;
    border-radius: 25px 25px 0 0;
    animation-name: slideInUp;
    animation-duration: 0.4s;
    display: flex;
    flex-direction: column;
    box-shadow: 0 -5px 25px rgba(0, 0, 0, 0.15);
}

@keyframes slideInUp {
    from {bottom: -100%;}
    to {bottom: 0;}
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #f0f2f5;
    margin-bottom: 15px;
}

.modal-header .section-title {
    margin: 0;
    padding: 0;
    border-bottom: none;
    font-size: 1.8em;
    color: #e74c3c; /* Change to your primary red color */
}

.modal-body {
    flex-grow: 1;
    overflow-y: auto;
    padding: 15px 20px;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #f0f2f5;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column; /* Keep column for mobile by default */
    gap: 10px;
    align-items: center;
}


.close-button {
    color: #aaa;
    float: right;
    font-size: 2em;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}

.close-button:hover,
.close-button:focus {
    color: #555;
    text-decoration: none;
    cursor: pointer;
}

.order-total-summary { /* Changed from .modal-total-price */
    font-size: 1.3em;
    font-weight: 700;
    text-align: center; /* Centered for column layout */
    color: #e74c3c; /* Changed to your primary red color */
    margin: 0;
    padding-bottom: 0;
    width: 100%; /* Ensure it takes full width to center text */
}

.order-summary-list {
    list-style: none;
    padding: 0;
}

.order-summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px dashed #eee;
    gap: 15px;
}

.order-summary-item:last-child {
    border-bottom: none;
}

.order-summary-item .item-image-wrapper {
    width: 60px;
    height: 60px;
    min-width: 60px;
    overflow: hidden;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.order-summary-item .item-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
}

.order-summary-item .item-details {
    flex-grow: 1;
    display: flex;
    flex-direction: column; /* Stack item name, subtotal, and remark */
    align-items: flex-start;
}
.order-summary-item .item-name {
    font-weight: 600;
    color: #34495e;
    font-size: 1.1em;
}

.order-summary-item .item-subtotal {
    font-weight: bold;
    color: #3498db; /* Changed to blue */
    font-size: 1em;
}

.item-price-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: #ecf0f1;
    border-radius: 20px;
    padding: 5px;
    flex-shrink: 0;
}

.item-control-btn {
    background-color: white;
    color: #3498db;
    border: 1px solid #3498db;
    padding: 5px 10px;
    font-size: 1em;
    font-weight: bold;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, color 0.2s;
}

.item-control-btn.primary-btn {
    background-color: #e74c3c; /* Changed to your primary red color */
    color: white;
}

.item-control-btn.primary-btn:hover {
    background-color: #c0392b; /* Darker red on hover */
}
.item-control-btn.secondary-btn {
    background-color: white;
    color: #e74c3c; /* Changed to your primary red color */
    border: 1px solid #e74c3c; /* Changed to your primary red color */
}

.item-control-btn.secondary-btn:hover {
    background-color: #fcebeb; /* A very light red tint on hover */
}

.item-quantity {
    font-weight: 700;
    color: #2c3e50;
    min-width: 20px;
    text-align: center;
}

/* ADDED: Style for the remark input textarea in the order modal */
.item-remark-input {
    width: calc(100% - 10px); /* Adjust width to fit */
    margin-top: 8px; /* Space from price/name */
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.9em;
    resize: vertical; /* Allow vertical resizing */
    min-height: 40px; /* Minimum height */
    max-height: 100px; /* Maximum height */
    box-sizing: border-box; /* Include padding/border in width */
    font-family: "Battambang", cursive, sans-serif; /* Ensure font consistency */
}

.item-remark-input::placeholder {
    color: #999;
}

.item-remark-input:focus {
    border-color: #3498db;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.2);
}


/* Ensure images within cards are responsive */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* General improvements for readability and spacing */
p {
    margin-bottom: 1em;
}

ul {
    margin: 0;
    padding: 0;
}

li {
    list-style: none;
}


/* --- Confirmation Modal Styles --- */
.confirmation-content {
    text-align: center;
    padding: 40px 20px;
}

.confirmation-icon {
    font-size: 80px;
    color: #2ecc71;
    margin-bottom: 20px;
    animation: scaleIn 0.5s ease-out;
}

@keyframes scaleIn {
    from {
        transform: scale(0.5);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

#continueShoppingBtn {
    margin-top: 25px;
    width: 100%;
}

.modal-content.confirmation-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    max-width: 450px;
    margin: auto;
    height: auto;
}

.confirmation-content .close-button {
    display: none;
}

/* --- NEW: Tab Navigation Styles (Admin) --- */
.tab-navigation {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 25px;
    padding-bottom: 10px;
    justify-content: center;
}

.tab-btn {
    background-color: #ecf0f0; /* Light grey background */
    color: #34495e;
    border: 1px solid #bdc3c7;
    border-bottom: none;
    padding: 12px 25px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    transition: all 0.3s ease;
    flex-grow: 1;
    text-align: center;
    min-width: 120px;
}

.tab-btn:hover {
    background-color: #e0e6ea;
    color: #2c3e50;
}

.tab-btn.active {
    background-color: #ffffff;
    color: #2980b9;
    border-color: #e0e0e0;
    border-bottom: 2px solid #ffffff;
    position: relative;
    z-index: 1;
    transform: translateY(2px);
}

.tab-content {
    display: none;
    animation: fadeIn 0.5s ease-in-out;
    margin-top: -15px;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* --- Mobile-specific adjustments for tabs --- */
@media (max-width: 767px) {
    .tab-navigation {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 10px;
        justify-content: space-around;
        padding: 0 10px;
    }
    .tab-btn {
        width: calc(50% - 15px);
        border-radius: 8px;
        border-bottom: 1px solid #bdc3c7;
        transform: none;
        padding: 10px 15px;
        font-size: 0.9em;
    }
    .tab-btn.active {
        border: 1px solid #3498db;
        border-bottom: 1px solid #3498db;
        transform: none;
    }
    .tab-content.active {
        margin-top: 0;
    }
}


input[type="file"] {
    display: none;
}

/* --- New Order Alert Message --- */
.new-order-alert {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #2ecc71;
    color: white;
    padding: 15px 30px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    font-size: 1.2em;
    font-weight: bold;
    text-align: center;
    z-index: 2000;
    transition: all 0.5s ease-in-out;
    opacity: 0;
    visibility: hidden;
}

.new-order-alert.show {
    top: 50px;
    opacity: 1;
    visibility: visible;
}


/* --- Search Bar Style (Order Page) --- */
.search-container {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    padding: 8px 15px;
    border: 1px solid #eee;
}

.search-input {
    flex-grow: 1;
    border: none;
    padding: 8px 10px;
    font-size: 1em;
    background-color: transparent;
    outline: none;
}

.search-icon {
    color: #999;
    font-size: 1.2em;
    margin-right: 10px;
}


/* --- New Order Status Badges --- */
.status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: bold;
    color: white;
    text-transform: uppercase;
    text-align: center;
}

.status-badge.pending {
    background-color: #e74c3c;
}

.status-badge.confirmed {
    background-color: #3498db;
}

.status-badge.preparing {
    background-color: #f39c12;
}

.status-badge.ready {
    background-color: #2ecc71;
}

.status-badge.completed {
    background-color: #7f8c8d;
}

.status-badge.cancelled {
    background-color: #95a5a6;
}

/* --- Admin Dashboard Overview Cards --- */
.dashboard-overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.overview-card {
    background-color: #fff;
    padding: 25px;
    border-radius: 20px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.overview-card h3 {
    font-size: 1.2em;
    color: #7f8c8d;
    margin: 0 0 10px 0;
}

.overview-card .value {
    font-size: 2.5em;
    font-weight: 700;
    color: #34495e;
    margin: 0;
}

/* --- Best Seller Tag Design --- */
.best-seller-tag {
    position: absolute;
    top: 8px; /* Adjusted position */
    right: 8px; /* Adjusted position */
    background-color: #e74c3c;
    color: white;
    font-weight: bold;
    padding: 4px 8px; /* Smaller padding */
    border-radius: 5px;
    font-size: 0.7em; /* Smaller font size */
    text-transform: uppercase;
    z-index: 10;
    transform: rotate(5deg); /* Slight angle */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* --- Out of Stock Overlay Design --- */


.out-of-stock-tag {
    position: absolute; /* Positioned within the overlay */
    background-color: #7f8c8d;
    color: white;
    font-weight: bold;
    padding: 5px 4px;
    border-radius: 5px;
    font-size: 0.8em;
    text-transform: uppercase;
    z-index: 10;
    transform: rotate(5deg);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* --- Bottom Navigation Bar --- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: #fff;
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 65px; /* Height of the navigation bar */
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    padding-bottom: env(safe-area-inset-bottom); /* For iPhone notches */
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1; /* Distribute items evenly */
    text-decoration: none;
    color: #999; /* Inactive color */
    font-size: 0.75em; /* Smaller text */
    font-weight: 500;
    transition: color 0.2s;
    position: relative; /* For badge positioning */
}

.nav-item i {
    font-size: 1.4em; /* Icon size */
    margin-bottom: 3px;
}

.nav-item.active {
    color: #e74c3c; /* Active color from sample */
}

.nav-item:hover {
    color: #e74c3c;
}

.nav-item .cart-badge {
    top: 0;
    right: 50%; /* Center relative to parent */
    transform: translate(100%, -50%); /* Adjust to top-right of icon */
    background-color: #3498db; /* Blue badge */
    color: white;
    font-size: 0.6em;
    padding: 2px 5px;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Hide the floating cart button when the bottom nav cart button is active/visible */
#bottomNavCartBtn.active ~ #floatingCartBtn {
    display: none !important;
}

/* Ensure the floating cart button is hidden when the bottom nav is present */
.bottom-nav + #floatingCartBtn {
    display: none !important;
}

/* Show floating cart button only if bottom nav is not present or explicitly enabled */
body:not(:has(.bottom-nav)) #floatingCartBtn {
    display: flex !important;
}

/* --- Customer Order Tracking Styles --- */
.order-tracking-section {
    padding: 40px; /* Add padding to the section */
    background-color: #fff; /* White background for the section */
    border-radius: 12px; /* Rounded corners for the section */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08); /* Soft shadow */
    margin-top: 20px; /* Space from the menu section */
    display: flex; /* Ensure flex container */
    flex-direction: column; /* Stack children vertically */
    overflow: hidden; /* Hide overflow to prevent scrollbars from appearing on the section itself */
}

.customer-orders-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); /* Responsive grid */
    gap: 15px;
    padding: 0;
    margin-top: 20px;
    /* Add these properties to ensure it can contain the grand total and allow scrolling if needed */
    grid-auto-rows: minmax(min-content, max-content); /* Allow rows to size based on content */
    align-content: start; /* Align content to the start of the grid area */
    overflow-y: auto; /* Enable vertical scrolling if content overflows */
    max-height: calc(100vh - 350px); /* Adjust max-height as needed to ensure footer is visible */
    padding-bottom: 20px; /* Add some padding at the bottom of the grid */
}

.customer-order-card {
    background-color: #f9f9f9; /* Lighter background for individual order cards */
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border: 1px solid #eee; /* Light border */
}

.customer-order-card h4 {
    margin: 0;
    font-size: 1.1em;
    color: #333;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
    margin-bottom: 8px;
}

.customer-order-card .order-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9em;
    color: #777;
}

.customer-order-card .order-items-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.customer-order-card .order-items-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
    font-size: 0.9em;
    color: #555;
}

.customer-order-card .item-thumbnail {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 8px;
}

.customer-order-card .order-total {
    text-align: right;
    font-weight: bold;
    font-size: 1.1em;
    color: #e74c3c; /* Red color for total */
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #eee;
}

/* ADDED: Style for displaying remark in customer's placed orders */
.customer-order-card .item-remark-display {
    font-size: 0.85em;
    color: #666;
    margin-top: 4px;
    margin-bottom: 0;
    font-style: italic;
    padding-left: 4px; /* Indent slightly */
    border-left: 2px solid #ccc; /* Small visual cue */
}


/* Styles for the buttons in the order details modal footer */
#orderDetailsModal .modal-footer button {
    padding: 8px 15px; /* Smaller padding */
    font-size: 0.9em; /* Smaller font size */
}

/* Ensure they stack nicely on very small screens if needed */
@media (max-width: 480px) {
    #orderDetailsModal .modal-footer button {
        width: 100%; /* Make them full width on very small screens */
    }
}

/* Fix for section-title alignment in the confirmation modal */
.confirmation-content .section-title {
    text-align: center;
}

/* Style for the grand total in the customer orders section */
.grand-total-summary {
    text-align: right;
    font-weight: bold;
    font-size: 1.3em;
    color: #000000; /* Green color for grand total */
    margin-top: 20px;
    padding-top: 15px;
    border-top: 2px solid #eee; /* A more prominent border for the grand total */
}

/* --- Admin Dashboard Order Details Modal --- */
/* ADDED: Style for displaying remark in admin's order details modal */
.admin-item-remark {
    font-size: 0.85em;
    color: #666;
    margin-top: 4px;
    margin-bottom: 0;
    font-style: italic;
    padding-left: 4px; /* Indent slightly */
    border-left: 2px solid #ccc; /* Small visual cue */
}


/* ADDED: Container for remark display/input */
.item-remark-container {
    margin-top: 5px;
    width: 100%;
    position: relative; /* For potential absolute positioning of input */
    min-height: 25px; /* Ensure it takes up some space even when empty */
}

/* ADDED: Style for the "Add Remark" / "Remark: ..." display span */
.item-remark-display-toggle {
    display: block; /* Takes full width */
    font-size: 0.85em;
    color: #666;
    padding: 4px 7px;
    border: 1px dashed #ccc; /* Dashed border to indicate clickable */
    border-radius: 8px;
    cursor: pointer;
    background-color: #f8f8f8;
    transition: background-color 0.2s, border-color 0.2s;
    overflow: hidden; /* Hide overflow text */
    white-space: nowrap; /* Prevent wrapping */
    text-overflow: ellipsis; /* Add ellipsis for overflow */
}

.item-remark-display-toggle:hover {
    background-color: #f0f0f0;
    border-color: #999;
}

/* MODIFIED: Style for the remark input textarea in the order modal */
.item-remark-input {
    width: 100%; /* Take full width of container */
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.9em;
    resize: vertical; /* Allow vertical resizing */
    min-height: 40px; /* Minimum height when active */
    max-height: 100px; /* Maximum height */
    box-sizing: border-box; /* Include padding/border in width */
    font-family: "Battambang", cursive, sans-serif;
    position: absolute; /* Position over the display span */
    top: 0;
    left: 0;
    z-index: 1; /* Ensure it's above the span when visible */
}

.item-remark-input::placeholder {
    color: #999;
}

.item-remark-input:focus {
    border-color: #3498db;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.2);
}

/* Ensure the item-details section can properly contain the remark container */
.order-summary-item .item-details {
    flex-grow: 1;
    display: flex;
    flex-direction: column; /* Stack item name, subtotal, and remark */
    align-items: flex-start;
    position: relative; /* For positioning children */
}

/* --- Product Quick View Modal Styles --- */
.modal-content.product-quick-view-content {
    max-width: 450px; /* Max width for the quick view modal */
    padding: 20px;
    text-align: center;
}

.quick-view-body {
    padding: 15px 0; /* Adjust padding for content inside */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.quick-view-image-container {
    width: 100%;
    max-width: 250px; /* Max width for the image */
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.quick-view-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#quickViewItemName {
    font-size: 1.8em;
    font-weight: bold;
    color: #333;
    margin-top: 0;
    margin-bottom: 5px;
}

.quick-view-description {
    font-size: 1em;
    color: #555;
    margin-bottom: 15px;
    line-height: 1.5;
}

.quick-view-price-section {
    width: 100%;
    text-align: center;
    margin-bottom: 15px;
}

.quick-view-price {
    font-size: 1.6em;
    font-weight: 700;
    color: #e74c3c; /* Primary red color for price */
}

.quick-view-footer {
    padding-top: 15px;
    border-top: 1px solid #f0f2f5;
    margin-top: 15px;
}

/* Responsive adjustments for Quick View Modal */
@media (max-width: 767px) {
    .modal-content.product-quick-view-content {
        width: 95%; /* Adjust width for smaller screens */
        max-height: 90vh; /* Allow it to take more height */
    }
    .quick-view-image-container {
        max-width: 200px; /* Smaller image on mobile */
    }
    #quickViewItemName {
        font-size: 1.5em;
    }
    .quick-view-price {
        font-size: 1.4em;
    }
}


/* --- Reset Password Modal Styles --- */
#resetPasswordModal .modal-content {
    max-width: 450px; /* Smaller modal for password reset */
    padding: 30px;
}

#resetPasswordModal .modal-header {
    padding-bottom: 15px;
    margin-bottom: 20px;
}

#resetPasswordModal .form-card {
    gap: 15px; /* Spacing between form elements */
}

#resetPasswordModal label {
    margin-bottom: 0; /* Adjust label spacing */
}

#resetPasswordModal input[type="password"] {
    margin-bottom: 10px; /* Space between password fields */
}

#resetPasswordModal .message {
    margin-top: 15px;
}

/* Specific styling for the Reset Password button in admin table */
.reset-password-btn {
    background-color: #3498db; /* Blue color for reset password */
    color: white;
    padding: 8px 15px;
    border-radius: 8px;
    font-size: 0.9em;
    font-weight: 600;
    transition: background-color 0.2s;
    margin-right: 5px; /* Space between reset and delete */
}

.reset-password-btn:hover {
    background-color: #2980b9;
}

/* Ensure table actions have space for new button */
.styled-table .table-actions {
    display: flex;
    gap: 5px; /* Smaller gap between buttons */
    flex-wrap: wrap; /* Allow buttons to wrap on smaller screens */
    justify-content: flex-end; /* Align buttons to the right */
}

/* Adjust column width for actions if needed */
.styled-table th:nth-child(3),
.styled-table td:nth-child(3) {
    width: 200px; /* Adjust as needed to fit buttons */
    min-width: 180px; /* Ensure minimum width */
}

/* Responsive adjustments for table actions on very small screens */
@media (max-width: 480px) {
    .styled-table .table-actions {
        flex-direction: column; /* Stack buttons vertically */
        align-items: stretch; /* Make them full width */
        gap: 8px;
    }
    .styled-table th:nth-child(3),
    .styled-table td:nth-child(3) {
        width: auto; /* Allow width to be flexible */
        min-width: unset;
    }
}


/* ADDED: Specific styles for the password reset modal */
.modal-pw {
    /* Inherit common modal properties from .modal */
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.7);
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
    padding: 10px;
}

/* Keep the existing #resetPasswordModal .modal-content rule, but change its selector */
.modal-pw .modal-content { /* CHANGED: from #resetPasswordModal .modal-content */
    max-width: 450px;
    padding: 30px;
}

.modal-pw .modal-header { /* CHANGED: from #resetPasswordModal .modal-header */
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.modal-pw .form-card { /* CHANGED: from #resetPasswordModal .form-card */
    gap: 15px;
}

.modal-pw label { /* CHANGED: from #resetPasswordModal label */
    margin-bottom: 0;
}

.modal-pw input[type="password"] { /* CHANGED: from #resetPasswordModal input[type="password"] */
    margin-bottom: 10px;
}

.modal-pw .message { /* CHANGED: from #resetPasswordModal .message */
    margin-top: 15px;
}
