/**
 * Smart Merchandising Engine - Block Styles
 * 
 * CSS extracted from frozen reference (best-selling-image-rating v4.2.0)
 * Uses .sme- prefix instead of .bsir- for namespace separation
 */

/* ===== WRAPPER ===== */
.sme-wrapper {
    background: #fff;
    padding: 20px 0;
    border: 1px solid #e6e6e6;
    border-radius: 4px;
    margin: 10px;
}

.sme-title {
    font-size: 22px;
    font-weight: 600;
    color: #0F1111;
    margin: 0 0 16px 0;
    padding: 0 20px;
}

/* ===== HORIZONTAL SCROLL VIEW ===== */
.sme-scroll-view {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding: 0 20px 10px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.sme-scroll-view::-webkit-scrollbar {
    display: none;
}

.sme-card {
    flex: 0 0 auto;
    width: 18%;
    min-width: 150px;
    background: #fff;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    border: 1px solid #e6e6e6;
    border-radius: 4px;
    padding: 10px;
}

.sme-img {
    width: 100%;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    overflow: hidden;
}

.sme-img img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.2s;
}

.sme-card:hover .sme-img img {
    transform: scale(1.05);
}

.sme-cat {
    font-size: 14px;
    color: #0F1111;
    margin: 0 0 4px;
    text-align: center;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sme-price {
    font-size: 15px;
    color: #0F1111;
    margin: 0;
}

.sme-price .woocommerce-Price-amount {
    font-weight: 700;
}

/* ===== 2x2 GRID VIEW ===== */
.sme-grid-view {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 0 16px;
}

.sme-grid-card {
    background: #fff;
    border: 1px solid #e6e6e6;
    border-radius: 6px;
    padding: 10px;
    text-decoration: none;
    display: flex;
    flex-direction: column;
}

.sme-grid-img {
    width: 100%;
    aspect-ratio: 5 / 4;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    overflow: hidden;
}

.sme-grid-img img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.sme-grid-cat {
    font-size: 13px;
    font-weight: 500;
    color: #0F1111;
    margin: 0 0 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
    width: 100%;
}

.sme-grid-price {
    font-size: 14px;
    color: #388e3c;
    font-weight: 600;
    margin: 0;
    text-align: center;
    width: 100%;
}

.sme-grid-price .woocommerce-Price-amount {
    color: #388e3c;
    font-weight: 600;
}

/* ===== LIST VIEW ===== */
.sme-list-view {
    display: flex;
    flex-direction: column;
    width: 100%;
    box-sizing: border-box;
}

.sme-list-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    text-decoration: none;
    border-bottom: 1px solid #e6e6e6;
    transition: background 0.15s;
    width: 100%;
    box-sizing: border-box;
}

.sme-list-item:last-child {
    border-bottom: none;
}

.sme-list-item:hover {
    background: #f9f9f9;
}

.sme-list-img {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 14px;
}

.sme-list-img img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.sme-list-info {
    flex: 1;
    min-width: 0;
}

.sme-list-cat {
    font-size: 15px;
    font-weight: 500;
    color: #0F1111;
    margin: 0 0 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sme-list-price {
    font-size: 13px;
    color: #565959;
    margin: 0;
}

.sme-list-price .woocommerce-Price-amount {
    font-weight: 600;
    color: #0F1111;
}

.sme-list-arrow {
    font-size: 24px;
    color: #888;
    margin-left: 10px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {

    /* Elementor container fix (progressive enhancement) */
    .elementor-widget-shortcode:has(.sme-wrapper),
    .elementor-shortcode:has(.sme-wrapper) {
        width: 100% !important;
        align-self: stretch !important;
    }

    .sme-wrapper {
        margin: 0;
        padding: 16px 0;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .sme-title {
        font-size: 18px;
        padding: 0 16px;
        margin-bottom: 12px;
    }

    /* Horizontal view adjusts for mobile */
    .sme-card {
        width: 40%;
        min-width: 120px;
    }
}

/* ===== PHASE C: ADVERTISEMENT STYLES ===== */

/* Large Advertisement (Grid-Level) */
.sme-large-ad {
    background: #fff;
}

.sme-large-ad-container {
    position: relative;
    padding: 0 16px;
}

.sme-large-ad-image {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 4px;
}

/* Small Advertisement (Slot-Level) */
.sme-small-ad {
    position: relative;
    cursor: pointer;
}

.sme-small-ad:hover {
    opacity: 0.95;
}

/* Sponsored Label */
.sme-sponsored-label {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 2px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Large Ad wrapper for grid pairs */
.sme-large-ad-wrapper {
    width: 100%;
}

.sme-large-ad-wrapper .sme-large-ad {
    flex: 1;
}

/* ===== PHASE D: BOOSTED PRODUCT STYLES ===== */

/* Boosted Product Card - inherits from sme-grid-card */
.sme-boosted-card {
    position: relative;
    /* Allows for future positioning of badges if needed */
}

/* Rating display */
.sme-rating {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-bottom: 4px;
}

.sme-rating-stars {
    color: #ffa500;
    font-size: 12px;
    letter-spacing: 1px;
}

.sme-rating-count {
    font-size: 11px;
    color: #666;
}

/* ===== PHASE E: SEMANTIC CSS HOOKS (Frozen v1) ===== */

/**
 * ============================================================================
 * SMART MERCHANDISING SYSTEM — CSS BEHAVIOR FROZEN (v1)
 * ============================================================================
 * 
 * Semantic class hooks for external styling and tracking.
 * These classes are applied automatically based on content type.
 * 
 * DO NOT REMOVE OR RENAME THESE CLASSES.
 * ============================================================================
 */

/* Grid semantic hooks - for targeting specific grid types */
.sme-grid-slot {
    /* Applied to individual slots within grids */
    position: relative;
}

.sme-large-ad-grid {
    /* Applied to grids that are full-size advertisements */
    width: 100%;
}

/* Boosted product semantic hook */
.sme-boosted-product {
    /* Applied to boosted product cards - no "Sponsored" label */
    position: relative;
}

/* Sponsored label refinement - adds z-index to Phase C definition */
.sme-sponsored-label {
    z-index: 1;
}

/* Small ad card - subtle sponsored indication */
.sme-small-ad .sme-grid-cat {
    color: #888;
    font-size: 11px;
}

/* Large ad sponsored label position */
.sme-large-ad .sme-sponsored-label {
    top: 8px;
    right: 24px;
    font-size: 11px;
    padding: 3px 8px;
}

/* ============================================================================
 * END OF SMART MERCHANDISING SYSTEM CSS — v1 FROZEN
 * ============================================================================ */