/**
 * Mobile Widget Final Version
 * Structure: 100x100 image | content with rating
 * Height: 100-105px for better density
 * Min font: 12px for readability
 */

/* Mobile-first approach */
@media (max-width: 640px) {
    /* Container */
    .mcp-widget-group {
        display: flex;
        flex-direction: column;
        gap: 10px;
        padding: 10px;
        background: #f5f5f5;
    }
    
    /* Main widget card - with store info at bottom */
    .mcp-widget .mcp-product {
        display: grid;
        grid-template-columns: 100px 1fr;
        grid-template-rows: 54px 43px 10px;  /* Added 10px row for store */
        min-height: 107px;
        padding: 0;
        border: 1px solid #e0e0e0;
        border-radius: 10px;
        background: #fff;
        overflow: hidden;
        box-shadow: 0 1px 3px rgba(0,0,0,0.08);
        transition: transform 0.15s ease;
        cursor: pointer;
        position: relative;
    }
    
    /* Touch feedback - subtle */
    .mcp-widget .mcp-product:active {
        transform: scale(0.98);
        box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    }
    
    /* Left side - Image */
    .mcp-widget .mcp-product-image {
        grid-row: 1 / 4;  /* Span all 3 rows */
        width: 100px;
        background: #fafafa;
        display: flex;
        align-items: center;
        justify-content: center;
        border-right: 1px solid #eeeeee;
        padding: 4px;
        box-sizing: border-box;
        position: relative;
        border-radius: 10px 0 0 10px;
        overflow: hidden;
    }
    
    .mcp-widget .mcp-product-image img {
        width: 100%;
        height: 100%;
        object-fit: contain;
        max-width: 92px;
        max-height: 92px;
    }
    
    /* Top right - Body section (price only now) */
    .mcp-widget .mcp-product-body {
        grid-column: 2;
        grid-row: 1;
        padding: 12px 12px 8px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        border-bottom: 1px solid #eeeeee;
        box-sizing: border-box;
    }
    
    /* Hide title on mobile */
    .mcp-widget .mcp-product-title {
        display: none !important;
    }
    
    /* Hide store info in body - will move to CTA */
    .mcp-widget .mcp-product-body .mcp-store-info {
        display: none !important;
    }
    
    /* Hide old store name in body */
    .mcp-widget .mcp-shop-name {
        display: none !important;
    }
    
    /* Hide rating completely */
    .mcp-widget .mcp-product-rating {
        display: none !important;
    }
    
    /* Price section */
    .mcp-widget .mcp-price-row {
        display: flex;
        align-items: center;
        gap: 6px;
        margin-top: auto;
        padding-bottom: 2px;
    }
    
    /* Current price */
    .mcp-widget .mcp-product-price {
        font-size: 22px !important;
        font-weight: 700;
        color: #111;
        line-height: 1;
        letter-spacing: -0.5px;
    }
    
    /* Original price - fix strikethrough visibility */
    .mcp-widget .mcp-original-price {
        font-size: 13px;
        color: #999;
        text-decoration: line-through;
        text-decoration-thickness: 1px;
        line-height: 1.3;
        position: relative;
    }
    
    /* Discount badge - next to price */
    .mcp-widget .mcp-discount {
        display: inline-block;
        padding: 2px 5px;
        background: #ff4747;
        color: white;
        font-size: 12px;
        font-weight: 600;
        border-radius: 3px;
        line-height: 1;
    }
    
    /* Button section - only button now */
    .mcp-widget .mcp-product-cta {
        grid-column: 2;
        grid-row: 2;
        padding: 6px 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: #fafafa;
        box-sizing: border-box;
    }
    
    /* Store info - separate row at bottom */
    .mcp-widget .mcp-product-store {
        grid-column: 2;
        grid-row: 3;
        height: 10px;
        padding: 0 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 4px;
        font-size: 8px;
        color: #aaa;
        background: #f5f5f5;
        border-radius: 0 0 10px 0;
        overflow: hidden;
        line-height: 1;
    }
    
    .mcp-widget .mcp-store-badge {
        display: inline-block;
        padding: 0 3px;
        background: #ffb380;
        color: white;
        font-size: 7px;
        font-weight: 500;
        border-radius: 2px;
        line-height: 1;
        height: 8px;
        display: inline-flex;
        align-items: center;
    }
    
    .mcp-amazon-widget .mcp-store-badge {
        background: #4a5568;
        color: #ffc266;
    }
    
    /* Buy button - can be bigger now */
    .mcp-widget .mcp-product-button {
        width: 100%;
        height: 30px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: linear-gradient(135deg, #ff6900, #ff4747);
        color: white !important;
        font-size: 14px;
        font-weight: 600;
        border: none;
        border-radius: 6px;
        text-decoration: none;
        text-transform: uppercase;
        letter-spacing: 0.3px;
        box-shadow: 0 1px 3px rgba(255, 71, 71, 0.2);
        transition: all 0.15s ease;
    }
    
    /* Check price button variant */
    .mcp-widget .mcp-btn-check-price {
        background: linear-gradient(135deg, #4CAF50, #45a049);
    }
    
    /* Button active state */
    .mcp-widget .mcp-product-button:active {
        transform: scale(0.96);
        box-shadow: 0 1px 2px rgba(255, 71, 71, 0.25);
    }
    
    /* Hide unnecessary elements */
    .mcp-widget .mcp-product-shipping {
        display: none !important;
    }
}

/* Adjustments for very small screens */
@media (max-width: 360px) {
    .mcp-widget .mcp-product {
        grid-template-rows: 52px 40px 10px;
        min-height: 102px;
    }
    
    .mcp-widget .mcp-product-image {
        /* Height controlled by grid */
        padding: 4px;
    }
    
    .mcp-widget .mcp-product-body {
        padding: 6px 10px 4px;
        /* Height controlled by grid */
    }
    
    .mcp-widget .mcp-product-cta {
        padding: 6px 10px 7px;
        /* Height controlled by grid */
    }
    
    .mcp-widget .mcp-product-price {
        font-size: 20px !important;
    }
    
    .mcp-widget .mcp-product-button {
        height: 30px;
        font-size: 13px;
    }
    
    .mcp-widget .mcp-rating-count {
        display: none; /* Hide count on very small screens */
    }
}

/* Landscape mode */
@media (max-width: 640px) and (orientation: landscape) {
    .mcp-widget .mcp-product {
        grid-template-rows: 45px 35px 10px;
        min-height: 90px;
    }
    
    .mcp-widget .mcp-product-image {
        /* Height controlled by grid */
        width: 90px;
    }
    
    .mcp-widget .mcp-product-body {
        /* Height controlled by grid */
        padding: 5px 10px 4px;
    }
    
    .mcp-widget .mcp-product-cta {
        /* Height controlled by grid */
        padding: 4px 10px;
    }
    
    .mcp-widget .mcp-product-price {
        font-size: 19px !important;
    }
    
    .mcp-widget .mcp-product-button {
        height: 28px;
        font-size: 12px;
    }
}

/* Dark mode support - ОТКЛЮЧЕНА */
/*
@media (prefers-color-scheme: dark) and (max-width: 640px) {
    .mcp-widget .mcp-product {
        background: #1a1a1a;
        border-color: #333;
    }

    .mcp-widget .mcp-product-body {
        border-bottom-color: #333;
    }

    .mcp-widget .mcp-product-image {
        background: #222;
        border-right-color: #333;
    }

    .mcp-widget .mcp-product-cta {
        background: #1a1a1a;
    }

    .mcp-widget .mcp-product-price {
        color: #fff;
    }

    .mcp-widget .mcp-shop-name {
        color: #aaa;
    }

    .mcp-widget .mcp-product-rating {
        color: #bbb;
    }
}
*/

/* Performance optimizations */
.mcp-widget img {
    will-change: transform;
    transform: translateZ(0);
}

.mcp-widget .mcp-product-button {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}