/* ═══════════════════════════════════════════════
   Fruitkha — Shop Page
   Matches: views/user/shop.ejs
   ═══════════════════════════════════════════════ */

:root {
    --p: #f97316;
    --p-lt: #fff7ed;
    --p-dk: #ea6c10;
    --navy: #0D1B2A;
    --dark: #1e293b;
    --mid: #475569;
    --muted: #64748b;
    --bg: #f6f8fc;
    --border: #e2e8f0;
    --card: #ffffff;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 4px 24px rgba(0, 0, 0, .06);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Poppins', sans-serif;
    background: linear-gradient(135deg, #fff9f4 0%, #f4f7fc 70%);
    color: var(--dark);
    min-height: 100vh;
}

/* ══════════════════════════════════════════════
   Loader
   ══════════════════════════════════════════════ */
.loader {
    position: fixed;
    inset: 0;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity .4s;
}

.loader.hidden {
    opacity: 0;
    pointer-events: none;
}

.loader-inner .circle {
    width: 46px;
    height: 46px;
    border: 4px solid #f1f5f9;
    border-top-color: var(--p);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ══════════════════════════════════════════════
   Shell / Container
   ══════════════════════════════════════════════ */
.shop-shell {
    padding: 36px 0 80px;
}

.shop-shell .container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ══════════════════════════════════════════════
   Shop Head — title + search + quick cats
   ══════════════════════════════════════════════ */
.shop-head {
    margin-bottom: 32px;
}

.shop-head-top {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 20px;
}

.shop-head-top h1 {
    font-size: 28px;
    font-weight: 800;
    color: var(--navy);
    margin: 0 0 4px;
}

.shop-head-top p {
    font-size: 14px;
    color: var(--muted);
    margin: 0;
}

/* Toolbar: search + filter button */
.toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

.search-wrap {
    flex: 1;
    position: relative;
}

.search-wrap input {
    width: 100%;
    padding: 11px 16px 11px 42px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    color: var(--dark);
    outline: none;
    transition: border-color .18s, box-shadow .18s;
}

.search-wrap input:focus {
    border-color: var(--p);
    box-shadow: 0 0 0 4px rgba(249, 115, 22, .10);
}

.search-wrap i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: 14px;
    pointer-events: none;
}

.filter-open-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 20px;
    background: var(--navy);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    transition: background .18s, transform .15s;
}

.search-submit-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 20px;
    background: var(--p);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    transition: background .18s, transform .15s;
}

.search-submit-btn:hover {
    background: var(--p-dk);
    transform: translateY(-1px);
}

.filter-open-btn:hover {
    background: #162332;
    transform: translateY(-1px);
}

/* Quick category tabs */
.quick-cats {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.quick-cats a {
    display: inline-flex;
    align-items: center;
    padding: 7px 18px;
    border-radius: 50px;
    background: #fff;
    border: 1.5px solid var(--border);
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all .18s;
    white-space: nowrap;
}

.quick-cats a:hover {
    border-color: var(--p);
    color: var(--p);
    background: var(--p-lt);
}

.quick-cats a.active {
    background: var(--p);
    border-color: var(--p);
    color: #fff;
    box-shadow: 0 3px 12px rgba(249, 115, 22, .30);
}

/* List note / message */
.list-note {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 16px;
    min-height: 1em;
}

/* ══════════════════════════════════════════════
   Filter Overlay + Panel
   ══════════════════════════════════════════════ */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    z-index: 1050;
    display: none;
    transition: opacity .2s;
}

.overlay.open {
    display: block;
}

.filter-panel {
    position: fixed;
    top: 0;
    right: -480px;
    width: 420px;
    max-width: 92vw;
    height: 100vh;
    background: #fff;
    z-index: 1060;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 30px rgba(0, 0, 0, .14);
    transition: right .3s cubic-bezier(.4, 0, .2, 1);
    font-family: inherit;
}

.filter-panel.open {
    right: 0;
}

.filter-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 22px;
    border-bottom: 1px solid var(--border);
}

.filter-head h3 {
    font-size: 17px;
    font-weight: 800;
    color: var(--navy);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 9px;
}

.filter-head h3 i {
    color: var(--p);
}

.close-filter-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--muted);
    cursor: pointer;
    line-height: 1;
    transition: color .15s;
}

.close-filter-btn:hover {
    color: var(--dark);
}

.filter-body {
    flex: 1;
    overflow-y: auto;
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.filter-section {}

.filter-title {
    font-size: 13px;
    font-weight: 800;
    color: var(--mid);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 14px;
}

/* Category pills in filter */
.cat-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.cat-pill {
    display: inline-flex;
    align-items: center;
}

.cat-pill input[type="checkbox"] {
    display: none;
}

.cat-pill label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    border-radius: 50px;
    background: #f1f5f9;
    border: 1.5px solid transparent;
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all .18s;
}

.cat-pill input:checked+label,
.cat-pill label:hover {
    background: var(--p-lt);
    border-color: var(--p);
    color: var(--p);
}

/* Price slider */
.price-slider-wrap {
    padding: 4px 0;
}

.price-slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 10px;
}

.price-slider-labels .now {
    font-weight: 800;
    color: var(--p);
}

.fancy-range {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e2e8f0;
    outline: none;
    cursor: pointer;
}

.fancy-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--p);
    border: 3px solid #fff;
    box-shadow: 0 2px 8px rgba(249, 115, 22, .40);
    cursor: pointer;
}

/* Sort select */
.sort-select {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    color: var(--dark);
    background: #fff;
    outline: none;
    cursor: pointer;
}

.sort-select:focus {
    border-color: var(--p);
}

/* Filter action buttons */
.apply-btn,
.reset-btn {
    width: 100%;
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all .18s;
}

.apply-btn {
    background: var(--p);
    color: #fff;
    box-shadow: 0 4px 14px rgba(249, 115, 22, .30);
}

.apply-btn:hover {
    background: var(--p-dk);
}

.reset-btn {
    background: #f1f5f9;
    color: var(--mid);
}

.reset-btn:hover {
    background: #e2e8f0;
}

/* ══════════════════════════════════════════════
   Products Grid
   ══════════════════════════════════════════════ */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 22px;
}

/* ── Product Card ── */
.product-card {
    background: var(--card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: transform .25s cubic-bezier(.4, 0, .2, 1), box-shadow .25s;
    outline: none;
    text-decoration: none;
    color: inherit;
}

.product-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 42px rgba(249, 115, 22, .13);
    border-color: #fed7aa;
}

.product-card:focus {
    box-shadow: 0 0 0 3px rgba(249, 115, 22, .35);
}

/* Thumbnail area */
.product-thumb {
    position: relative;
    background: linear-gradient(135deg, #fff8ef, #f4f7fb);
    aspect-ratio: 1 / 1;
    overflow: hidden;
    flex-shrink: 0;
}

.product-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .4s ease;
    display: block;
}

.product-card:hover .product-thumb img {
    transform: scale(1.08);
}

/* Offer tag badge */
.offer-tag {
    position: absolute;
    top: 12px;
    left: 12px;
    background: linear-gradient(135deg, #16a34a, #15803d);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    border-radius: 999px;
    padding: 4px 11px;
    letter-spacing: .03em;
    z-index: 1;
}

/* Wishlist button */
.wishlist-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, .95);
    color: #94a3b8;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
    transition: color .18s, box-shadow .18s, transform .18s;
}

.wishlist-btn:hover,
.wishlist-btn.is-active {
    color: #ef4444;
    transform: scale(1.12);
}

/* Product Content */
.product-content {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}

/* Price block */
.price-block {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}

.price-now {
    font-size: 20px;
    font-weight: 800;
    color: var(--dark);
}

.price-old {
    font-size: 14px;
    color: var(--muted);
    text-decoration: line-through;
    font-weight: 500;
}

/* Product title */
.product-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--dark);
    margin: 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Stock pill */
.stock-pill {
    display: inline-flex;
    align-items: center;
    font-size: 11.5px;
    font-weight: 700;
    border-radius: 999px;
    padding: 4px 12px;
    width: fit-content;
}

.stock-in {
    background: #dcfce7;
    color: #166534;
}

.stock-low {
    background: #fef3c7;
    color: #92400e;
}

.stock-out {
    background: #fee2e2;
    color: #991b1b;
}

/* Add to cart button */
.cart-btn {
    margin-top: auto;
    width: 100%;
    height: 42px;
    border: none;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--p), #fb923c);
    color: #fff;
    font-size: 13.5px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: filter .18s, transform .15s, box-shadow .18s;
    box-shadow: 0 3px 12px rgba(249, 115, 22, .28);
}

.cart-btn:hover:not(:disabled) {
    filter: brightness(.93);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(249, 115, 22, .38);
}

.cart-btn:disabled {
    background: #e5e7eb;
    color: #94a3b8;
    box-shadow: none;
    cursor: not-allowed;
}

/* ══════════════════════════════════════════════
   Empty state
   ══════════════════════════════════════════════ */
.empty-state {
    text-align: center;
    padding: 70px 20px;
    color: var(--muted);
}

.empty-state i {
    font-size: 3.5rem;
    color: #cbd5e1;
    display: block;
    margin-bottom: 20px;
}

.empty-state h3 {
    font-size: 20px;
    color: var(--dark);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
}

/* ══════════════════════════════════════════════
   Pagination
   ══════════════════════════════════════════════ */
.pagination-wrap {
    display: flex;
    justify-content: center;
    margin-top: 50px;
}

.pagination-wrap ul {
    display: flex;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.pagination-wrap li a {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 42px;
    padding: 0 12px;
    border-radius: 10px;
    border: 1.5px solid var(--border);
    background: #fff;
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all .18s;
}

.pagination-wrap li a:hover,
.pagination-wrap li a.active {
    background: var(--p);
    border-color: var(--p);
    color: #fff;
    box-shadow: 0 4px 14px rgba(249, 115, 22, .30);
}

/* ══════════════════════════════════════════════
   Responsive
   ══════════════════════════════════════════════ */
@media (max-width: 768px) {
    .shop-shell {
        padding: 24px 0 60px;
    }

    .shop-shell .container {
        padding: 0 16px;
    }

    .shop-head-top h1 {
        font-size: 22px;
    }

    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }

    .product-content {
        padding: 12px;
    }
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .price-now {
        font-size: 17px;
    }
}
