/* ── CATEGORY PAGE (Blinkit style) ── */
/* Manrope everywhere within this page */
#cat-page,
#cat-page * {
    font-family: 'Manrope', system-ui, -apple-system, sans-serif;
}

#cat-page {
    position: fixed;
    inset: 0;
    background: #fff;
    display: flex;
    flex-direction: column;
    z-index: 10;
    transition: opacity .18s ease;
}

#cat-page.catp-fade-out {
    opacity: 0;
}

.catp-topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid #f0f2f5;
    flex-shrink: 0;
}

.catp-back {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f4f4f5;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.catp-title-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.catp-icon {
    display: none; /* This hides the emoji entirely */
    font-size: 20px;
    flex-shrink: 0;
}

.catp-title-wrap h1 {
    font-size: 17px;
    font-weight: 800;
    color: #111;
    font-family: Manrope, sans-serif;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* right-side icon group: search + share */
.catp-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.catp-search-btn,
.catp-share-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f4f4f5;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    color: #374151;
}

/* Filters */
.catp-filters {
    display: flex;
    gap: 8px;
    padding: 10px 14px;
    overflow-x: auto;
    flex-shrink: 0;
    border-bottom: 1px solid #f0f2f5;
    scrollbar-width: none;
}

.catp-filters::-webkit-scrollbar {
    display: none;
}

.catp-filter-btn {
    padding: 7px 12px;
    border-radius: 10px;
    border: 1.5px solid #e0eaf8;
    background: #fff;
    font-size: 12px;
    font-weight: 700;
    color: #374151;
    white-space: nowrap;
    cursor: pointer;
    font-family: Manrope, sans-serif;
    flex-shrink: 0;
}

.catp-filter-btn.on {
    background: #ECF8ED;
    border-color: #16a34a;
    color: #16a34a;
}

/* Layout: no left sidebar anymore, subcategories live in a bottom bar */
.catp-body {
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
}

/* CONTENT (full width) */
.catp-content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 10px 10px 130px;
    /* extra bottom padding so cards clear the fixed subcat bar */
}

.catp-subhead {
    font-size: 14px;
    font-weight: 800;
    color: #111;
    font-family: Manrope, sans-serif;
    padding: 4px 4px 10px;
}

.catp-empty {
    text-align: center;
    color: #9aa5b4;
    font-size: 13px;
    font-family: Manrope, sans-serif;
    padding: 40px 0;
}

/* GRID — always 2 columns on mobile */
.catp-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    width: 100% !important;
}

@media (min-width: 768px) {
    .catp-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 12px;
    }
}

/* CARD — Blinkit style: border only lives on the image, text is border-free */
.catp-card {
    background: transparent;
    border: none;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity .3s ease, transform .3s ease;
    cursor: pointer;
}

.catp-card.catp-in {
    opacity: 1;
    transform: translateY(0);
}

/* wraps the image + the overlapping +Add button; overflow visible so the
   button can straddle the image/body boundary like the reference cards */
.catp-media {
    position: relative;
}

.catp-card-img-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    background: #fff;
    overflow: hidden;
    border: 1px solid #eaecf0;
    border-radius: 10px;
}

.catp-card-img-wrap img.catp-prod-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    padding: 0px;
    box-sizing: border-box;
    transition: filter .2s;
}

.catp-card.catp-closed .catp-prod-img {
    filter: grayscale(1) opacity(.55);
}

.catp-card.catp-closed .catp-card-name,
.catp-card.catp-closed .catp-card-price,
.catp-card.catp-closed .catp-card-qty,
.catp-card.catp-closed .catp-card-shop,
.catp-card.catp-closed .catp-card-dist {
    opacity: .55;
}

/* OPEN / CLOSED / LIKELY status badge — real SVG asset, top-left of the image */
.catp-status-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 22px;
    height: 22px;
    object-fit: contain;
    z-index: 2;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .15));
}

/* Text block: zero border, zero shadow */
.catp-card-body {
    padding: 10px 2px 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
    border: none;
    box-shadow: none;
    background: transparent;
}

.catp-card-name {
    font-size: 12.5px;
    font-weight: 600;
    color: #000000;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.5em;
    font-family: Manrope, sans-serif;
}

.catp-price-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin-top: 2px;
}

.catp-card-price {
    font-size: 16px;
    font-weight: 900;
    color: #0d0d0d;
    font-family: Manrope, sans-serif;
}

.catp-delivery-inline {
    width: 26px;
    height: 26px;
    object-fit: contain;
    flex-shrink: 0;
}

.catp-card-qty {
    font-size: 11px;
    color: #9aa5b4;
    font-family: Manrope, sans-serif;
}

.catp-card-shop {
    font-size: 9.5px;
    color: #4c4949;
    font-weight: 700;
    letter-spacing: .2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: Manrope, sans-serif;
    margin-top: 4px;
}

/* "~X min to go" — tappable pill that calls the app's real getDirections() */
.catp-card-dist {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 9px;
    font-weight: 700;
    color: #0d7a3f;
    background: #86cf9c;
    border: 0.5px solid #37934e;
    border-radius: 4px;
    padding: 3px 5px;
    margin-top: 6px;
    width: fit-content;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity .25s cubic-bezier(0.22, 1, 0.36, 1), transform .25s cubic-bezier(0.22, 1, 0.36, 1), background-color .15s ease;
    font-family: Manrope, sans-serif;
}

.catp-card-dist:active {
    background: #dcf3de;
}

.catp-card-dist.catp-dist-in {
    opacity: 1;
    transform: translateY(0);
}

.catp-card-dist img {
    width: 12px;
    height: 12px;
    object-fit: contain;
    flex-shrink: 0;
}

.catp-dist-arrow {
    margin-left: 1px;
}

.catp-fav-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: none !important;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #374151;
    z-index: 3;
    transition: color .15s ease;
}

.catp-fav-btn.active {
    color: #e11d48;
}

.catp-fav-btn.active svg {
    fill: #e11d48;
    stroke: #e11d48;
}

/* +Add button — bottom-right of the image, overlapping the image/body boundary */
.catp-add-btn {
    position: absolute;
    right: 0px;
    bottom: -6px;
    z-index: 4;
    background: #fff;
    border: 0.5px solid #3d7e69;
    color: #074326;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .2px;
    border-radius: 4px;
    padding: 5px 10px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgb(0 0 0 / 0%);
    font-family: Manrope, sans-serif;
    transition: transform .12s ease, background-color .12s ease, color .12s ease;
}

.catp-add-btn:active {
    transform: scale(.94);
    background: #16a34a;
    color: #fff;
}

/* SKELETON */
@keyframes catpShimmer {
    0% {
        background-position: -400px 0;
    }

    100% {
        background-position: 400px 0;
    }
}

.catp-skel {
    background: linear-gradient(90deg, #ececec 25%, #f8f8f8 50%, #ececec 75%);
    background-size: 800px 100%;
    animation: catpShimmer 1.4s infinite linear;
}

.catp-skel-card {
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #eaecf0;
}

.catp-skel-img {
    width: 100%;
    aspect-ratio: 1;
}

.catp-skel-line {
    height: 9px;
    border-radius: 5px;
    margin: 6px 8px;
}

.catp-skel-line.w60 {
    width: 60%;
}

/* ── BOTTOM SUBCATEGORY BAR (Blinkit-style, right-scrollable) ── */
.catp-subcats-wrap {
    position: absolute;
    left: 20px;
    right: 20px;
    bottom: 20px;
    z-index: 5;
    pointer-events: none;
    /* re-enabled on the inner scroller */
}

.catp-subcats {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    background: #fff;
    box-shadow: 0 8px 28px rgba(17, 24, 39, .12), 0 1px 4px rgba(17, 24, 39, .06);
    border-radius: 20px;
    padding: 10px 10px;
    scrollbar-width: none;
}

.catp-subcats::-webkit-scrollbar {
    display: none;
}

/* right-edge fade hints that there's more to scroll */
.catp-subcats-wrap::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 30px;
    background: linear-gradient(to right, rgba(255, 255, 255, 0), rgba(255, 255, 255, .96));
    border-radius: 0 20px 20px 0;
    pointer-events: none;
}

.catp-subcat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: 56px;
    flex-shrink: 0;
    scroll-snap-align: start;
    cursor: pointer;
    text-align: center;
}

.catp-subcat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    background: #f6f7fb;
    border: 2px solid transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 800;
    color: #374151;
    overflow: visible;
    position: relative;
    transition: border-color .15s ease, background-color .15s ease, transform .12s ease;
}

.catp-subcat-item:active .catp-subcat-icon {
    transform: scale(.94);
}

.catp-subcat-icon img {
    width: 65%;
    height: 65%;
    object-fit: contain;
    position: relative;
    z-index: 2;
    transform: scale(1);
    transition: transform .3s cubic-bezier(0.34, 1.56, 0.64, 1);
    will-change: transform;
}

.catp-subcat-item.active .catp-subcat-icon img {
    transform: scale(1.55);
}

.catp-subcat-label {
    font-size: 10px;
    font-weight: 700;
    color: #374151;
    line-height: 1.25;
    font-family: Manrope, sans-serif;
}

.catp-subcat-item.active .catp-subcat-icon {
    background: #ECF8ED;
    border-color: #16a34a00;
    box-shadow: 0 0 0 3px rgb(22 163 74 / 6%);
}

.catp-subcat-item.active .catp-subcat-label {
    color: #16a34a;
    font-weight: 800;
}

/* PRICE SHEET */
.catp-price-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .4);
    z-index: 9600;
    display: none;
}

.catp-price-overlay.open {
    display: block;
}

.catp-price-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: -200px;
    background: #fff;
    border-radius: 18px 18px 0 0;
    z-index: 9601;
    padding: 10px 0 24px;
    transition: bottom .28s cubic-bezier(0.32, 0.72, 0, 1);
}

.catp-price-sheet.open {
    bottom: 0;
}

.catp-price-opt {
    padding: 14px 20px;
    font-size: 14px;
    font-weight: 700;
    color: #111;
    font-family: Manrope, sans-serif;
    cursor: pointer;
}

.catp-price-opt.selected {
    color: #16a34a;
    background: #ECF8ED;
}






/* Text-based status badge for search result cards (no external icon dependency) */
.catp-status-badge-text {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 2;
    font-family: 'Manrope', sans-serif;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.3px;
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .15);
}
