/* =========================
   HEADER
========================= */
.marketplace-header {
    position: sticky;
    top: 0;
    background: #fff;
    padding: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 50;
    border-bottom: 1px solid #eee;
}

.search-box {
    flex: 1;
    background: #f2f2f2;
    padding: 8px 12px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-box input {
    border: none;
    background: transparent;
    width: 100%;
    outline: none;
}

.cart-icon {
    position: relative;
    font-size: 22px;
    color: #333;
}

/* =========================
   SEARCH RESULTS
========================= */
.search-results {
    position: absolute;
    top: 60px;
    left: 10px;
    right: 10px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 10px 20px rgba(0,0,0,.08);
    z-index: 100;
}

.search-results a {
    display: block;
    padding: 10px;
    border-bottom: 1px solid #eee;
    text-decoration: none;
    color: #111;
}

/* =========================
   SHOPS
========================= */
.shop-row {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 10px;
    scrollbar-width: none; /* Firefox */
}

.shop-card {
    min-width: 150px;
    background: #fff;
    border-radius: 12px;
    padding: 12px;
    text-decoration: none;
    color: #111;
    box-shadow: 0 4px 12px rgba(0,0,0,.1);
}

.shop-card .status {
    display: inline-block;
    margin-top: 6px;
    font-size: 11px;
    padding: 3px 6px;
    border-radius: 6px;
}

.status.open { background: #e6f7ed; color: #0094ae; }
.status.closed { background: #fdecea; color: #dc3545; }

/* =========================
   FILTERS
========================= */
.filter-bar {
    display: flex;
    gap: 10px;
    margin: 12px 0;
}

.chip {
    padding: 6px 14px;
    border-radius: 20px;
    border: none;
    background: #eee;
    font-size: 13px;
}

.chip.active {
    background: #071347;
    color: #fff;
}

/* =========================
   PRODUCTS
========================= */
.product-grid {
    display: grid;
    grid-template-columns: repeat(2,1fr);
    gap: 12px;
}

.product-card {
    background: #fff;
    border-radius: 14px;
    padding: 10px;
    position: relative;
}

.product-card img {
    width: 100%;
    height: 130px;
    object-fit: cover;
    border-radius: 10px;
}
.product-card a {
    text-decoration: none;
    color: inherit;
}

.product-card h4 {
    font-size: 14px;
    margin: 6px 0;
    text-decoration: none;
}

.price {
    font-weight: bold;
    text-decoration: none;
}

.price a{
    text-decoration: none;
}

.price small {
    text-decoration: line-through;
    color: #888;
    font-size: 12px;
    margin-left: 6px;
}

.meta {
    font-size: 12px;
    color: #666;
}

.badge.low {
    background: #fff3cd;
    color: #856404;
    padding: 2px 6px;
    border-radius: 6px;
}

.quick-add {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: #071347;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    font-size: 18px;
}

.product-card.disabled {
    opacity: .6;
}

.disabled-btn {
    width: 100%;
    border: none;
    background: #ccc;
    padding: 8px;
    border-radius: 8px;
}


.cart-item {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.cart-thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 8px;
}

.cart-info {
    flex: 1;
    display: flex;
    justify-content: space-between;
    font-size: 14px;
}


.cart-sheet-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.cart-view,
.cart-checkout {
    flex: 1;
    text-align: center;
    padding: 12px;
    border-radius: 12px;
    font-size: 14px;
    text-decoration: none;
    font-weight: 600;
}

.cart-view {
    background: #f1f3f5;
    color: #333;
}

.cart-checkout {
    background: #0d6efd;
    color: #fff;
}


.filter-icon-btn {
    background: #071347;
    color: #fff;
    border: none;
    border-radius: 12px;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
    cursor: pointer;
}


.filter-sheet {
    position: fixed;
    bottom: -100%;
    left: 0;
    width: 100%;
    height: 80%;
    background: #fff;
    border-radius: 16px 16px 0 0;
    transition: bottom .3s ease;
    z-index: 1001;
}

.filter-sheet.show {
    bottom: 0;
}

.filter-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    opacity: 0;
    pointer-events: none;
    transition: .3s;
    z-index: 1000;
}

.filter-backdrop.show {
    opacity: 1;
    pointer-events: all;
}

/* =========================
   FILTER SHEET
========================= */
.filter-sheet {
    position: fixed;
    bottom: -100%;
    left: 0;
    right: 0;

    height: 85vh;
    background: #ffffff;
    border-radius: 18px 18px 0 0;

    box-shadow: 0 -10px 30px rgba(0,0,0,.15);
    transition: bottom .3s ease;
    z-index: 1001;

    padding: 16px;
    overflow-y: auto;
}

.filter-sheet.show {
    bottom: 0;
}

/* HEADER */
.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.filter-header strong {
    font-size: 16px;
}

/* SECTIONS */
.filter-section {
    margin-bottom: 18px;
}

.filter-section h4 {
    font-size: 14px;
    margin-bottom: 8px;
}

.filter-options label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
}

/* ACTIONS */
.filter-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.filter-actions button {
    flex: 1;
    padding: 12px;
    border-radius: 10px;
    border: none;
    font-weight: bold;
}

.apply-btn {
    background: #0d6efd;
    color: #fff;
}

.reset-btn {
    background: #eee;
}

/* =========================
   BACKDROP
========================= */
.filter-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s;
    z-index: 1000;
}

.filter-backdrop.show {
    opacity: 1;
    pointer-events: auto;
}


/* CHIP GROUP */
.chip-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    padding: 8px 14px;
    border-radius: 20px;
    border: 1px solid #ddd;
    background: #fff;
    font-size: 13px;
    cursor: pointer;
}

.chip.active {
    background: #071347;
    color: #fff;
    border-color: #0094AE;
}

/* PRICE INPUTS */
.price-inputs {
    display: flex;
    gap: 10px;
}

.price-inputs input {
    flex: 1;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid #ccc;
}

/* CHECKBOX */
.checkbox-row {
    font-size: 14px;
}

/* STICKY ACTIONS */
.filter-actions.sticky {
    position: sticky;
    bottom: 0;
    background: #fff;
    padding-top: 12px;
    padding-bottom: 8px;
    border-top: 1px solid #eee;
}

.shop-card {
    padding: 0;
    overflow: hidden;
}

.shop-banner {
    height: 80px;
    background-size: cover;
    background-position: center;
    border-radius: 10px 10px 0 0;
}

.shop-info {
    padding: 10px;
}

.discover-cards {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 10px 0;
}

.discover-card {
    min-width: 160px;
    padding: 14px;
    border-radius: 14px;
    color: #fff;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-weight: 600;
}

.discover-card span {
    font-size: 22px;
}

.card-blue { background: linear-gradient(135deg,#4e73df,#224abe); }
.card-green { background: linear-gradient(135deg,#1cc88a,#13855c); }
.card-orange { background: linear-gradient(135deg,#f6c23e,#dda20a); }
.card-purple { background: linear-gradient(135deg,#9f7aea,#6b46c1); }


/* =========================
   MARKET SEARCH RESULTS
========================= */
#search-results {
    position: absolute;
    top: 60px;
    left: 12px;
    right: 12px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(0,0,0,.08);
    overflow: hidden;
    z-index: 2000;
}

.market-search-item {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 12px 14px;
    cursor: pointer;
    border-bottom: 1px solid #f2f2f2;
}

.market-search-item:last-child {
    border-bottom: none;
}

.market-search-item img {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    object-fit: cover;
    border: 1px solid #eee;
}

.market-search-item .text strong {
    display: block;
    font-size: 14px;
}

.market-search-item .text small {
    font-size: 12px;
    color: #777;
}

.market-search-item:hover {
    background: #f9fafb;
}


.product-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

/* CARD */
.product-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.06);
    display: flex;
    flex-direction: column;
    position: relative;
}


/* FORCE SQUARE IMAGE FRAME */
.product-image {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;   /* 🔥 uniform square */
    overflow: hidden;
    background: #f5f5f5;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;     /* 🔥 image fills frame, not frame fitting image */
    display: block;
}


/* DISCOUNT */
.discount-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: #e53935;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 6px;
    border-radius: 6px;
}


/* BODY */
.product-body {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}


.product-name {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}


/* PRICE */
.price-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.price-main {
    font-size: 15px;
    font-weight: 700;
    color: #111;
}

.price-old {
    font-size: 12px;
    color: #999;
    text-decoration: line-through;
}


/* META */
.meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: #666;
}

.shop-name {
    max-width: 70%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


.badge {
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 600;
}

.badge.low {
    background: #fff3cd;
    color: #856404;
}

.badge.closed {
    background: #f8d7da;
    color: #842029;
}

/* ACTION BUTTON */
.quick-add {
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #000;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
}


.disabled-btn {
    margin: 10px;
    padding: 10px;
    border-radius: 10px;
    border: none;
    background: #eee;
    color: #777;
    font-size: 13px;
}

/* DISABLED */
.product-card.disabled {
    opacity: 0.6;
    pointer-events: none;
}

@media (min-width: 900px) {

    .product-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 20px;
    }

    .product-name {
        font-size: 15px;
        max-height: 3em;
    }

    .quick-add {
        opacity: 0;
        transform: scale(0.9);
        transition: 0.2s ease;
    }

    .product-card:hover .quick-add {
        opacity: 1;
        transform: scale(1);
    }
}

/* STATUS BUTTONS */
.status-btn {
    margin: 10px;
    padding: 8px;
    border-radius: 8px;
    border: none;
    font-size: 12px;
    background: #eee;
    color: #666;
}


/* Shop closed */
.status-btn.closed {
    background: #fdecea;
    color: #b02a37;
}

/* Out of stock */
.status-btn.out {
    background: #fff4e5;
    color: #946200;
}

/* Unavailable */
.status-btn.unavailable {
    background: #eee;
    color: #666;
}

.load-more-btn {
    margin: 20px auto;
    display: block;
    padding: 12px 20px;
    border-radius: 12px;
    border: none;
    background: #071347;
    color: #fff;
    font-weight: 600;
}

.back-to-top {
    position: fixed;
    bottom: 80px;
    right: 16px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background: #000;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    display: none;
    z-index: 999;
}


/* ===============================
   FILTER CHIPS – PRODUCT TYPE
================================ */

.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}

.filter-chip {
    position: relative;
    cursor: pointer;
}

.filter-chip input {
    display: none;
}

.filter-chip span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid #ddd;
    font-size: 14px;
    background: #f8f8f8;
    color: #333;
    transition: all 0.2s ease;
    user-select: none;
}

/* ACTIVE STATE */
.filter-chip input:checked + span {
    background: #000;
    color: #fff;
    border-color: #000;
}

/* POPULAR CHIP SPECIAL */
.filter-chip.popular span {
    border-color: #ff9800;
    color: #ff9800;
    background: #fff7e6;
}

.filter-chip.popular input:checked + span {
    background: #ff9800;
    color: #000;
    border-color: #ff9800;
}

.filter-section h4 {
    margin-bottom: 6px;
}
