/* FONT IMPORTS */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700&display=swap');

/* VARIABLES & RESET */
:root {
    --primary-orange: #FF6600;
    --primary-green: #009900;
    --light-pink: #FFC0CB;
    --dark-text: #333;
    --light-text: #777;
    --background-color: #f4f4f4;
    --white-color: #fff;
    --border-color: #eee;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--background-color);
    color: var(--dark-text);
    font-size: 14px;
    line-height: 1.5;
    /* Add padding to prevent content from being hidden by fixed navs */
    padding-top: 105px;
    /* Adjusted to match exact header height */
    padding-bottom: 80px;
    /* Adjusted for bottom nav height */
    transition: background-color 0.3s ease, color 0.3s ease;
}

a {
    text-decoration: none;
    color: inherit;
}

img {
    max-width: 100%;
    height: auto;
}

/* ================= HEADER STYLES ================= */
.header {
    background-color: var(--white-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    padding: 0.5rem 1rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    transition: background-color 0.3s ease;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 50px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
    /* Space between Menu Icon & Logo */
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
    /* Space between Dark Toggle & Cart */
}

.header-logo {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--dark-text);
    white-space: nowrap;
    margin: 0;
    padding: 0;
}

/* Menu Icon Size */
.header-left i {
    font-size: 1.2rem;
    cursor: pointer;
}

/* Dark Mode Toggle Style */
#dark-mode-toggle {
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--dark-text);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: transparent;
    background: transparent;
    border: none;
}

/* Desktop Navigation */
.desktop-nav {
    display: none;
    /* Hidden on mobile */
}

@media (min-width: 1024px) {
    #menu-btn {
        display: none;
        /* Hide mobile menu button on desktop */
    }

    .desktop-nav {
        display: flex;
        align-items: center;
        gap: 20px;
        margin: 0 20px;
    }

    .desktop-nav a {
        color: var(--dark-text);
        font-weight: 500;
        font-size: 1rem;
        transition: color 0.2s ease;
    }

    .desktop-nav a:hover {
        color: var(--primary-orange);
    }
}

/* Cart Icon Style */
.cart-icon {
    position: relative;
    font-size: 1.2rem;
    cursor: pointer;
}

.cart-badge {
    position: absolute;
    top: -8px;
    right: -10px;
    background-color: var(--primary-orange);
    color: var(--white-color);
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Search Bar Style */
.header-search {
    display: flex;
    margin-top: 0.8rem;
    margin-bottom: 0;
    /* Removed bottom margin to close gap with banner */
}

.header-search input {
    width: 100%;
    border: 1px solid var(--border-color);
    padding: 0.7rem;
    border-radius: 5px 0 0 5px;
    font-size: 1rem;
    outline: none;
    background-color: var(--white-color);
    color: var(--dark-text);
}

.header-search .search-btn {
    background-color: var(--primary-orange);
    color: var(--white-color);
    border: none;
    padding: 0 1.2rem;
    cursor: pointer;
    border-radius: 0 5px 5px 0;
    font-size: 1rem;
}

/* ================= DARK MODE STYLES ================= */
body.dark-mode {
    --background-color: #1a1a1a;
    --white-color: #2c2c2c;
    --dark-text: #f0f0f0;
    --light-text: #bbb;
    --border-color: #444;
}

/* Toggle Logic */
#dark-mode-toggle .fa-sun {
    display: none;
}

body.dark-mode #dark-mode-toggle .fa-moon {
    display: none;
}

body.dark-mode #dark-mode-toggle .fa-sun {
    display: block;
    color: #FFD700;
    /* Sun Color */
}

/* ================= MAIN CONTENT ================= */
.main-content {
    padding: 0 15px;
}

.section-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    margin-top: 1.5rem;
}

/* ================= BOTTOM NAVIGATION ================= */
.bottom-nav {
    display: none !important;
    /* display: flex; */
    /* justify-content: space-around; */
    /* Equal spacing */
    /* align-items: center; */
    /* position: fixed; */
    /* bottom: 0; */
    /* left: 0; */
    /* right: 0; */
    /* height: 65px; */
    /* background-color: var(--white-color); */
    /* box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1); */
    /* z-index: 1000; */
    /* padding-bottom: 5px; */
    /* Safe area for modern phones */
    /* transition: background-color 0.3s ease; */
}

/* Dark Mode for SweetAlert2 */
body.dark-mode .swal2-popup {
    background-color: #1f1f1f !important;
    color: #fff !important;
}

body.dark-mode .swal2-title,
body.dark-mode .swal2-content,
body.dark-mode .swal2-html-container {
    color: #fff !important;
}

body.dark-mode .swal2-icon.swal2-warning {
    border-color: #f8bb86;
    color: #f8bb86;
}

/* Ensure buttons are legible */
body.dark-mode .swal2-confirm,
body.dark-mode .swal2-cancel {
    box-shadow: none !important;
}

@media (min-width: 768px) {
    .bottom-nav {
        display: none !important;
    }
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--light-text);
    font-size: 0.75rem;
    text-decoration: none;
    flex: 1;
    /* Ensures equal width for all items */
    padding: 5px 0;
}

.nav-item i {
    font-size: 1.4rem;
    margin-bottom: 4px;
}

.nav-item.active {
    color: var(--primary-orange);
}

/* FLOATING HOME BUTTON */
.home-button {
    position: relative;
    width: 65px;
    height: 65px;
    background-color: var(--primary-orange);
    border-radius: 50%;
    color: var(--white-color);
    display: flex;
    justify-content: center;
    align-items: center;
    transform: translateY(-28px);
    /* Lifts the button */
    border: 6px solid var(--background-color);
    /* Matches body background */
    box-shadow: 0 -3px 8px rgba(0, 0, 0, 0.15);
    transition: border-color 0.3s ease;
    /* Smooth transition for dark mode */
}

.home-button i {
    font-size: 1.8rem;
    margin: 0;
}

/* ================= GENERAL BUTTONS ================= */
.confirm-order-btn,
.btn-order-green {
    display: block;
    width: 100%;
    background-color: var(--primary-green);
    color: var(--white-color);
    text-align: center;
    padding: 0.8rem;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 0.5rem;
}

/* ================= SIDE NAVIGATION & OVERLAY ================= */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1100;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

.side-nav {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100%;
    background-color: var(--white-color);
    z-index: 1200;
    transition: left 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
}

.side-nav.active {
    left: 0;
}

.side-nav-header {
    display: flex;
    align-items: center;
    padding: 1rem 15px;
    border-bottom: 1px solid var(--border-color);
}

.side-nav-logo {
    font-size: 1.5rem;
    font-weight: 700;
    flex-grow: 1;
    color: var(--dark-text);
    /* Fix: Use Flexbox for alignment */
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.side-nav-header .close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--dark-text);
    cursor: pointer;
    margin-left: 1rem;
}

.side-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
    flex-grow: 1;
    overflow-y: auto;
}

.side-nav-list li a {
    display: flex;
    align-items: center;
    padding: 15px;
    font-size: 16px;
    color: var(--dark-text);
    text-decoration: none;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid var(--border-color);
}

.side-nav-list li a:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.side-nav-list li a i {
    margin-right: 15px;
    width: 25px;
    text-align: center;
    color: var(--light-text);
}

/* Submenu Styles */
.submenu-toggle {
    position: relative;
}

.has-submenu>.submenu-toggle::after {
    content: '\f078';
    /* FontAwesome chevron-down */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    transition: transform 0.3s ease;
}

.has-submenu.active>.submenu-toggle::after {
    transform: translateY(-50%) rotate(180deg);
}

.submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    background-color: rgba(0, 0, 0, 0.03);
    display: none;
}

.submenu li a {
    padding-left: 55px;
    font-size: 14px;
    border-bottom: none;
}

/* ================= CART MODAL STYLES ================= */
.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);
    backdrop-filter: blur(2px);
}

.modal-content {
    background-color: var(--white-color);
    margin: 15% auto;
    padding: 20px;
    border: 1px solid var(--border-color);
    width: 90%;
    max-width: 500px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    color: var(--dark-text);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    margin: 0;
    font-size: 1.3rem;
}

.close-modal-btn {
    color: var(--light-text);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close-modal-btn:hover {
    color: var(--primary-orange);
}

.modal-body {
    padding: 20px 0;
    text-align: center;
}

.modal-footer {
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.remove-item-btn {
    background: transparent;
    border: none;
    color: #ff4444;
    font-size: 18px;
    cursor: pointer;
}

/* ================= TOAST NOTIFICATION STYLES ================= */
.toast-notification {
    position: fixed;
    bottom: 80px;
    /* Above the bottom navigation */
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 20px;
    border-radius: 5px;
    font-size: 1rem;
    z-index: 3000;
    /* Ensure it's above other elements */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast-notification.show {
    opacity: 1;
    visibility: visible;
}

.toast-notification i {
    color: var(--primary-green);
    font-size: 1.2rem;
}

/* ================= PRODUCT GRID STYLES ================= */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    padding: 10px 0;
}

.product-card {
    background: var(--white-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.product-card img.product-img {
    width: 100%;
    height: 200px;
    /* Fixed height for uniformity */
    object-fit: contain;
    /* Ensures image isn't cropped; use 'cover' if cropping is preferred */
    border-radius: 5px;
    margin-bottom: 10px;
    background-color: #f9f9f9;
    /* Light background for transparent images */
}

.product-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.product-info h4 {
    font-size: 14px;
    margin: 5px 0;
    color: var(--dark-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.price {
    margin: 5px 0 10px 0;
    font-size: 14px;
}

.new-price {
    color: var(--primary-orange);
    font-weight: bold;
    font-size: 16px;
}

/* Responsive adjustments for very small screens */
@media (max-width: 480px) {
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }

    .product-card img.product-img {
        height: 150px;
    }
}

/* ================= STATUS COLORS ================= */
.status-delivered {
    color: #007BFF !important;
    /* Bright Blue */
}

.status-cancelled {
    color: #DC3545 !important;


}


/* ================= STATUS BACKGROUNDS (User Request) ================= */
.status-bg-delivered {
    background-color: #4169E1 !important;
    /* Royal Blue */
    color: #000000 !important;
    /* Force Black Text */
}

.status-bg-delivered h3,
.status-bg-delivered p,
.status-bg-delivered span,
.status-bg-delivered strong,
.status-bg-delivered div,
.status-bg-delivered i,
.status-bg-delivered select {
    color: #000000 !important;
}

.status-bg-cancelled {
    background-color: #FFCC00 !important;
    /* Deep Yellow */
    color: #000000 !important;
    /* Force Black Text */
}

.status-bg-cancelled h3,
.status-bg-cancelled p,
.status-bg-cancelled span,
.status-bg-cancelled strong,
.status-bg-cancelled div,
.status-bg-cancelled i,
.status-bg-cancelled select {
    color: #000000 !important;
}

/* Fix: Ensure SweetAlert is always on top of custom modals (z-index 2000) */
div:where(.swal2-container) {
    z-index: 3000 !important;
}

/* Fix: Ensure 'No Products Found' spans full width in grid */
.no-results-wrapper {
    grid-column: 1 / -1;
    width: 100%;
}