@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap');
:root {
    --primary: #4f46e5;
    /* Deep Indigo */
    --primary-light: #818cf8;
    --secondary: #64748b;
    --bg: #f9fafb;
    /* Lighter background */
    --surface: #ffffff;
    --card-hover: #f1f5f9;
    --text-heading: #111827;
    --text-body: #374151;
    --danger: #ef4444;
    --success: #10b981;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 10px rgba(0, 0, 0, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
}

body {
    background: var(--bg);
    color: var(--text-body);
    height: 100vh;
    overflow: hidden;
}

button,
a {
    cursor: pointer;
}


/* ======================================= */


/* GLOBAL LAYOUT & VISIBILITY MANAGEMENT   */


/* ======================================= */


/* View Containers (e.g., Login, App) */

.view {
    display: none;
    height: 100vh;
    width: 100%;
}

.view.active {
    /* Only login-view uses this centering style */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.btn-icon {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
    border-radius: 5px;
    box-shadow: 0;
}


/* Content within the App Container */

.view-content {
    display: none;
    /* Hide all content views by default */
    animation: fadeIn 0.3s ease-out;
    /* Ensure internal views fill the height of the main content area */
}

.view-content.active-content {
    display: block;
    /* Show only the active content view */
}


/* App Layout */

#app-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.app-header {
    background: var(--primary);
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    height: 50px;
    /* Fixed height */
    flex-shrink: 0;
}

#page-title {
    color: var(--surface);
    font-weight: 700;
    font-size: 18px;
}

#main-content {
    flex: 1;
    overflow-y: auto;
    /* Add padding for the mobile cart bar */
}


/* ======================================= */


/* COMPONENTS & STYLES                     */


/* ======================================= */

#dashboard-view,
#food-list,
#bills-list {
    padding: 0.8rem;
    margin-top: 0;
}


/* Utility & Forms */

.btn-primary,
.btn-secondary,
.btn-small {
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 500;
    color: #fff;
    transition: background 0.2s, transform 0.1s;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
    background: #4338ca;
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-secondary {
    background: var(--secondary);
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.85rem;
    border-radius: 6px;
}

.full-width {
    width: 100%;
}

input,
select {
    width: 100%;
    padding: 14px;
    margin: 10px 0;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: var(--surface);
    font-size: 0.8rem;
    color: var(--text-body);
}

input:focus,
select:focus {
    outline: 0;
}


/* Auth */

.auth-card {
    background: var(--surface);
    padding: 2.5rem 2rem;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    width: 90%;
    max-width: 400px;
    text-align: center;
}

.auth-card h1 {
    color: var(--primary);
    margin-bottom: 1.5rem;
}

.auth-card h3 {
    color: var(--text-heading);
    margin-bottom: 1rem;
}

.auth-card p {
    margin-top: 15px;
    color: var(--primary);
    cursor: pointer;
}

.auth-card button {
    width: 100%;
    margin: 15px 0;
}


/* Bottom Nav */

.bottom-nav {
    width: 100%;
    background: var(--surface);
    display: flex;
    justify-content: space-around;
    /* padding: 0.8rem 0; */
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.08);
    z-index: 900;
    height: 70px;
    /* Fixed height */
    flex-shrink: 0;
}

.nav-item {
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--secondary);
    font-size: 0.7rem;
    padding: 14px;
    border-radius: 8px;
    transition: background 0.2s;
    width: 100%;
    height: 100%;
}

.nav-item:hover {
    background: var(--card-hover);
}

.nav-item.active {
    color: var(--primary);
}

.material-icons-round {
    font-size: 24px;
    margin-bottom: 4px;
}


/* Floating Action Button */

.btn-fab {
    position: fixed;
    bottom: 95px;
    /* Above the bottom nav bar */
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    font-size: 24px;
    box-shadow: var(--shadow-md);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 950;
}


/* Modals */


/* Modal background */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: flex-end;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.25s ease;
}


/* When modal is open */

.modal.show {
    display: flex;
    opacity: 1;
}


/* Modal Content (Bottom Sheet) */

.modal-content {
    background: var(--surface);
    padding: 2rem;
    border-radius: 15px 15px 0 0;
    width: 100%;
    max-width: 100%;
    box-shadow: var(--shadow-md);
    /* Slide Animation */
    transform: translateY(100%);
    transition: transform 0.35s ease;
}


/* When Active → Slide Up */

.modal.show .modal-content {
    transform: translateY(0);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 1.5rem;
}


/* Toast Notification Styling */

.toast {
    visibility: hidden;
    min-width: 250px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 10px;
    padding: 16px;
    position: fixed;
    z-index: 2000;
    left: 50%;
    top: 20px;
    /* Adjusted to sit above the cart bar/nav bar */
    transform: translateX(-50%);
    font-size: 16px;
    opacity: 0;
    transition: opacity 0.3s, top 0.3s;
    box-shadow: var(--shadow-md);
}

.toast.show {
    visibility: visible;
    opacity: 1;
    top: 60px;
}


/* ======================================= */


/* DASHBOARD STYLES                        */


/* ======================================= */

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.25rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    padding: 1.5rem;
    border-radius: 15px;
    box-shadow: var(--shadow-md);
    color: white;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-3px);
}

.stat-card h3 {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
}

.stat-card p,
#range-earning {
    font-size: 1rem;
    font-weight: 700;
}


/* Gradient Modifiers */

.card-today {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    /* Green */
}

.card-month {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    /* Blue */
}

.card-total {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    /* Orange */
}

.card-bill {
    background: linear-gradient(135deg, #d4a404 0%, #c49703 100%);
    /* Orange */
}

.card-orders-today {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.card-orders-month {
    background: linear-gradient(135deg, #d4a404 0%, #c49703 100%);
}

.card-total-orders {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}


/* Date Filter Section */

.date-filter-group {
    display: flex;
    gap: 5px;
    margin-bottom: 1.5rem;
    margin-top: 0.5rem;
    background: var(--surface);
    padding: 10px;
    border-radius: 15px;
    box-shadow: var(--shadow-sm);
}

.date-input-wrapper {
    max-width: 40%;
}

.date-input-wrapper label {
    display: block;
    font-weight: 600;
    color: var(--text-body);
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.date-input-wrapper input {
    margin: 0;
    /* Remove default margin */
}

.date-filter-group .filter-btn {
    padding: 10px 13px;
    margin-top: 5px;
    font-size: 0.6rem;
}

.result-card {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: 15px;
    box-shadow: var(--shadow-md);
    border: 1px solid #e5e7eb;
}

.result-heading {
    color: var(--text-heading);
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.result-stat-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px dashed #e5e7eb;
    font-size: 1rem;
}

.result-stat-row span {
    color: var(--text-body);
}

.result-stat-row .range-value {
    font-weight: 700;
    color: var(--primary);
    font-size: 1.1rem;
}

#top-selling-list .cart-item {
    background: var(--card-hover);
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 5px;
    border-bottom: none;
}

#top-selling-list .cart-item strong {
    color: var(--primary);
}


/* List Groups (Used in Bills/Food Management) */

.list-group {
    margin-top: 1rem;
}

.list-item {
    background: var(--surface);
    padding: 1rem 1.2rem;
    margin-bottom: 10px;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    border: 1px solid #d9d6d6;
    border-left: 4px solid var(--primary);
    transition: background 0.1s;
}

.list-item:hover {
    background: var(--card-hover);
}


/* ======================================= */


/* POS STYLES (Mobile First)               */


/* ======================================= */

.m-0 {
    margin: 0;
}

.pos-layout-mobile {
    display: flex;
    flex-direction: column;
    background: var(--bg);
}

#pos-search-fixed {
    flex-shrink: 0;
    padding: 10px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    z-index: 10;
    position: sticky;
    top: 0;
}

.pos-menu-scroll {
    flex-grow: 1;
    overflow-y: auto;
    min-height: 0;
    padding: 0 5px 5px;
    max-height: calc(100vh - 274px);
}

.pos-menu {
    border-radius: 12px;
    padding: 10px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 4px;
    margin-top: 0.5rem;
}

.food-card {
    background: var(--surface);
    padding: 15px 10px;
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    border: 1px solid #e5e7eb;
    box-shadow: var(--shadow-sm);
    transition: transform 0.1s, box-shadow 0.1s, border-color 0.2s;
}

.food-card:active,
.food-card:hover,
.food-card:focus {
    transform: scale(0.95);
    background: var(--primary-light);
    border: 2px solid var(--primary);
    outline: 0;
}

.food-card:active strong,
.food-card:hover strong,
.food-card:focus strong {
    color: #fff;
}

.food-card:active span,
.food-card:hover span,
.food-card:focus span {
    color: #f4f3ff;
}

.food-card strong {
    color: var(--text-heading);
    font-size: 0.9rem;
}

.food-card span {
    font-size: 0.8rem;
    color: var(--secondary);
}


/* POS Cart Summary (for desktop layout) */

.pos-cart {
    padding: 1.5rem;
    border-radius: 15px;
    box-shadow: var(--shadow-md);
    background: var(--surface);
    margin-top: 1.5rem;
}

.pos-cart h3 {
    color: var(--text-heading);
    margin-bottom: 1rem;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px dashed #e5e7eb;
    font-size: 0.95rem;
}

.cart-summary {
    border-top: 1px solid #e5e7eb;
    padding-top: 1rem;
    margin-top: 1rem;
}

.cart-summary .row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.cart-summary .total span {
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--primary);
}


/* --- MOBILE CART FIXED BAR STYLES --- */

.cart-summary-mobile-bar {
    position: fixed;
    bottom: 70px;
    left: 0;
    width: 100%;
    background: var(--primary);
    color: white;
    padding: 13px 15px;
    z-index: 999;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    /* FIX: Force GPU rendering for smooth, live updates */
    transform: translateZ(0);
    animation: slideUp 0.3s ease-out forwards;
}

.cart-summary-text {
    display: flex;
    flex-direction: column;
    text-align: left;
    flex-grow: 1;
}

#mobile-cart-count {
    font-weight: 600;
    font-size: 1.1rem;
    /* Use a light secondary color for contrast against primary bg */
    color: var(--secondary-light, #a5b4fc);
}

.cart-view-label {
    font-size: 0.75rem;
    opacity: 0.8;
}

.cart-summary-action {
    display: flex;
    align-items: center;
    gap: 15px;
}

#mobile-cart-total {
    font-size: 1.3rem;
    font-weight: bold;
    color: white;
}

.checkout-btn {
    border: none;
    padding: 8px 12px;
    background: var(--surface);
    /* White background */
    color: var(--primary);
    /* Primary text color */
    border-radius: 6px;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}


/* ======================================= */


/* MEDIA QUERIES (DESKTOP)                 */


/* ======================================= */

@media (min-width: 768px) {
    /* Main Content Width */
    #main-content {
        width: 100%;
        max-width: 1200px;
        margin: 0 auto;
    }
    /* Dashboard Layout */
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .pos-menu-scroll {
        flex: 3;
        /* 70% equivalent */
        overflow-y: auto;
        padding: 10px;
        order: 1;
        /* Puts menu first */
    }
    .pos-cart {
        flex: 1.5;
        display: flex;
        flex-direction: column;
        margin-top: 0;
    }
    #cart-items {
        flex: 1;
        overflow-y: auto;
    }
    .app-header {
        position: sticky;
        top: 0;
        z-index: 500;
    }
    .btn-fab {
        bottom: 20px;
        /* FAB moves to standard bottom-right */
    }
}


/* ======================================= */


/* ANIMATIONS                              */


/* ======================================= */

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}


/* Add to your style.css */


/* --- REPORTS FILTER REDESIGN --- */

.report-filters {
    display: flex;
    /* Arrange groups side-by-side or stack on mobile */
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 10px;
    padding: 20px;
    background: var(--surface);
    border-radius: 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.filter-group {
    flex: 1 1 300px;
}

.filter-group h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: var(--primary);
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 5px;
}

.filter-actions {
    display: flex;
    flex-direction: column;
    padding: 5px;
    align-content: space-between;
    justify-content: space-between;
    flex-flow: row wrap;
    gap: 5px;
}

.col {
    width: 48%;
}


/* Specific styling for date range inputs */

.date-range-group .filter-actions {
    flex-wrap: wrap;
}

.date-range-group label {
    font-weight: 600;
    color: var(--text);
}

.date-range-group input[type="date"] {
    padding: 8px;
    border: 1px solid var(--secondary);
    border-radius: 4px;
    flex-grow: 1;
    /* Make inputs take available space */
    min-width: 100px;
}


/* Ensure buttons use small text in this container */

.report-btn {
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 500;
    color: #fff;
    background: #4b5563;
    transition: background 0.2s, transform 0.1s;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
}

.report-btn.active {
    background: var(--primary);
}

.filter-actions button {
    padding: 12px 15px;
    width: 49%;
}

.search-bar {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    padding: 0 0.8rem;
    background: #efefef;
}


/* Tablet/Desktop: Ensures date range fields are laid out horizontally */

@media (min-width: 768px) {
    .date-range-group .filter-actions {
        flex-wrap: nowrap;
    }
}

.report-card {
    background: var(--surface);
    padding: 20px;
    border-radius: 0;
    width: 100%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.summary-item {
    padding: 15px;
    background: var(--bg);
    border-radius: 8px;
    text-align: center;
    font-size: 0.9em;
}

.list-container {
    margin-top: 10px;
    /* border: 1px solid #e2e8f0; */
    /* border-radius: 8px; */
}

#login-view,
#main-content {
    background: #efefef !important;
}

.conirmmodal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.confirmmodal-content {
    background: white;
    padding: 20px;
    width: 300px;
    border-radius: 12px;
    text-align: center;
    animation: popup 0.3s ease;
}

@keyframes popup {
    from {
        transform: scale(0.6);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.cbtn {
    padding: 8px 16px;
    margin: 10px;
    border-radius: 6px;
    cursor: pointer;
    border: none;
}

.yes {
    background: #ff4444;
    color: white;
}

.no {
    background: #ccc;
}

.backup-section {
    padding: 20px;
}

.section-title {
    font-size: 22px;
    margin-bottom: 20px;
    font-weight: 700;
    text-align: center;
}


/* Cards */

.backup-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.backup-card h3 {
    margin: 0 0 10px;
    font-size: 18px;
    font-weight: 600;
}

.backup-card p {
    font-size: 14px;
    color: #555;
    margin-bottom: 15px;
}


/* Buttons */

.primary-btn {
    background: #007bff;
    border: none;
    padding: 10px 18px;
    color: #fff;
    border-radius: 8px;
    font-size: 15px;
    cursor: pointer;
    width: 100%;
    font-weight: 600;
}

.primary-btn:hover {
    background: #0056cc;
}


/* File Upload Button */

.file-upload {
    display: inline-block;
    width: 100%;
    background: #ff9900;
    color: #fff;
    padding: 10px 18px;
    border-radius: 8px;
    text-align: center;
    font-size: 15px;
    cursor: pointer;
    font-weight: 600;
}

.file-upload input {
    display: none;
}

.file-upload:hover {
    background: #e68800;
}

.bno {
    color: var(--primary);
    display: block;
    width: 100%;
}

.cname {
    display: block;
    width: 100%;
    color: var(--text-heading);
}

#bill-modal-title {
    color: var(--primary);
    margin-bottom: 9px;
}

.modal-content p {
    font-size: 14px;
}

hr {
    margin: 10px 0;
}

.report-card h3 {
    font-size: 16px;
}