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

:root {
    --primary-color: #0b7c3c;
    --primary-dark: #09612f;
    --bg-color: #f6f8f9;
    --app-bg: #FAFAFA;
    --text-main: #1d1d1f;
    --text-muted: #6e6e73;
    --border-color: #e5e5e5;
    --success-color: #34c759;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    height: 100dvh;
    overflow: hidden;
}

/* Mobile container wrapper for desktop view */
.app-container {
    width: 100%;
    max-width: 900px;
    /* Better constrained width for desktop */
    background-color: var(--app-bg);
    height: 100dvh;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    position: relative;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
    -ms-overflow-style: none;
    /* IE and Edge */
    scrollbar-width: none;
    /* Firefox */
}

.app-container::-webkit-scrollbar {
    display: none;
    /* Chrome, Safari and Opera */
}

/* Responsive Grid Layouts */
@media (min-width: 768px) {
    body {
        background-image: url('../images/bg.png');
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
        background-attachment: fixed;
    }

    #productContainer {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }

    .product-card {
        margin: 0 !important;
        height: 100%;
    }

    .cart-items-wrapper,
    .bill-details,
    .summary-card,
    .details-section,
    .checkbox-group,
    .order-card {
        max-width: 600px;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    .menu-header-extended,
    .header {
        padding-left: 30px;
        padding-right: 30px;
    }

    .bottom-action-bar {
        display: flex;
        gap: 20px;
        justify-content: center;
        padding: 16px 30px;
    }

    .bottom-action-bar>* {
        flex: 1;
        max-width: 250px;
        margin-bottom: 0 !important;
    }

    .order-success-container {
        max-width: 600px;
        margin: 0 auto;
    }

    .cart-floating-bar {
        width: 100%;
        max-width: 400px;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    .bottom-nav {
        justify-content: center;
        gap: 80px;
    }
}

/* Common Header */
.header {
    display: flex;
    align-items: center;
    padding: 20px;
    background-color: var(--app-bg);
    position: sticky;
    top: 0;
    z-index: 10;
    justify-content: space-between;
    border-bottom: 1px solid #e2e8f0;
    box-shadow: none;
}

.header.green-bg {
    background-color: var(--primary-color);
    color: white;
}

.header .back-btn {
    font-size: 20px;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.header h1 {
    font-size: 18px;
    font-weight: 600;
    flex-grow: 1;
    text-align: center;
}

.header .icon-btn {
    background: none;
    border: none;
    color: inherit;
    font-size: 20px;
    cursor: pointer;
}

/* Common Button */
.btn-primary {
    display: block;
    width: 100%;
    padding: 16px;
    background-color: var(--primary-color);
    color: white;
    text-align: center;
    border-radius: 12px;
    font-weight: 600;
    font-size: 16px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s;
}

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

.bottom-action-bar {
    padding: 16px;
    /* background: rgba(255, 255, 255, 0.85); */
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    position: sticky;
    bottom: 0;
    z-index: 50;
    width: 100%;
    margin: 40px 0 0 0;
    border-radius: 0;
}

/* Typography Helpers */
.text-muted {
    color: var(--text-muted);
}

.font-medium {
    font-weight: 500;
}

.font-semibold {
    font-weight: 600;
}

.font-bold {
    font-weight: 700;
}

.text-center {
    text-align: center;
}

.text-sm {
    font-size: 14px;
}

.text-xs {
    font-size: 12px;
}

/* Flex Helpers */
.d-flex {
    display: flex;
}

.align-items-center {
    align-items: center;
}

.justify-content-between {
    justify-content: space-between;
}

.gap-10 {
    gap: 10px;
}

.gap-15 {
    gap: 15px;
}

.gap-20 {
    gap: 20px;
}

/* Image classes */
.img-fluid {
    max-width: 100%;
    height: auto;
}

/* Cards & Containers */
.p-20 {
    padding: 20px;
}

.m-b-20 {
    margin-bottom: 20px;
}

.m-t-20 {
    margin-top: 20px;
}

.m-b-10 {
    margin-bottom: 10px;
}

/* Bottom Nav */
.bottom-nav {
    display: flex;
    justify-content: space-around;
    padding: 12px 0;
    background: var(--app-bg);
    border-top: 1px solid var(--border-color);
    position: sticky;
    bottom: 0;
    z-index: 10;
    margin-top: auto;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 12px;
    gap: 4px;
}

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

.nav-item svg {
    width: 24px;
    height: 24px;
    /* Removed fill: currentColor to allow inline fill/stroke to work properly */
}

/* Cart Animation */
.flying-img {
    position: fixed;
    z-index: 9999;
    border-radius: 8px;
    object-fit: cover;
    transition: all 0.6s cubic-bezier(0.25, 1, 0.5, 1);
    pointer-events: none;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.cart-bump {
    animation: cartBump 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes cartBump {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

/* Input Fields */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--text-main);
}

.form-control {
    width: 100%;
    padding: 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: inherit;
    font-size: 15px;
    outline: none;
}

.form-control:focus {
    border-color: var(--primary-color);
}

/* Quantity Selector */
.qty-selector {
    display: inline-flex;
    align-items: center;
    background: #f3f4f6;
    border-radius: 24px;
    padding: 4px;
    border: none;
}

.qty-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: none;
    border-radius: 50%;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: transform 0.1s;
}

.qty-btn.minus {
    color: #ef4444;
    /* red for minus/trash */
}

.qty-btn.plus {
    color: var(--primary-color);
    /* green for plus */
}

.qty-btn:active {
    transform: scale(0.9);
}

.qty-val {
    width: 32px;
    text-align: center;
    font-weight: 700;
    font-size: 15px;
    color: #111827;
}

/* Unified 3-Tab Bottom Navigation */
.grocery-bottom-nav {
    position: sticky;
    bottom: 0;
    margin: 0;
    width: 100%;
    background: #ffffff;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    display: flex;
    justify-content: space-between !important;
    align-items: center;
    padding: 8px 0px;
    box-shadow: 0 -4px 32px rgba(0, 0, 0, 0.05);
    z-index: 50;
    border-top: 1px solid #f1f5f9;
    border-radius: 0;
}

.grocery-app-container .grocery-bottom-nav {
    margin: auto -16px 0 -16px;
    width: calc(100% + 32px);
}

@media (min-width: 768px) {
    .grocery-bottom-nav {
        justify-content: center;
        gap: 120px;
    }
}

.g-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: #9ca3af;
    text-decoration: none;
    font-size: 11px;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    min-width: 90px;
    padding: 6px 24px;
    border-radius: 20px;
}

.g-nav-item:hover {
    color: var(--text-main);
}

.g-nav-item svg {
    width: 20px;
    height: 20px;
    stroke-width: 2;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.g-nav-item span {
    font-size: 11px;
    font-weight: 600;
    transition: opacity 0.3s, transform 0.3s;
}

.g-nav-item.active {
    color: var(--primary-color);
    background: transparent;
    box-shadow: none;
}

.g-nav-item.active svg {
    stroke-width: 2.5;
    transform: translateY(-2px);
}

.g-nav-item.active span {
    font-weight: 700;
}

.g-nav-item .badge {
    position: absolute;
    top: 0;
    right: calc(50% - 20px);
    background: #ef4444;
    color: white;
    font-size: 10px;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 12px;
    border: 2px solid white;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    box-shadow: 0 2px 5px rgba(239, 68, 68, 0.4);
    z-index: 10;
}