/* Catalog, home product cards, and product detail surfaces. */
.category-showcase {
    padding: 5rem 0 3rem;
}

.category-grid,
.product-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    overscroll-behavior-x: contain;
}

@media (min-width: 640px) {
    .category-grid,
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .category-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .product-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .product-grid.grid-4-col {
        grid-template-columns: repeat(4, 1fr);
    }
}

.category-tile {
    position: relative;
    height: 240px;
    overflow: hidden;
    border-radius: var(--radius-lg);
    background: var(--surface-elevated);
    cursor: pointer;
    will-change: transform;
}

.category-tile-bg {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    transition: transform 0.85s cubic-bezier(0.22, 1, 0.36, 1);
}

.category-tile-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 1.5rem;
    background: color-mix(in srgb, var(--color-text) 42%, transparent);
    transition: background var(--transition);
}

.category-tile:hover .category-tile-bg {
    transform: scale(1.04);
}

.category-tile:hover .category-tile-overlay {
    background: color-mix(in srgb, var(--color-text) 50%, transparent);
}

.category-tile-name {
    color: var(--button-text-color);
    font-size: 1.15rem;
    font-weight: 700;
}

.category-tile-count {
    margin-top: 0.25rem;
    color: color-mix(in srgb, var(--button-text-color) 72%, transparent);
    font-size: 0.8rem;
}

.product-carousel-wrapper {
    position: relative;
    padding: 0 1rem;
}

.product-carousel {
    display: flex;
    gap: 1.5rem;
    overflow-x: auto;
    scroll-behavior: smooth;
    scroll-padding-inline: 1rem;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    overscroll-behavior-x: contain;
    padding-bottom: 2rem;
}

.product-carousel::-webkit-scrollbar {
    display: none;
}

.carousel-item {
    flex: 0 0 auto;
    width: 280px;
    scroll-snap-align: start;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: var(--surface-color);
    color: var(--text-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transform: translateY(-50%);
    transition: all 0.3s ease;
}

.carousel-btn:hover {
    background: var(--text-color);
    color: var(--header-text-color, var(--text-on-dark));
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.prev-btn {
    left: -24px;
}

.next-btn {
    right: -24px;
}

.badge-rank,
.discount-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 700;
    padding: 4px 10px;
    box-shadow: var(--shadow-sm);
}

.badge-rank {
    background: var(--badge-background);
    color: var(--badge-text-color);
}

.discount-badge {
    background: #ef4444;
    color: var(--header-text-color, var(--text-on-dark));
}

.featured-products {
    padding: 4rem 0;
}

.product-card {
    position: relative;
    display: flex;
    overflow: hidden;
    flex-direction: column;
    border: none;
    border-radius: var(--radius-lg);
    background: var(--card-bg);
    box-shadow: none;
    transition: all var(--transition);
}

.product-card:hover {
    transform: translateY(-4px);
}

.product-card::after {
    display: none;
}

.product-link {
    position: relative;
    display: block;
    overflow: hidden;
}

.product-image {
    position: relative;
    height: 280px;
    overflow: hidden;
    background-color: var(--surface-color);
    background-size: cover;
    background-position: center;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.product-card .quick-add {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 5;
    padding: 1rem;
    background: color-mix(in srgb, var(--color-text) 44%, transparent);
    transform: translateY(100%);
    transition: transform var(--transition);
}

.product-card:hover .quick-add {
    transform: translateY(0);
}

.product-info {
    display: flex;
    flex: 1;
    flex-direction: column;
    padding: 1rem 1.25rem 1.25rem;
}

.product-title {
    margin-bottom: 0.35rem;
    color: var(--text-color);
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.4;
}

.product-title a {
    color: inherit;
    transition: color var(--transition-fast);
}

.product-title a:hover {
    color: var(--primary-color);
}

.product-price {
    margin-bottom: 0.75rem;
    color: var(--text-color);
    font-size: 1.05rem;
    font-weight: 700;
}

.category-tag {
    align-self: flex-start;
    display: inline-block;
    margin-bottom: 0.5rem;
    padding: 0;
    border-radius: 0;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.add-to-cart {
    display: block;
    width: 100%;
    margin-top: auto;
    padding: 0.65rem;
    border: none;
    border-radius: var(--radius);
    background: var(--cta-background, var(--primary-color));
    color: var(--cta-text-color, var(--button-text-color));
    cursor: pointer;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    transition: all var(--transition);
}

.add-to-cart:hover {
    background: #000000;
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

.category-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 2.5rem;
}

.category-links a {
    padding: 0.5rem 1.25rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    background: var(--surface-color);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    transition: all var(--transition);
}

.category-links a:hover,
.category-links a.active-cat {
    border-color: transparent;
    background: var(--text-color);
    color: var(--header-text-color, var(--text-on-dark));
    transform: translateY(-1px);
}

.product-listing {
    min-height: 500px;
}

.product-card-img,
.product-card-placeholder {
    width: 100%;
    height: 100%;
}

.product-card-img {
    display: block;
    object-fit: cover;
}

.product-card-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-page-bg, var(--background-color));
    font-size: 4rem;
    opacity: 0.5;
    filter: grayscale(1);
}

.no-products {
    padding: 4rem 2rem;
    color: var(--text-muted);
    font-size: 1.05rem;
    text-align: center;
}

.product-gallery {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.product-detail-hero-img {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 1/1;
    border: none;
    border-radius: var(--radius-xl);
    background-color: transparent;
    background-repeat: no-repeat;
    background-position: center center;
    background-size: contain;
    box-shadow: none;
    cursor: zoom-in;
    transition: transform var(--transition);
}

.product-detail-hero-img:hover {
    transform: scale(1.01);
}

.product-detail-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-size: 4rem;
    opacity: 0.3;
}

.product-title-large {
    margin-bottom: 1rem;
    font-size: 2.5rem;
}

.product-price-large {
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    font-size: 2rem;
    font-weight: 800;
}

.discount-badge-large {
    margin-left: 0.5rem;
    padding: 0.2rem 0.6rem;
    border-radius: 99px;
    background: color-mix(in srgb, var(--danger-color) 18%, var(--surface-color));
    color: var(--danger-color);
    font-size: 0.9rem;
    vertical-align: middle;
}

.stock-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

.stock-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.stock-dot.in-stock {
    background: var(--success-color);
}

.stock-dot.out-of-stock {
    background: #ef4444;
}

.stock-text {
    font-weight: 600;
}

.stock-text.in-stock {
    color: #065f46;
}

.stock-text.out-of-stock {
    color: #991b1b;
}

.purchase-actions-card {
    padding: 2rem;
    border-radius: var(--radius-lg);
    background: var(--surface-color);
    box-shadow: var(--shadow);
}

.quantity-control-wrapper {
    display: inline-flex;
    align-items: center;
    overflow: hidden;
    border: 2px solid #cbd5e1;
    border-radius: 8px;
    background: var(--surface-color);
}

.quantity-control-btn {
    padding: 0.5rem 1.25rem;
    border: none;
    background: var(--surface-elevated);
    color: var(--primary-color);
    cursor: pointer;
    font-size: 1.5rem;
    font-weight: bold;
    transition: background 0.2s;
}

.quantity-control-btn.minus {
    border-right: 1px solid #cbd5e1;
}

.quantity-control-btn.plus {
    border-left: 1px solid #cbd5e1;
}

.quantity-input-field {
    width: 80px;
    padding: 0.5rem 0;
    border: none;
    outline: none;
    color: var(--text-color);
    font-size: 1.25rem;
    font-weight: 700;
    text-align: center;
}

.gallery-thumbnails {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding: 0.5rem 0;
    transition: transform var(--transition);
}

.thumb-item {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border: 2px solid transparent;
    border-radius: var(--radius-lg);
    background-color: transparent;
    background-repeat: no-repeat;
    background-position: center center;
    background-size: contain;
    cursor: pointer;
    transition: all var(--transition);
}

.thumb-item:hover {
    border-color: var(--border-color);
    transform: translateY(-2px);
}

.thumb-item.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.lightbox-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    cursor: zoom-out;
}

.lightbox-overlay.active {
    display: flex;
}

.lightbox-content {
    max-width: 90%;
    max-height: 90%;
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.lightbox-overlay.active .lightbox-content {
    transform: scale(1);
}

.lightbox-img {
    max-width: 100%;
    max-height: 90vh;
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
    position: absolute;
    top: 2rem;
    right: 2rem;
    color: var(--header-text-color, var(--text-on-dark));
    font-size: 2.5rem;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity var(--transition);
}

.lightbox-close:hover {
    opacity: 1;
}

@media (max-width: 1024px) {
    .product-detail-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .category-grid,
    .product-grid {
        display: flex;
        flex-direction: row;
        gap: 1.25rem;
        overflow-x: auto;
        padding: 0.1rem 0.5rem 2rem;
        scroll-padding-inline: 1rem;
        scroll-snap-type: x proximity;
        scrollbar-width: none;
        overscroll-behavior-x: contain;
        -webkit-overflow-scrolling: touch;
    }

    .category-grid::-webkit-scrollbar,
    .product-grid::-webkit-scrollbar {
        display: none;
    }

    .category-grid .category-tile,
    .product-grid .product-card {
        flex: 0 0 78%;
        max-width: 320px;
        scroll-snap-align: start;
    }

    .category-grid {
        flex-wrap: nowrap;
    }
}

@media (max-width: 768px) {
    .carousel-btn {
        display: none;
    }

    .carousel-item {
        width: 240px;
    }
}

.detail-gallery-placeholder,
.detail-note-card,
.combo-config-note,
.combo-component-card,
.combo-component-list,
.combo-component-meta,
.combo-selection-list,
.combo-selection-empty,
.combo-selection-item,
.combo-selection-item__media,
.combo-selection-item__summary,
.combo-selection-item__model,
.combo-variant-row,
.combo-variant-row__content,
.combo-variant-row__stock,
.combo-variant-row__actions {
    display: block;
}

.detail-gallery-placeholder {
    margin-top: 1rem;
    padding: 1rem;
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
    color: #64748b;
    text-align: center;
}

.detail-gallery-placeholder.is-hidden {
    display: none;
}

.gallery-thumbnails.is-hidden {
    display: none;
}

.detail-note-card {
    margin-bottom: 1rem;
}

.detail-note-card p {
    margin: 0;
}

.product-detail-hero-img.has-dynamic-bg,
.thumb-item.has-dynamic-bg,
.combo-selection-item__media.has-dynamic-bg {
    background-image: var(--dynamic-bg-image);
}

.product-detail-hero-img--empty {
    background: var(--color-page-bg, var(--background-color));
}

.add-to-cart.is-added,
.add-combo-to-cart.is-added {
    background: var(--success-color, #10b981);
    color: var(--button-text-color);
}

.product-detail-info .stock-indicator,
.product-info-side .stock-indicator {
    margin-bottom: 1rem;
}

.product-description-block,
.price-wrapper-block,
.combo-component-wrapper,
.combo-config-note {
    margin-bottom: 1.5rem;
}

.combo-component-card {
    padding: 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: var(--surface-color);
}

.combo-component-list {
    display: grid;
    gap: 1rem;
}

.combo-component-meta {
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 0.35rem;
}

.combo-component-helper {
    font-size: 0.95rem;
    color: #475569;
}

.combo-component-helper + .combo-component-helper {
    margin-top: 0.35rem;
}

.combo-component-selection-status {
    font-size: 0.85rem;
    color: var(--status-warning-color);
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.combo-component-selection-status.is-complete {
    color: var(--success-color);
}

.combo-selection-list {
    display: grid;
    gap: 0.5rem;
    margin-bottom: 0.85rem;
}

.combo-selection-empty {
    font-size: 0.85rem;
    color: #64748b;
    padding: 0.75rem;
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
}

.combo-selection-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: var(--surface-color);
}

.combo-selection-item__summary {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.combo-selection-item__media {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background-color: var(--surface-warm);
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    flex-shrink: 0;
}

.combo-selection-item__model {
    font-size: 0.8rem;
    color: #64748b;
}

.combo-variant-grid {
    display: grid;
    gap: 0.75rem;
}

.combo-variant-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: var(--surface-warm);
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.combo-variant-row.is-active {
    border-color: var(--primary-color);
    background: color-mix(in srgb, var(--primary-color) 10%, var(--surface-color));
    box-shadow: 0 6px 18px color-mix(in srgb, var(--primary-color) 24%, transparent);
}

.combo-variant-row__content {
    flex: 1;
}

.combo-variant-row__content strong {
    display: block;
    color: #0f172a;
}

.combo-variant-row__stock {
    font-size: 0.85rem;
    color: #64748b;
}

.combo-variant-selected-count {
    font-size: 0.8rem;
    color: var(--success-color);
    margin-top: 0.3rem;
}

.combo-variant-row__actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-end;
}

.combo-variant-preview-btn,
.combo-variant-add-btn,
.combo-selection-remove-btn {
    padding: 0.45rem 0.8rem;
    font-size: 0.85rem;
}

.combo-config-note {
    padding: 1rem 1.25rem;
    background: color-mix(in srgb, var(--status-warning-color) 12%, var(--surface-color));
    border: 1px solid var(--status-warning-color);
    border-radius: 12px;
}

.combo-config-note strong {
    display: block;
    margin-bottom: 0.35rem;
}

.combo-config-note span {
    color: var(--status-warning-color);
}

@media (max-width: 768px) {
    .combo-selection-item,
    .combo-variant-row {
        flex-direction: column;
        align-items: stretch;
    }

    .combo-variant-row__actions {
        align-items: stretch;
    }

    .combo-variant-preview-btn,
    .combo-variant-add-btn,
    .combo-selection-remove-btn {
        width: 100%;
    }
}
