/**
 * MLWindow2 Product Showcase - Styles
 *
 * @package MLWindow2_Core
 */

/* ========================================
   CSS Variables
   ======================================== */
:root {
    --mlw-showcase-primary: #1a1a1a;
    --mlw-showcase-text: #333333;
    --mlw-showcase-text-muted: #666666;
    --mlw-showcase-border: #e0e0e0;
    --mlw-showcase-bg: #ffffff;
    --mlw-showcase-badge-sale: #e53935;
    --mlw-showcase-badge-featured: #f59e0b;
    --mlw-showcase-badge-new: #22c55e;
    --mlw-showcase-transition: 0.3s ease;
}

/* ========================================
   Title
   ======================================== */
.mlw-showcase-title {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 500;
    color: var(--mlw-showcase-primary);
    margin-bottom: 2rem;
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* ========================================
   Grid Layout
   ======================================== */
.mlw-showcase {
    width: 100%;
    margin: 0 auto;
}

.mlw-grid {
    display: grid;
    grid-template-columns: repeat(var(--mlw-cols, 4), 1fr);
    gap: var(--mlw-gap, 20px);
}

@media (max-width: 1024px) {
    .mlw-grid {
        grid-template-columns: repeat(var(--mlw-cols-tablet, 3), 1fr);
    }
}

@media (max-width: 767px) {
    .mlw-grid {
        grid-template-columns: repeat(var(--mlw-cols-mobile, 2), 1fr);
    }
}

/* ========================================
   Product Card
   ======================================== */
.mlw-product-card {
    position: relative;
    background: var(--mlw-showcase-bg);
    transition: transform var(--mlw-showcase-transition), box-shadow var(--mlw-showcase-transition);
}

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

/* ========================================
   Product Image
   ======================================== */
.mlw-product-image {
    position: relative;
    overflow: hidden;
    background: #f5f5f5;
}

.mlw-product-image a {
    display: block;
}

.mlw-product-image img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.4s ease;
}

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

/* Image Ratios */
.mlw-ratio-square {
    aspect-ratio: 1 / 1;
}

.mlw-ratio-portrait {
    aspect-ratio: 3 / 4;
}

.mlw-ratio-landscape {
    aspect-ratio: 4 / 3;
}

.mlw-ratio-square img,
.mlw-ratio-portrait img,
.mlw-ratio-landscape img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ========================================
   Badges
   ======================================== */
.mlw-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #ffffff;
    z-index: 2;
}

.mlw-badge-sale {
    background: var(--mlw-showcase-badge-sale);
}

.mlw-badge-featured {
    background: var(--mlw-showcase-badge-featured);
}

.mlw-badge-new {
    background: var(--mlw-showcase-badge-new);
}

/* ========================================
   Hover Icons
   ======================================== */
.mlw-hover-icons {
    position: absolute;
    top: 50%;
    right: -50px;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 6px !important;
    transition: right 0.3s ease;
    z-index: 3;
}

/* Homepage showcase - icons at bottom center */
.mlw-product-card .mlw-hover-icons,
.mlw-product-image .mlw-hover-icons {
    top: auto;
    right: auto;
    bottom: -50px;
    left: 50%;
    transform: translateX(-50%);
    flex-direction: row;
    gap: 8px !important;
    transition: bottom 0.3s ease;
}

.mlw-product-card:hover .mlw-hover-icons {
    right: auto;
    bottom: 12px;
}

/* Override wishlist button styles in showcase context */
.mlw-hover-icons .lw-wishlist-btn,
.mlw-hover-icons .lw-wishlist-btn.mlw-icon,
.mlw-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: #ffffff !important;
    border: none !important;
    border-radius: 50%;
    color: var(--mlw-showcase-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.mlw-hover-icons .lw-wishlist-btn:hover,
.mlw-hover-icons .lw-wishlist-btn.mlw-icon:hover,
.mlw-icon:hover {
    background: var(--mlw-showcase-primary) !important;
    color: #ffffff !important;
    transform: scale(1.1);
}

.mlw-hover-icons .lw-wishlist-btn:hover svg,
.mlw-hover-icons .lw-wishlist-btn.mlw-icon:hover svg,
.mlw-icon:hover svg {
    stroke: #ffffff !important;
}

/* Wishlist active state in hover icons */
.mlw-hover-icons .lw-wishlist-btn.is-active,
.mlw-hover-icons .lw-wishlist-btn.mlw-icon.is-active {
    background: #e53935 !important;
    color: #ffffff !important;
}

.mlw-hover-icons .lw-wishlist-btn.is-active svg,
.mlw-hover-icons .lw-wishlist-btn.mlw-icon.is-active svg {
    fill: #ffffff !important;
    stroke: #ffffff !important;
}

.mlw-hover-icons .lw-wishlist-btn.is-active:hover,
.mlw-hover-icons .lw-wishlist-btn.mlw-icon.is-active:hover {
    background: #c62828 !important;
}

.mlw-icon svg {
    width: 18px;
    height: 18px;
}

/* ========================================
   Product Info
   ======================================== */
.mlw-product-info {
    padding: 15px 5px;
}

.mlw-product-title {
    font-family: 'DM Sans', -apple-system, sans-serif;
    font-size: 14px;
    font-weight: 500;
    margin: 0 0 8px 0;
    line-height: 1.4;
}

.mlw-product-title a {
    color: var(--mlw-showcase-text);
    text-decoration: none;
    transition: color 0.2s ease;
}

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

.mlw-product-rating {
    margin-bottom: 8px;
}

.mlw-product-rating .star-rating {
    font-size: 12px;
}

.mlw-product-price {
    font-family: 'DM Sans', -apple-system, sans-serif;
    font-size: 15px;
    font-weight: 600;
    color: var(--mlw-showcase-primary);
}

.mlw-product-price del {
    color: var(--mlw-showcase-text-muted);
    font-weight: 400;
    margin-right: 5px;
}

.mlw-product-price ins {
    text-decoration: none;
    color: var(--mlw-showcase-badge-sale);
}

/* ========================================
   Add to Cart Button
   ======================================== */
.mlw-product-button {
    margin-top: 12px;
}

.mlw-add-to-cart {
    display: inline-block;
    padding: 10px 20px;
    background: var(--mlw-showcase-primary);
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-decoration: none;
    transition: background 0.2s ease;
}

.mlw-add-to-cart:hover {
    background: #333333;
    color: #ffffff;
}

/* ========================================
   Carousel Layout (Swiper)
   ======================================== */
.mlw-layout-carousel {
    position: relative;
}

.mlw-swiper {
    overflow: hidden;
}

.mlw-swiper .swiper-slide {
    height: auto;
}

/* Navigation Arrows */
.mlw-arrow {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    color: var(--mlw-showcase-primary);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.mlw-arrow::after {
    font-size: 16px;
    font-weight: 700;
}

.mlw-arrow:hover {
    background: var(--mlw-showcase-primary);
    color: #ffffff;
}

.mlw-arrow.swiper-button-disabled {
    opacity: 0.3;
    pointer-events: none;
}

/* Pagination Dots */
.mlw-dots {
    margin-top: 20px;
}

.mlw-dots .swiper-pagination-bullet {
    width: 10px;
    height: 10px;
    background: var(--mlw-showcase-border);
    opacity: 1;
    transition: all 0.2s ease;
}

.mlw-dots .swiper-pagination-bullet-active {
    background: var(--mlw-showcase-primary);
    transform: scale(1.2);
}

/* ========================================
   Auto-Shuffle Transitions
   ======================================== */
.mlw-auto-shuffle .mlw-product-card {
    transition: opacity 0.5s ease, transform 0.5s ease;
}

/* Fade transition */
.mlw-shuffle-fade .mlw-product-card.mlw-shuffling {
    opacity: 0;
}

/* Slide transition */
.mlw-shuffle-slide .mlw-product-card.mlw-shuffling {
    transform: translateY(20px);
    opacity: 0;
}

/* Flip transition */
.mlw-shuffle-flip .mlw-product-card.mlw-shuffling {
    transform: rotateY(90deg);
    opacity: 0;
}

/* Zoom transition */
.mlw-shuffle-zoom .mlw-product-card.mlw-shuffling {
    transform: scale(0.8);
    opacity: 0;
}

/* ========================================
   No Products Message
   ======================================== */
.mlw-showcase-empty {
    text-align: center;
    padding: 40px;
    color: var(--mlw-showcase-text-muted);
    font-style: italic;
}

/* ========================================
   Quick View Panel
   ======================================== */
.mlw-qv-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.mlw-qv-overlay.active {
    opacity: 1;
    visibility: visible;
}

.mlw-qv-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 480px;
    max-width: 100%;
    height: 100vh;
    background: #ffffff;
    z-index: 99999;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    box-shadow: -8px 0 30px rgba(0, 0, 0, 0.15);
}

.mlw-qv-panel.active {
    transform: translateX(0);
}

.mlw-qv-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    background: #f5f5f5;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
}

.mlw-qv-close:hover {
    background: #1a1a1a;
    color: #ffffff;
}

.mlw-qv-close svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

.mlw-qv-content {
    padding: 24px;
    min-height: 100%;
}

.mlw-qv-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

.mlw-qv-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f0f0f0;
    border-top-color: #1a1a1a;
    border-radius: 50%;
    animation: mlw-spin 0.8s linear infinite;
}

@keyframes mlw-spin {
    to { transform: rotate(360deg); }
}

/* Quick View Product Content */
.mlw-qv-image {
    width: 100%;
    margin-bottom: 24px;
    border-radius: 8px;
    overflow: hidden;
    background: #f5f5f5;
}

.mlw-qv-image img {
    width: 100%;
    height: auto;
    display: block;
}

.mlw-qv-gallery {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    overflow-x: auto;
    padding-bottom: 8px;
}

.mlw-qv-gallery-thumb {
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s ease;
}

.mlw-qv-gallery-thumb:hover,
.mlw-qv-gallery-thumb.active {
    border-color: #1a1a1a;
}

.mlw-qv-gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mlw-qv-title {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.75rem;
    font-weight: 600;
    margin: 0 0 12px 0;
    color: #1a1a1a;
    line-height: 1.3;
}

.mlw-qv-price {
    font-family: 'DM Sans', sans-serif;
    font-size: 1.25rem;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 16px;
}

.mlw-qv-price del {
    color: #999;
    font-weight: 400;
    margin-right: 8px;
}

.mlw-qv-price ins {
    text-decoration: none;
    color: #e53935;
}

.mlw-qv-description {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
    margin-bottom: 24px;
}

/* Variations */
.mlw-qv-variations {
    margin-bottom: 24px;
}

.mlw-qv-attribute {
    margin-bottom: 16px;
}

.mlw-qv-attribute-label {
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mlw-qv-attribute-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.mlw-qv-option {
    padding: 8px 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
}

.mlw-qv-option:hover {
    border-color: #1a1a1a;
}

.mlw-qv-option.selected {
    background: #1a1a1a;
    color: #fff;
    border-color: #1a1a1a;
}

.mlw-qv-option.unavailable {
    opacity: 0.35;
    cursor: not-allowed;
    text-decoration: line-through;
    background: #f5f5f5;
    color: #999;
}

.mlw-qv-option.unavailable:hover {
    border-color: #ddd;
    transform: none;
}

.mlw-qv-option:disabled {
    pointer-events: none;
}

/* Add to Cart */
.mlw-qv-add-to-cart {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.mlw-qv-quantity {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.mlw-qv-qty-btn {
    width: 40px;
    height: 44px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: #1a1a1a;
    transition: background 0.2s ease;
}

.mlw-qv-qty-btn:hover {
    background: #f5f5f5;
}

.mlw-qv-qty-input {
    width: 50px;
    height: 44px;
    border: none;
    text-align: center;
    font-size: 15px;
    -moz-appearance: textfield;
}

.mlw-qv-qty-input::-webkit-outer-spin-button,
.mlw-qv-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
}

.mlw-qv-cart-btn {
    flex: 1;
    height: 44px;
    background: #1a1a1a;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.mlw-qv-cart-btn:hover {
    background: #333;
}

.mlw-qv-cart-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Tags */
.mlw-qv-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 16px;
    border-top: 1px solid #eee;
}

.mlw-qv-tag {
    padding: 4px 12px;
    background: #f5f5f5;
    border-radius: 20px;
    font-size: 12px;
    color: #666;
    text-decoration: none;
    transition: all 0.2s ease;
}

.mlw-qv-tag:hover {
    background: #1a1a1a;
    color: #fff;
}

/* View Full Details Link */
.mlw-qv-view-full {
    display: block;
    text-align: center;
    padding: 16px;
    margin-top: 16px;
    color: #1a1a1a;
    font-size: 13px;
    text-decoration: underline;
    transition: color 0.2s ease;
}

.mlw-qv-view-full:hover {
    color: #666;
}

/* ========================================
   Responsive Adjustments
   ======================================== */
@media (max-width: 767px) {
    .mlw-showcase-title {
        font-size: 1.2em !important;
        margin-bottom: 1.5rem;
    }

    .mlw-product-info {
        padding: 10px 3px;
    }

    .mlw-product-title {
        font-size: 13px;
    }

    .mlw-product-price {
        font-size: 14px;
    }

    .mlw-arrow {
        width: 36px;
        height: 36px;
    }

    .mlw-arrow::after {
        font-size: 14px;
    }

    /* Hide hover icons on mobile */
    .mlw-hover-icons {
        display: none !important;
    }
}

@media (max-width: 540px) {
    .mlw-qv-panel {
        width: 100%;
    }

    .mlw-qv-content {
        padding: 16px;
        padding-top: 60px;
    }

    .mlw-qv-title {
        font-size: 1.4rem;
    }

    .mlw-qv-add-to-cart {
        flex-direction: column;
    }

    .mlw-qv-quantity {
        justify-content: center;
    }
}

/* ========================================
   Simple Toast Fallback
   ======================================== */
.mlw-simple-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    background: #333;
    color: #fff;
    border-radius: 4px;
    font-size: 14px;
    z-index: 999999;
    opacity: 0;
    transform: translateX(100px);
    transition: all 0.3s ease;
    max-width: 300px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.mlw-simple-toast.show {
    opacity: 1;
    transform: translateX(0);
}

.mlw-simple-toast.mlw-toast-success {
    background: #27ae60;
}

.mlw-simple-toast.mlw-toast-error {
    background: #e74c3c;
}

.mlw-simple-toast.mlw-toast-info {
    background: #3498db;
}
