/* =========================================================
   Longhin PWA — styles.css
   ========================================================= */

/* ---------- Design tokens / small overrides ---------- */
:root {
    --app-surface: rgba(255, 255, 255, 0.92);
    --app-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
    --app-border: 1px solid rgba(0, 0, 0, 0.08);

    /* Background via JS: applyCategoryBackground() */
    --category-bg: none;

    /* Layout heights */
    --mobile-bottom-nav-h: 64px;
}

/* ---------- Base ---------- */
body {
    background-color: #f8f9fa;
    background-image: var(--category-bg);
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
}

/* Give app content readability on top of background */
main {
    background-color: var(--app-surface);
    border-radius: 0.5rem;
    padding: 1rem;
}

footer {
    background: #ffffff;
}

/* Improve tap targets on mobile (keep it minimal) */
.form-select {
    min-height: 40px;
}

.card .btn {
    min-height: 42px;
}

/* ---------- Product / Cart visuals ---------- */
.product-img {
    height: 190px;
    object-fit: cover;
}

.cart-thumb {
    width: 42px;
    height: 42px;
    object-fit: cover;
}

.cart-count-badge {
    font-size: 0.95rem;
    background-color: var(--bs-warning);
    color: var(--bs-dark);
}

/* ---------- Desktop filter ---------- */
.category-select-desktop {
    width: 260px;
}

/* ---------- Mobile filter bar ---------- */
#mobileFilterBar {
    position: sticky;
    top: 0;
    z-index: 1020;
}

/* ---------- Mobile bottom navigation ---------- */
.mobile-bottom-nav {
    position: fixed;
    inset: auto 0 0 0;
    height: var(--mobile-bottom-nav-h);
    background: #ffffff;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    display: grid;
    grid-template-columns: 1fr 1fr;
    z-index: 1030;
}

.mobile-nav-item {
    position: relative;
    text-decoration: none;
    color: #6c757d;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-weight: 600;
}

.mobile-nav-item.active {
    color: var(--bs-success);
}

.mobile-nav-item.active::after {
    content: "";
    position: absolute;
    inset: 0;
    margin: auto;
    width: 64px;
    height: 44px;
    border-radius: 999px;
    background: var(--bs-secondary);
    opacity: 0.10;
    z-index: -1;
}

.mobile-nav-icon {
    font-size: 20px;
    line-height: 1;
}

.mobile-nav-label {
    font-size: 12px;
}

/* Badge position near cart icon */
.badge-wrapper {
    position: absolute;
    top: 0;
    right: 50%;
}

.mobile-nav-badge {
    position: absolute;
    top: 4px;
    left: 15px;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
}

/* ---------- Update toast ---------- */
.app-toast-container {
    position: fixed;
    right: 0;
    bottom: 0;
    z-index: 2000;
    /* above bottom nav */
}

.app-update-toast {
    width: min(360px, calc(100vw - 2rem));
    box-shadow: var(--app-shadow);
    border: var(--app-border);
}

/* ---------- Responsive adjustments ---------- */
@media (max-width: 991.98px) {

    /* prevent content hidden behind bottom nav */
    #appMain {
        padding-bottom: calc(var(--mobile-bottom-nav-h) + 20px);
    }

    footer {
        margin-bottom: var(--mobile-bottom-nav-h);
    }

    /* lift toast above bottom nav */
    .app-toast-container {
        bottom: calc(var(--mobile-bottom-nav-h) + 8px);
    }
}


/* =========================================================
   Cart items component: row (md+) + card (mobile)
   ========================================================= */

.cart-header,
.cart-row {
    display: grid;
    grid-template-columns: 44px 1fr 120px 70px 120px 72px;
    gap: 10px;
    align-items: center;
}

.cart-header {
    padding: 0.35rem 0.25rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.cart-row {
    padding: 0.55rem 0.25rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.cart-row-product {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.cart-row-product span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Mobile card meta grid */
.cart-card-title {
    line-height: 1.15;
}

.cart-card-meta {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
}

.cart-meta-chip {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 12px;
    padding: 6px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

@media (max-width: 360px) {
    .cart-card-meta {
        grid-template-columns: 1fr;
    }
}