/**
 * AliExpress Widget Styles
 *
 * Production-ready design with rating and orders
 *
 * @package MyChooz_Partners
 * @since 0.4.0
 */

/* ========================================
   WIDGET: Production Ready (560px)
   ======================================== */

/* Clean CSS - removed unnecessary !important */
.mcp-widget {
    max-width: 560px !important;
    width: auto !important;
    margin: 0px auto;
    position: relative;
    transition: all .3s ease;

    /* Container Queries - адаптация к ширине контейнера, а не viewport */
    container-type: inline-size;
    container-name: mcp-widget;
}

/* Multiwidget: compact layout - overlap borders */
.mcp-multiwidget-container .mcp-widget .mcp-product {
    margin-top: 0;
    border-radius: 0;
}

.mcp-multiwidget-container .mcp-widget:first-child .mcp-product {
    border-radius: 10px 10px 0 0;
}

.mcp-multiwidget-container .mcp-widget:last-child .mcp-product {
    border-radius: 0 0 10px 10px;
}

.mcp-multiwidget-container .mcp-widget:only-child .mcp-product {
    border-radius: 10px;
}

.mcp-multiwidget-container .mcp-widget:not(:first-child) .mcp-product {
    margin-top: -2px;
}

/* Disable lift effect in multiwidget */
.mcp-multiwidget-container .mcp-widget:hover {
    transform: none;
}

.mcp-widget:hover {
    transform: translateY(-2px);
}

.mcp-widget .mcp-product {
    display: grid !important;
    grid-template-columns: 95px 1fr 162px;
    align-items: stretch;
    gap: 11px;
    height: 95px;
    padding: 0;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    transition: all .3s ease;
    background: #ffffff;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    position: relative;
    margin-top: 14px;
    z-index: 1;
    box-sizing: border-box;
    cursor: pointer;
}

.mcp-widget .mcp-product:hover {
    border-color: #ff6b35;
    box-shadow: 0 8px 30px rgba(255, 107, 53, .18);
    text-decoration: none !important;
    z-index: 10;
}

.mcp-widget .mcp-product:hover * {
    text-decoration: none !important;
}

.mcp-widget .mcp-product:hover .mcp-original-price {
    text-decoration: line-through !important;
}

/* Badge styles moved to assets/css/badge.css (single source of truth) */

/* Left: Image */
.mcp-widget .mcp-product-image {
    width: 95px;
    height: 91px;
    flex-shrink: 0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mcp-widget .mcp-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px 0 0 8px;
    display: block;
}

/* Center: Content */
.mcp-widget .mcp-product-body {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 8px 0;
    min-width: 0;
    height: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

/* Zone 1: Title (25%) */
.mcp-widget .mcp-title-zone {
    flex: 25;
    display: flex;
    align-items: center;
    min-height: 0;
}

.mcp-widget .mcp-product-title {
    font-size: 15px;
    font-weight: 700;
    color: #1a202c;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
}

/* Zone 2: Price (55%) */
.mcp-widget .mcp-price-zone {
    flex: 55;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-height: 0;
}

.mcp-widget .mcp-price-row {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
}

.mcp-widget .mcp-product-price {
    font-size: 27px;
    font-weight: 800;
    color: #E53E3E;
    line-height: 1;
    margin: 0;
    padding: 0;
}

.mcp-widget .mcp-check-price {
    font-size: 16px;
    font-weight: 600;
    color: #64748b;
    line-height: 1;
    margin: 0;
    padding: 0;
}

.mcp-widget .mcp-original-price {
    font-size: 14px;
    color: #94a3b8;
    text-decoration: line-through;
    font-weight: 500;
    line-height: 1;
    margin: 0;
    padding: 0;
}

.mcp-widget .mcp-discount {
    background: #6b7280;
    color: #fff;
    padding: 4px 8px;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    box-shadow: 0 2px 6px rgba(107, 114, 128, .2);
    vertical-align: baseline;
    display: inline-block;
    margin: 0;
}

/* Zone 3: Info (20%) - Rating + Orders */
.mcp-widget .mcp-info-zone {
    flex: 20;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    line-height: 1;
    flex-wrap: nowrap;
}

.mcp-widget .mcp-info-zone > * {
    flex-shrink: 0;
    white-space: nowrap;
    margin: 0;
    line-height: 1;
    display: inline-flex;
}

/* Star rating - individual stars method */
.mcp-widget .mcp-stars {
    display: inline-flex;
    align-items: center;
    gap: 1px;
    font-size: 12px;
    line-height: 1;
    vertical-align: middle;
}

.mcp-widget .mcp-star-item {
    position: relative;
    display: inline-block;
}

.mcp-widget .mcp-star-bg {
    color: rgba(0, 0, 0, 0.15);
}

.mcp-widget .mcp-star-fill {
    position: absolute;
    top: 0;
    left: 0;
    color: #64748b;
    overflow: hidden;
}

.mcp-widget .mcp-rating-text,
.mcp-widget .mcp-orders-text {
    color: #64748b;
    font-weight: 500;
    font-size: 11px;
    line-height: 1;
    margin: 0;
    padding: 0;
}

/* Amazon info-zone text - same style as AliExpress rating/orders */
.mcp-widget .mcp-rank-text,
.mcp-widget .mcp-warranty-text {
    color: #64748b;
    font-weight: 500;
    font-size: 11px;
    line-height: 1;
    margin: 0;
    padding: 0;
}

.mcp-widget .mcp-separator {
    color: #cbd5e1;
    font-size: 11px;
    line-height: 1;
    margin: 0;
    padding: 0;
}

/* Right: CTA Button */
.mcp-widget .mcp-product-cta {
    width: 162px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 22px 11px 14px;
    box-sizing: border-box;
}

.mcp-widget .mcp-product-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 100%;
    height: 59px;
    background: #cf2e2e;
    border: none;
    color: #ffffff !important;
    padding: 0 18px;
    border-radius: 9px;
    box-sizing: border-box;
    font-size: 16px;
    font-weight: 800;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: .5px;
    transition: all .3s ease;
    box-shadow: none;
}

/* Force white color for link buttons (Amazon uses <a>, AliExpress uses <span>) */
.mcp-widget a.mcp-product-button,
.mcp-widget a.mcp-product-button:link,
.mcp-widget a.mcp-product-button:visited,
.mcp-widget a.mcp-product-button:hover,
.mcp-widget a.mcp-product-button:active {
    color: #ffffff !important;
}

.mcp-widget .mcp-product-button::before {
    content: '🛒';
    font-size: 15px;
    filter: brightness(0) invert(1);
}

/* Hover эффект кнопки */
.mcp-widget .mcp-product:hover .mcp-product-button {
    background: #b71c1c;
}

/* ========================================
   RESPONSIVE: Container Queries
   Адаптация к ширине контейнера, а не viewport
   ======================================== */

@container mcp-widget (max-width: 500px) {
    /* Badge styles in assets/css/badge.css */

    /* Main grid: Image 1/3 | Content 2/3 */
    .mcp-widget .mcp-product {
        grid-template-columns: 1fr 2fr;  /* 33% | 67% */
        grid-template-rows: 17% 10% 35% 38%; /* 4 строки: Title(17)/Rating(10)/Price(35)/Button(38) */
        height: 126px;  /* Целевая высота для мобайла (140px - 10%) */
        padding: 7px;   /* Было 8px (-10%) */
        row-gap: 0;     /* Без промежутков между строками */
        column-gap: 7px; /* Отступ между картинкой и контентом (8px - 10%) */
    }

    /* Image - вся левая колонка (4 строки) */
    .mcp-widget .mcp-product-image {
        grid-column: 1;
        grid-row: 1 / 5;  /* Растянуть на все 4 строки */
        width: 100%;
        height: 100%;
    }

    .mcp-widget .mcp-product-image img {
        width: 100%;
        height: 100%;
        object-fit: contain; /* Квадратная картинка, без обрезки */
        border-radius: 8px 0 0 8px;
    }

    /* Body - убрать обертку, используем прямые grid */
    .mcp-widget .mcp-product-body {
        display: contents;  /* Разбить на элементы */
    }

    /* СТРОКА 1 (17%) - Заголовок: 20.4px */
    .mcp-widget .mcp-title-zone {
        grid-column: 2;
        grid-row: 1;
        display: flex;
        align-items: center;
        justify-content: center; /* По центру */
        flex: none;
        min-height: 0;
    }

    .mcp-widget .mcp-product-title {
        font-size: 16px;
        line-height: 1.1;
        -webkit-line-clamp: 1;
        text-align: center;
    }

    /* СТРОКА 2 (10%) - Rating + Orders: 12.0px */
    .mcp-widget .mcp-info-zone {
        grid-column: 2;
        grid-row: 2;
        display: flex;
        align-items: center;
        justify-content: center; /* По центру */
        gap: 6px;
        font-size: 12px;
        flex: none;
    }

    /* СТРОКА 3 (35%) - Цена: 42.0px */
    .mcp-widget .mcp-price-zone {
        grid-column: 2;
        grid-row: 3;
        display: flex;
        align-items: center;
        justify-content: center; /* По центру */
        flex: none;
    }

    .mcp-widget .mcp-price-row {
        display: flex;
        align-items: center;
        gap: 6px; /* Увеличено с 4px */
        flex-wrap: wrap;
    }

    .mcp-widget .mcp-product-price {
        font-size: clamp(16px, 8cqw, 20px);  /* Container Units - адаптивный размер */
        white-space: nowrap; /* Запрет переноса только для цены */
    }

    .mcp-widget .mcp-original-price {
        font-size: 13px;  /* Уменьшено на 25% от 17px */
    }

    .mcp-widget .mcp-discount {
        font-size: 14px;  /* +10% from 13px */
        padding: 2px 6px;
    }

    .mcp-widget .mcp-stars {
        font-size: 9px; /* Mobile stars size */
        background: #ffffff; /* Белый фон для звезд */
        padding: 2px 4px;
        border-radius: 4px;
    }

    /* Серые звезды на мобайл */
    .mcp-widget .mcp-star-bg {
        color: rgba(0, 0, 0, 0.15); /* Серый фон звезды */
    }

    .mcp-widget .mcp-star-fill {
        color: #64748b; /* Серые заполненные звезды */
    }

    .mcp-widget .mcp-rating-text,
    .mcp-widget .mcp-orders-text {
        font-size: 10px; /* Чуть мельче (было 11px) */
        color: #64748b; /* Серый цвет (меньше акцента) */
    }

    .mcp-widget .mcp-separator {
        color: #cbd5e1; /* Светло-серый разделитель */
    }

    /* СТРОКА 4 (38%) - Button: 45.6px */
    .mcp-widget .mcp-product-cta {
        grid-column: 2;
        grid-row: 4;
        width: 100%;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .mcp-widget .mcp-product-button {
        width: 100%;
        height: 100%;
        font-size: 14px;
        padding: 0 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
    }

    .mcp-widget .mcp-product-button::before {
        font-size: 14px;
    }
}
