/* ============================================================
   Bannu Market — market.css
   Card-based magazine style, mobile-first
   ============================================================ */

/* ── Grid Layout ── */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
    margin-top: 1rem;
}

/* ── Market Card ── */
.market-card {
    background: #fff;
    border-radius: 16px;
    border: 1px solid rgba(138, 155, 181, 0.18);
    box-shadow: 0 2px 12px rgba(13, 27, 62, 0.06);
    overflow: hidden;
    transition: transform 0.22s ease, box-shadow 0.22s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.market-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 36px rgba(13, 27, 62, 0.13);
}

/* ── Product Image Container ── */
.product-img-container {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: linear-gradient(135deg, #e8edf5 0%, #d0d8e8 100%);
    flex-shrink: 0;
}

.product-img-container .grid-item-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    display: block;
    transition: transform 0.45s ease;
}

.market-card:hover .product-img-container .grid-item-img {
    transform: scale(1.06);
}

/* ── Image Overlay Badges ── */
.product-meta {
    position: absolute;
    top: 10px;
    left: 10px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    z-index: 2;
}

.product-meta .badge {
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: rgba(13, 27, 62, 0.82);
    color: #fff;
    border: none;
    backdrop-filter: blur(4px);
}

.product-condition-badge {
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    background: rgba(255, 255, 255, 0.92);
    color: #1a3a6e;
    border: 1px solid rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(4px);
    font-family: var(--font-body);
}

/* Photo count badge — bottom right of image */
.image-count-badge {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.58);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 100px;
    backdrop-filter: blur(4px);
    font-family: var(--font-body);
    z-index: 2;
}

/* ── Card Body ── */
.grid-item-body {
    padding: 14px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

/* Product Title */
.product-title {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--forest, #0D1B3E);
    line-height: 1.3;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Price */
.product-price {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 800;
    color: #e05d16;
    letter-spacing: -0.02em;
    line-height: 1;
    margin: 2px 0 4px;
}

/* Details section — location, seller */
.product-details-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 4px;
    padding-top: 8px;
    border-top: 1px solid #f0f2f5;
}

.product-detail {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-body);
    font-size: 12px;
    color: var(--muted, #6B7280);
    margin: 0;
    max-width: none;
    line-height: 1.3;
}

.product-detail svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
    color: var(--sage, #2E6DD4);
}

/* ── WhatsApp Button ── */
.btn-whatsapp {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #22c55e;
    color: #fff !important;
    padding: 10px 14px;
    border-radius: 10px;
    text-decoration: none !important;
    font-family: var(--font-body);
    font-size: 0.82rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    box-shadow: 0 3px 10px rgba(34, 197, 94, 0.25);
    margin-top: auto;
}

.btn-whatsapp:hover {
    background: #16a34a;
    transform: translateY(-1px);
    box-shadow: 0 5px 14px rgba(34, 197, 94, 0.32);
}

.btn-whatsapp svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* ── Image Preview Box (form) ── */
.img-preview-box {
    display: none;
    margin-top: 8px;
    border-radius: 10px;
    overflow: hidden;
    border: 1.5px solid var(--border, rgba(138, 155, 181, 0.22));
    background: #f9fafb;
}

.img-preview-box img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    object-position: center;
    display: block;
}

/* ── No Results ── */
.no-results {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--muted);
    grid-column: 1 / -1;
}

.no-results svg {
    width: 48px;
    height: 48px;
    color: #d1d5db;
    margin-bottom: 1rem;
}

.no-results h3 {
    color: var(--forest);
    margin-bottom: 0.4rem;
    font-size: 1.1rem;
}

.no-results p {
    font-size: 0.88rem;
    max-width: 30ch;
    margin: 0 auto;
}

/* ── Condition label (default cards fallback) ── */
.product-condition {
    display: inline-block;
    background: #f0f7ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
    border-radius: 100px;
    padding: 3px 10px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-family: var(--font-body);
    margin-bottom: 6px;
}

/* ============================================================
   MOBILE RESPONSIVE — 480px aur neeche
   ============================================================ */
@media (max-width: 480px) {

    /* Single column — cards poori width lein, cramped nahi */
    .grid {
        grid-template-columns: 1fr;
        gap: 0.875rem;
        margin-top: 0.75rem;
    }

    /* Card horizontal layout on mobile — image left, content right */
    .market-card {
        flex-direction: row;
        border-radius: 14px;
        min-height: 130px;
        align-items: stretch;
    }

    /* Image: fixed width on left side */
    .product-img-container {
        width: 130px;
        min-width: 130px;
        aspect-ratio: unset;
        border-radius: 0;
        border-top-left-radius: 14px;
        border-bottom-left-radius: 14px;
    }

    /* Hover scale thoda kam — horizontal cards pe */
    .market-card:hover .product-img-container .grid-item-img {
        transform: scale(1.04);
    }

    /* Badges chhotey rakhain */
    .product-meta {
        top: 7px;
        left: 7px;
        gap: 4px;
    }

    .product-meta .badge,
    .product-condition-badge {
        font-size: 8px;
        padding: 2px 6px;
    }

    .image-count-badge {
        font-size: 9px;
        padding: 2px 7px;
        bottom: 7px;
        right: 7px;
    }

    /* Card body: right side */
    .grid-item-body {
        padding: 11px 12px 12px;
        gap: 4px;
        flex: 1;
        min-width: 0;
        /* text overflow fix */
        justify-content: space-between;
    }

    .product-title {
        font-size: 0.88rem;
        font-weight: 700;
        line-height: 1.25;
        -webkit-line-clamp: 2;
    }

    .product-price {
        font-size: 1.05rem;
        margin: 1px 0 2px;
    }

    /* Location hide karein jagah bachane ke liye */
    .product-details-section {
        gap: 3px;
        padding-top: 5px;
        margin-bottom: 2px;
    }

    .product-detail {
        font-size: 11px;
        gap: 4px;
    }

    .product-detail svg {
        width: 11px;
        height: 11px;
    }

    /* WhatsApp button — poora width, achha touch target */
    .btn-whatsapp {
        padding: 9px 10px;
        font-size: 0.78rem;
        border-radius: 8px;
        gap: 6px;
        min-height: 38px;
    }

    .btn-whatsapp svg {
        width: 15px;
        height: 15px;
    }
}

/* ── Very small screens (360px se neeche) ── */
@media (max-width: 360px) {
    .market-card {
        flex-direction: row;
        min-height: 120px;
    }

    .product-img-container {
        width: 110px;
        min-width: 110px;
    }

    .grid-item-body {
        padding: 9px 10px 10px;
    }

    .product-title {
        font-size: 0.82rem;
    }

    .product-price {
        font-size: 0.98rem;
    }

    .btn-whatsapp span {
        display: none;
        /* sirf icon dikhao */
    }

    .btn-whatsapp {
        justify-content: center;
        padding: 9px;
        min-height: 36px;
    }

    .btn-whatsapp svg {
        width: 18px;
        height: 18px;
    }
}

/* ── Tablet ── */
@media (min-width: 481px) and (max-width: 900px) {
    .grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .grid-item-body {
        padding: 12px 14px 14px;
        gap: 5px;
    }

    .product-title {
        font-size: 0.9rem;
    }

    .product-price {
        font-size: 1.1rem;
    }

    .btn-whatsapp {
        font-size: 0.8rem;
        padding: 9px 12px;
    }

    .product-detail {
        font-size: 11px;
    }
}

/* ── Desktop ── */
@media (min-width: 1100px) {
    .grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1400px) {
    .grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Skeleton Loading */
.skeleton-card {
    background: #fff;
    border-radius: 16px;
    border: 1px solid rgba(138, 155, 181, 0.18);
    overflow: hidden;
}

.skeleton-img {
    width: 100%;
    aspect-ratio: 4/3;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.skeleton-body {
    padding: 14px 16px;
}

.skeleton-line {
    height: 14px;
    border-radius: 6px;
    margin-bottom: 10px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.skeleton-line.short {
    width: 60%;
}

.skeleton-line.price {
    width: 40%;
    height: 20px;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}