/* © 2025 Spwig. All rights reserved. */

/* ==========================================================================
   Category Page - List Template
   Horizontal product rows with image left, info right.
   Uses --theme-element-category-* design tokens from the token system.
   Fallbacks use hardcoded values for graceful degradation.
   ========================================================================== */

/* ==========================================================================
   Product List Container
   ========================================================================== */

.cat-list-products {
    display: flex;
    flex-direction: column;
    gap: var(--theme-element-category-list-gap, 1.25rem);
}

/* ==========================================================================
   Product Row
   ========================================================================== */

.cat-list-row {
    display: flex;
    flex-direction: row;
    background: var(--theme-element-category-list-row-bg, #ffffff);
    border: var(--theme-element-category-list-row-border-width, 1px) solid var(--theme-element-category-list-row-border-color, #e5e7eb);
    border-radius: var(--theme-element-category-list-row-radius, 0.75rem);
    box-shadow: var(--theme-element-category-list-row-shadow, 0 1px 3px rgba(0, 0, 0, 0.06));
    overflow: hidden;
    transition: box-shadow var(--theme-element-category-list-row-transition-duration, 200ms) var(--theme-element-category-list-row-transition-easing, ease),
                transform var(--theme-element-category-list-row-transition-duration, 200ms) var(--theme-element-category-list-row-transition-easing, ease);
}

.cat-list-row:hover {
    box-shadow: var(--theme-element-category-list-row-shadow-hover, 0 8px 25px rgba(0, 0, 0, 0.1));
    transform: var(--theme-element-category-list-row-hover-transform, translateY(-1px));
}

/* Reversed layout: image on the right */
.cat-list-row--img-right {
    flex-direction: row-reverse;
}

/* ==========================================================================
   Product Image
   ========================================================================== */

.cat-list-row__image {
    flex: 0 0 var(--theme-element-category-list-image-width, 16rem);
    width: var(--theme-element-category-list-image-width, 16rem);
    aspect-ratio: var(--theme-element-category-list-image-aspect-ratio, 1);
    overflow: hidden;
    border-radius: var(--theme-element-category-list-image-radius, 0);
    background: var(--theme-element-category-list-image-bg, #f9fafb);
}

.cat-list-row__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--theme-element-category-list-image-transition-duration, 300ms) var(--theme-element-category-list-image-transition-easing, ease);
}

.cat-list-row:hover .cat-list-row__image img {
    transform: var(--theme-element-category-list-image-hover-transform, scale(1.03));
}

.cat-list-row__placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--theme-element-category-list-placeholder-size, 2.5rem);
    color: var(--theme-element-category-list-placeholder-color, #9ca3af);
}

/* ==========================================================================
   Product Info
   ========================================================================== */

.cat-list-row__info {
    flex: 1;
    padding: var(--theme-element-category-list-info-padding, 1.5rem);
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.cat-list-row__title {
    font-size: var(--theme-element-category-list-title-size, 1.25rem);
    font-weight: var(--theme-element-category-list-title-weight, 600);
    color: var(--theme-element-category-list-title-color, #1f2937);
    margin: 0 0 var(--theme-space-2, 0.5rem) 0;
    line-height: var(--theme-element-category-list-title-line-height, 1.3);
}

.cat-list-row__title a {
    color: inherit;
    text-decoration: none;
}

.cat-list-row__title a:hover {
    color: var(--theme-element-category-list-title-hover-color, #2563eb);
}

.cat-list-row__desc {
    font-size: var(--theme-element-category-list-desc-size, 0.9375rem);
    color: var(--theme-element-category-list-desc-color, #6b7280);
    line-height: var(--theme-element-category-list-desc-line-height, 1.6);
    margin: 0 0 var(--theme-space-3, 0.75rem) 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ==========================================================================
   Product Price
   ========================================================================== */

.cat-list-row__price {
    font-size: var(--theme-element-category-list-price-size, 1.125rem);
    font-weight: var(--theme-element-category-list-price-weight, 700);
    color: var(--theme-element-category-list-price-color, #1f2937);
    margin: 0 0 var(--theme-space-2, 0.5rem) 0;
}

/* ==========================================================================
   Product Actions
   ========================================================================== */

.cat-list-row__actions {
    margin-top: auto;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: var(--theme-element-category-list-actions-gap, 0.75rem);
    padding-top: var(--theme-space-3, 0.75rem);
}

/* ==========================================================================
   Empty State
   ========================================================================== */

.cat-list-empty {
    text-align: center;
    padding: var(--theme-space-12, 3rem) var(--theme-space-6, 1.5rem);
    color: var(--theme-element-category-list-empty-color, #6b7280);
}

.cat-list-empty i {
    font-size: var(--theme-element-category-list-empty-icon-size, 3rem);
    margin-bottom: var(--theme-space-4, 1rem);
    display: block;
    color: var(--theme-element-category-list-empty-icon-color, #d1d5db);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 768px) {
    .cat-list-row,
    .cat-list-row--img-right {
        flex-direction: column;
    }

    .cat-list-row__image {
        flex: 0 0 auto;
        width: 100%;
        aspect-ratio: var(--theme-element-category-list-image-mobile-aspect-ratio, 16 / 9);
    }

    .cat-list-row__info {
        padding: var(--theme-element-category-list-info-mobile-padding, 1rem);
    }

    .cat-list-row__title {
        font-size: var(--theme-element-category-list-title-mobile-size, 1.125rem);
    }

    .cat-list-row__actions {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .cat-list-row__info {
        padding: var(--theme-element-category-list-info-xs-padding, 0.75rem);
    }
}

/* ==========================================================================
   Reduced Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .cat-list-row,
    .cat-list-row__image img {
        transition: none;
    }
}
