/* ═══════════════════════════════════════════════
   Products Catalog — Mobile-First Luxury RTL
   ═══════════════════════════════════════════════ */

/* ─────────────────────────────────
   HERO BANNER
   ───────────────────────────────── */
.hero {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, var(--color-primary) 0%, #16213E 50%, var(--color-primary-light) 100%);
    padding: 2.5rem 1.5rem 2rem;
    text-align: center;
    opacity: 0;
    transform: translateY(-10px);
    animation: heroIn 0.7s var(--ease) 0.1s forwards;
}

@keyframes heroIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero__pattern {
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 20% 80%, rgba(201, 168, 76, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(201, 168, 76, 0.06) 0%, transparent 50%);
    pointer-events: none;
}

.hero__pattern::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23C9A84C' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.8;
}

.hero__content {
    position: relative;
    z-index: 2;
}

.hero__badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--color-accent);
    background: rgba(201, 168, 76, 0.12);
    border: 1px solid rgba(201, 168, 76, 0.2);
    padding: 4px 16px;
    border-radius: 50px;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.hero__title {
    font-size: 1.75rem;
    font-weight: 900;
    color: #fff;
    line-height: 1.3;
    margin-bottom: 0.5rem;
}

.hero__desc {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
    max-width: 440px;
    margin: 0 auto 1.25rem;
    line-height: 1.7;
}

.hero__cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #25D366;
    color: #fff;
    padding: 12px 28px;
    border-radius: 50px;
    font-family: var(--font-family);
    font-size: 0.9rem;
    font-weight: 700;
    transition: var(--transition);
    width: 100%;
    justify-content: center;
    max-width: 320px;
}

.hero__cta svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.hero__cta:active {
    transform: scale(0.96);
}

/* Decorative diamonds — hidden on mobile */
.hero__decor {
    display: none;
}

.hero__diamond {
    width: 120px;
    height: 120px;
    border: 2px solid rgba(201, 168, 76, 0.15);
    border-radius: 16px;
    transform: rotate(45deg);
    position: absolute;
}

.hero__diamond--sm {
    width: 60px;
    height: 60px;
    border-color: rgba(201, 168, 76, 0.1);
}

/* ─────────────────────────────────
   SEARCH BAR
   ───────────────────────────────── */
.search-section {
    position: sticky;
    top: var(--topbar-height);
    z-index: 90;
    background: var(--color-bg);
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--color-border-light);
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-bar__field {
    flex: 1;
    display: flex;
    align-items: center;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 0 14px;
    transition: var(--transition-fast);
}

.search-bar__field:focus-within {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.1);
}

.search-bar__icon {
    width: 18px;
    height: 18px;
    color: var(--color-text-muted);
    flex-shrink: 0;
}

.search-bar__input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-family: var(--font-family);
    font-size: 0.9rem;
    color: var(--color-text);
    padding: 10px 10px;
    direction: rtl;
    min-width: 0;
}

.search-bar__input::placeholder {
    color: var(--color-text-muted);
}

.search-bar__filter {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--transition-fast);
}

.search-bar__filter svg {
    width: 18px;
    height: 18px;
}

.search-bar__filter:active {
    background: var(--color-border-light);
}

/* ─────────────────────────────────
   VIEW TOGGLE BUTTON
   ───────────────────────────────── */
.search-bar__toggle {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--transition-fast);
    position: relative;
}

.search-bar__toggle:active {
    background: var(--color-border-light);
}

.toggle-icon {
    width: 18px;
    height: 18px;
    position: absolute;
    transition: opacity 0.2s, transform 0.2s;
}

/* When view is LIST → show grid icon (so user can switch TO grid) */
/* When view is GRID → show list icon (so user can switch TO list) */
.toggle-icon--grid {
    opacity: 1;
    transform: scale(1);
}

.toggle-icon--list {
    opacity: 0;
    transform: scale(0.8);
}

/* JS will add data-current-view to the toggle */
.search-bar__toggle[data-current-view="grid"] .toggle-icon--grid {
    opacity: 0;
    transform: scale(0.8);
}

.search-bar__toggle[data-current-view="grid"] .toggle-icon--list {
    opacity: 1;
    transform: scale(1);
}

/* ─────────────────────────────────
   PRODUCTS SECTION
   ───────────────────────────────── */
.products-section {
    padding: 1.25rem 0 2rem;
}

/* ═════════════════════════════════════════════
   PRODUCTS GRID — View Modes
   ═════════════════════════════════════════════ */
.products-grid {
    display: grid;
    gap: 0.75rem;
    transition: gap 0.3s var(--ease);
}

/* ── LIST MODE ── */
.products-grid[data-view="list"] {
    grid-template-columns: 1fr;
}

/* ── GRID MODE ── */
.products-grid[data-view="grid"] {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

/* ─────────────────────────────────
   PRODUCT CARD — Base
   ───────────────────────────────── */
.product-card {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border-light);
    overflow: hidden;
    box-shadow: var(--shadow-xs);
    /* Intersection Observer animation */
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.5s var(--ease), transform 0.5s var(--ease), box-shadow var(--transition);
}

.product-card.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.product-card:active {
    background: var(--color-border-light);
}

/* ── LIST MODE — Card Layout ── */
.products-grid[data-view="list"] .product-card__link {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    height: 100%;
}

.products-grid[data-view="list"] .product-card__img-wrap {
    position: relative;
    width: 110px;
    min-height: 110px;
    flex-shrink: 0;
    overflow: hidden;
    background: var(--color-border-light);
}

.products-grid[data-view="list"] .product-card__img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.products-grid[data-view="list"] .product-card__body {
    flex: 1;
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.products-grid[data-view="list"] .product-card__cta {
    align-self: flex-start;
}

/* ── GRID MODE — Card Layout ── */
.products-grid[data-view="grid"] .product-card__link {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.products-grid[data-view="grid"] .product-card__img-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: var(--color-border-light);
}

.products-grid[data-view="grid"] .product-card__img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.products-grid[data-view="grid"] .product-card__body {
    flex: 1;
    padding: 0.6rem 0.65rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    min-width: 0;
}

.products-grid[data-view="grid"] .product-card__title {
    font-size: 0.8rem;
    -webkit-line-clamp: 2;
    line-clamp: 2;
}

.products-grid[data-view="grid"] .product-card__meta {
    font-size: 0.7rem;
}

.products-grid[data-view="grid"] .product-card__cta {
    align-self: stretch;
    text-align: center;
    font-size: 0.72rem;
    padding: 4px 10px;
}

/* ── Shared card elements ── */
.product-card__placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #F5F3EF, #EBE7E0);
    color: var(--color-text-muted);
}

.product-card__placeholder svg {
    width: 32px;
    height: 32px;
    opacity: 0.35;
}

.product-card__badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--color-accent);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 50px;
    z-index: 2;
    letter-spacing: 0.02em;
}

.product-card__img-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.06), transparent);
    pointer-events: none;
}

.product-card__title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 0.25rem;
}

.product-card__meta {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.product-card__cta {
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--color-accent-dark);
    padding: 5px 14px;
    border: 1.5px solid var(--color-accent-light);
    border-radius: 50px;
    text-align: center;
    transition: var(--transition-fast);
}

/* ─────────────────────────────────
   INFINITE SCROLL
   ───────────────────────────────── */
.infinite {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem 0 1rem;
    gap: 1rem;
}

.infinite__sentinel {
    height: 1px;
    width: 100%;
    pointer-events: none;
}

/* Spinner */
.infinite__loader {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--color-text-muted);
    font-size: 0.85rem;
    padding: 1rem 0;
}

.infinite__spinner {
    width: 22px;
    height: 22px;
    border: 2.5px solid var(--color-border);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: infiniteSpin 0.7s linear infinite;
}

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

/* Load More button */
.infinite__more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    max-width: 320px;
    padding: 12px 28px;
    font-family: var(--font-family);
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--color-accent-dark);
    background: var(--color-surface);
    border: 1.5px solid var(--color-accent-light);
    border-radius: 50px;
    cursor: pointer;
    transition: var(--transition-fast);
    min-height: 48px;
}

.infinite__more svg {
    width: 18px;
    height: 18px;
    transition: transform 0.2s;
}

.infinite__more:active {
    transform: scale(0.97);
}

/* Error state */
.infinite__error {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: #FEF2F2;
    border: 1px solid #FECACA;
    border-radius: var(--radius-md);
    color: #991B1B;
    font-size: 0.85rem;
    max-width: 400px;
    width: 100%;
}

.infinite__retry {
    margin-right: auto;
    padding: 6px 16px;
    font-family: var(--font-family);
    font-size: 0.8rem;
    font-weight: 600;
    color: #991B1B;
    background: #fff;
    border: 1px solid #FECACA;
    border-radius: 50px;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition-fast);
}

.infinite__retry:active {
    background: #FEE2E2;
}

/* End message */
.infinite__end {
    color: var(--color-text-muted);
    font-size: 0.85rem;
    padding: 1rem 0 0.5rem;
    letter-spacing: 0.03em;
}

/* Force hidden to override display: flex/inline-flex */
.infinite__loader[hidden],
.infinite__error[hidden],
.infinite__more[hidden],
.infinite__end[hidden] {
    display: none !important;
}

/* ─────────────────────────────────
   EMPTY STATE
   ───────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 4rem 1.5rem;
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
}

.empty-state.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.empty-state__icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 1.25rem;
    background: linear-gradient(135deg, var(--color-border-light), #E8E4DE);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
}

.empty-state__icon svg {
    width: 32px;
    height: 32px;
}

.empty-state__title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 0.4rem;
}

.empty-state__text {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    margin-bottom: 1.5rem;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
}

.empty-state__cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #25D366;
    color: #fff;
    padding: 12px 28px;
    border-radius: 50px;
    font-family: var(--font-family);
    font-size: 0.875rem;
    font-weight: 700;
    transition: var(--transition-fast);
}

.empty-state__cta svg {
    width: 18px;
    height: 18px;
}

.empty-state__cta:active {
    transform: scale(0.96);
}

/* No-results from search */
.search-empty-msg {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem 1rem;
    color: var(--color-text-muted);
    font-size: 0.95rem;
}


/* ═══════════════════════════════════
   SMALL TABLETS (481px+)
   ═══════════════════════════════════ */
@media (min-width: 481px) {
    .products-grid {
        gap: 1rem;
    }

    .products-grid[data-view="grid"] {
        gap: 0.85rem;
    }

    .products-grid[data-view="grid"] .product-card__body {
        padding: 0.75rem 0.85rem;
    }

    .products-grid[data-view="grid"] .product-card__title {
        font-size: 0.85rem;
    }

    .hero {
        padding: 3rem 2rem 2.5rem;
    }

    .hero__title {
        font-size: 2rem;
    }
}


/* ═══════════════════════════════════
   TABLETS (769px+)
   ═══════════════════════════════════ */
@media (min-width: 769px) {
    .products-grid[data-view="grid"] {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.25rem;
    }

    .products-grid[data-view="list"] {
        gap: 1rem;
    }

    .products-grid[data-view="list"] .product-card__img-wrap {
        width: 140px;
        min-height: 130px;
    }

    .hero {
        padding: 3.5rem 2rem 3rem;
        text-align: right;
    }

    .hero__content {
        max-width: 55%;
    }

    .hero__desc {
        margin: 0 0 1.25rem;
    }

    .hero__cta {
        width: auto;
    }

    /* Show decorative elements */
    .hero__decor {
        display: block;
        position: absolute;
        left: 8%;
        top: 50%;
        transform: translateY(-50%);
    }

    .hero__diamond {
        top: -30px;
        left: 20px;
    }

    .hero__diamond--sm {
        top: 50px;
        left: -10px;
    }

    .search-section {
        padding: 1rem 0;
    }

    .search-bar__field {
        border-radius: 50px;
        padding: 0 20px;
    }

    .search-bar__input {
        padding: 12px 12px;
    }

    .search-bar__filter,
    .search-bar__toggle {
        border-radius: 50px;
        width: 48px;
        height: 48px;
    }

    .products-section {
        padding: 1.5rem 0 2.5rem;
    }

    /* Desktop hover effects */
    .product-card {
        cursor: pointer;
    }

    .product-card:hover {
        transform: translateY(-4px);
        box-shadow: var(--shadow-lg);
        border-color: var(--color-accent-light);
    }

    .product-card:hover .product-card__img {
        transform: scale(1.05);
    }

    .product-card__img {
        transition: transform 0.5s var(--ease);
    }

    .product-card:hover .product-card__cta {
        background: linear-gradient(135deg, var(--color-accent), var(--color-accent-dark));
        border-color: transparent;
        color: #fff;
    }

    /* Toggle hover */
    .search-bar__toggle:hover,
    .search-bar__filter:hover {
        border-color: var(--color-accent);
        color: var(--color-accent-dark);
    }

    /* Infinite scroll hover */
    .infinite__more:hover {
        background: linear-gradient(135deg, var(--color-accent), var(--color-accent-dark));
        border-color: transparent;
        color: #fff;
        transform: translateY(-2px);
        box-shadow: var(--shadow-md);
    }

    .infinite__retry:hover {
        background: #FEE2E2;
    }

    .hero__cta:hover {
        background: #1DA851;
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(37, 211, 102, 0.3);
    }

    .empty-state__cta:hover {
        background: #1DA851;
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(37, 211, 102, 0.3);
    }
}


/* ═══════════════════════════════════
   DESKTOP (1025px+)
   ═══════════════════════════════════ */
@media (min-width: 1025px) {
    .products-grid[data-view="grid"] {
        grid-template-columns: repeat(4, 1fr);
        gap: 1.5rem;
    }

    .products-grid[data-view="list"] {
        max-width: 800px;
    }

    .products-grid[data-view="list"] .product-card__img-wrap {
        width: 160px;
        min-height: 140px;
    }

    .hero {
        padding: 4rem 3rem 3.5rem;
    }

    .hero__title {
        font-size: 2.5rem;
    }

    .hero__desc {
        font-size: 1rem;
    }

    .hero__content {
        max-width: 50%;
    }

    .hero__decor {
        left: 12%;
    }

    .hero__diamond {
        width: 150px;
        height: 150px;
    }

    .hero__diamond--sm {
        width: 80px;
        height: 80px;
    }

    .search-bar {
        max-width: 500px;
    }

    .product-card__title {
        font-size: 0.95rem;
    }

    .products-grid[data-view="grid"] .product-card__body {
        padding: 1rem 1.15rem;
    }

    .products-grid[data-view="list"] .product-card__body {
        padding: 1rem 1.25rem;
    }
}


/* ═══════════════════════════════════
   ANIMATION STAGGER for visible cards
   ═══════════════════════════════════ */
.product-card.is-visible:nth-child(1) {
    transition-delay: 0.05s;
}

.product-card.is-visible:nth-child(2) {
    transition-delay: 0.10s;
}

.product-card.is-visible:nth-child(3) {
    transition-delay: 0.15s;
}

.product-card.is-visible:nth-child(4) {
    transition-delay: 0.20s;
}

.product-card.is-visible:nth-child(5) {
    transition-delay: 0.25s;
}

.product-card.is-visible:nth-child(6) {
    transition-delay: 0.30s;
}

.product-card.is-visible:nth-child(7) {
    transition-delay: 0.35s;
}

.product-card.is-visible:nth-child(8) {
    transition-delay: 0.40s;
}

.product-card.is-visible:nth-child(9) {
    transition-delay: 0.45s;
}

.product-card.is-visible:nth-child(10) {
    transition-delay: 0.50s;
}


/* ═══════════════════════════════════
   REDUCED MOTION
   ═══════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
    .hero {
        animation: none;
        opacity: 1;
        transform: none;
    }

    .product-card,
    .empty-state {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .toggle-icon {
        transition: none;
    }
}