/**
 * MLWindow2 Product Tools - Frontend Styles
 *
 * @package MLWindow2_Product_Tools
 */

/* ========================================
   AJAX Search Input Field
   Elegant ivory/cream design for luxury aesthetic
   ======================================== */
.lw-search {
    position: relative;
    width: 100%;
}

.lw-search-field {
    position: relative;
    display: flex;
    align-items: center;
}

.lw-search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: #8b7355;
    pointer-events: none;
    z-index: 2;
    opacity: 0.7;
}

.lw-search-input {
    width: 100%;
    height: 46px;
    background: #faf8f5;
    border: 1px solid rgba(196, 163, 90, 0.25);
    border-radius: 100px;
    padding: 0 48px 0 50px;
    font-family: 'Jost', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 0.3px;
    color: #2c2c2c;
    outline: none;
    transition: all 0.3s ease;
}

.lw-search-input::placeholder {
    color: #9a8b7a;
    font-style: italic;
    font-weight: 300;
}

.lw-search-input:focus {
    background: #ffffff;
    border-color: rgba(196, 163, 90, 0.5);
    box-shadow: 0 0 0 3px rgba(196, 163, 90, 0.1), 0 4px 12px rgba(0,0,0,0.08);
}

.lw-search-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 50%;
    color: #9a8b7a;
    cursor: pointer;
    padding: 0;
    opacity: 0;
    transition: all 0.2s ease;
}

.lw-search-input:not(:placeholder-shown) ~ .lw-search-clear {
    opacity: 1;
}

.lw-search-clear:hover {
    color: #c4a35a;
    background: rgba(196, 163, 90, 0.1);
}

.lw-search-clear svg {
    width: 14px;
    height: 14px;
}

/* ========================================
   AJAX Search Dropdown
   ======================================== */
.lw-search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    margin-top: 8px;
    display: none;
    z-index: 9999;
    overflow: hidden;
}

.lw-search-dropdown.active {
    display: block;
}

.lw-search-content {
    display: flex;
    padding: 20px;
    gap: 24px;
}

.lw-search-col {
    flex: 1;
}

.lw-search-col h4 {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #888;
    margin: 0 0 12px;
}

/* Suggestions */
.lw-search-suggestions ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.lw-search-suggestions li {
    margin-bottom: 8px;
}

.lw-search-suggestions a {
    color: #333;
    text-decoration: none;
    font-size: 14px;
    display: block;
    padding: 6px 0;
    transition: color 0.2s;
}

.lw-search-suggestions a:hover {
    color: #000;
}

/* Product Grid */
.lw-search-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.lw-search-card {
    text-decoration: none;
    color: inherit;
}

.lw-search-card-img {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 8px;
}

.lw-search-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.lw-search-card-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    background: #e74c3c;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 3px;
}

.lw-search-card-info h5 {
    font-size: 12px;
    font-weight: 500;
    margin: 0 0 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lw-search-card-price {
    font-size: 11px;
    color: #666;
}

/* View All */
.lw-search-viewall {
    display: block;
    text-align: center;
    padding: 12px;
    border-top: 1px solid #eee;
    color: #000;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
}

.lw-search-viewall:hover {
    background: #f8f8f8;
}

/* Loader */
.lw-search-loader {
    display: none;
    padding: 40px;
    text-align: center;
}

.lw-search-loader.active {
    display: block;
}

.lw-search-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid #eee;
    border-top-color: #000;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

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

/* Empty State */
.lw-search-empty {
    display: none;
    text-align: center;
    padding: 40px 20px;
}

.lw-search-empty.active {
    display: block;
}

/* ========================================
   Search Results Page
   ======================================== */
.lw-search-results-page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 20px;
}

.lw-search-header {
    text-align: center;
    margin-bottom: 40px;
}

.lw-search-eyebrow {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #888;
}

.lw-search-title {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 2.5rem;
    font-weight: 500;
    margin: 12px 0;
    color: #1a1a1a;
}

.lw-search-underline {
    width: 60px;
    height: 2px;
    background: #e85a4f;
    margin: 0 auto 12px;
}

.lw-search-count {
    font-size: 14px;
    color: #666;
}

/* Search Results Grid */
.lw-search-results-page .lw-search-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

@media (max-width: 1024px) {
    .lw-search-results-page .lw-search-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .lw-search-results-page .lw-search-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
}

@media (max-width: 480px) {
    .lw-search-results-page .lw-search-grid {
        grid-template-columns: 1fr;
    }
}

.lw-search-item {
    text-align: center;
}

.lw-search-image {
    display: block;
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 12px;
    background: #f5f5f5;
}

.lw-search-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.lw-search-item:hover .lw-search-image img {
    transform: scale(1.05);
}

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

.lw-search-item:hover .mlw-hover-icons {
    right: 10px;
}

.lw-search-product-title {
    font-size: 14px;
    font-weight: 500;
    margin: 0;
    line-height: 1.4;
}

.lw-search-product-title a {
    color: #1a1a1a;
    text-decoration: none;
    transition: color 0.2s;
}

.lw-search-product-title a:hover {
    color: #e85a4f;
}

/* Search Pagination */
.lw-search-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 40px;
    flex-wrap: wrap;
}

.lw-search-pagination a,
.lw-search-pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
}

.lw-search-pagination a:hover {
    border-color: #1a1a1a;
    background: #1a1a1a;
    color: #fff;
}

.lw-search-pagination .current {
    background: #1a1a1a;
    border-color: #1a1a1a;
    color: #fff;
}

.lw-search-pagination .prev,
.lw-search-pagination .next {
    gap: 6px;
}

/* Search Empty State */
.lw-search-results-page .lw-search-empty {
    display: block;
    text-align: center;
    padding: 60px 20px;
}

.lw-search-results-page .lw-search-empty svg {
    color: #ddd;
    margin-bottom: 20px;
}

.lw-search-results-page .lw-search-empty h2 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.8rem;
    font-weight: 500;
    margin: 0 0 12px;
}

.lw-search-results-page .lw-search-empty p {
    color: #666;
    margin: 0 0 8px;
}

.lw-search-results-page .lw-search-empty .lw-search-suggestions {
    color: #888;
    font-size: 14px;
    margin-bottom: 24px;
}

.lw-search-results-page .lw-search-empty .btn-primary {
    display: inline-block;
    padding: 14px 32px;
    background: #1a1a1a;
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-radius: 4px;
    transition: background 0.3s;
}

.lw-search-results-page .lw-search-empty .btn-primary:hover {
    background: #333;
}

/* ========================================
   Product Gallery
   ======================================== */
.lw-product-gallery {
    position: relative;
}

.lw-gallery-main {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: #f8f8f8;
}

.lw-gallery-main-image {
    cursor: zoom-in;
}

.lw-gallery-main-image img {
    width: 100%;
    height: auto;
    display: block;
}

.lw-gallery-sale-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: #e74c3c;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 4px;
    z-index: 2;
}

/* Gallery Arrows */
.lw-gallery-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.9);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.3s;
}

.lw-gallery-main:hover .lw-gallery-arrow {
    opacity: 1;
}

.lw-gallery-prev {
    left: 12px;
}

.lw-gallery-next {
    right: 12px;
}

.lw-gallery-arrow svg {
    width: 20px;
    height: 20px;
}

/* Thumbnails */
.lw-gallery-thumbs {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.lw-gallery-thumb {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    border: 2px solid transparent;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    padding: 0;
    background: none;
    transition: border-color 0.2s;
}

.lw-gallery-thumb.active {
    border-color: #000;
}

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

/* ========================================
   Lightbox
   ======================================== */
.lw-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
    display: none;
}

.lw-lightbox.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.lw-lightbox-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.95);
}

.lw-lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
}

.lw-lightbox-image img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
}

.lw-lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 8px;
}

.lw-lightbox-close svg {
    width: 24px;
    height: 24px;
}

.lw-lightbox-prev,
.lw-lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.1);
    border: none;
    color: #fff;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lw-lightbox-prev {
    left: -60px;
}

.lw-lightbox-next {
    right: -60px;
}

.lw-lightbox-counter {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 13px;
}

/* ========================================
   Related Products
   ======================================== */
.lw-related-products {
    margin: 60px 0;
}

.lw-related-header {
    text-align: center;
    margin-bottom: 30px;
}

.lw-related-title {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 28px;
    font-weight: 500;
    margin: 0 0 10px;
}

.lw-related-underline {
    width: 60px;
    height: 2px;
    background: #000;
    margin: 0 auto;
}

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

.lw-related-item {
    position: relative;
}

.lw-related-link {
    text-decoration: none;
    color: inherit;
}

.lw-related-image {
    position: relative;
    aspect-ratio: 1;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 12px;
}

.lw-related-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.lw-related-item:hover .lw-related-image img {
    transform: scale(1.05);
}

.lw-related-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #e74c3c;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
}

.lw-related-icons {
    position: absolute;
    bottom: 10px;
    right: 10px;
    display: flex;
    gap: 6px;
    opacity: 0;
    transition: opacity 0.3s;
}

.lw-related-item:hover .lw-related-icons {
    opacity: 1;
}

.lw-related-name {
    font-size: 14px;
    font-weight: 500;
    margin: 0 0 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lw-related-price {
    font-size: 13px;
    color: #666;
}

/* ========================================
   Product Showcase
   ======================================== */
.mlw-product-showcase {
    margin: 40px 0;
}

.mlw-showcase-title {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 32px;
    font-weight: 500;
    text-align: center;
    margin: 0 0 30px;
}

/* Grid Layout */
.mlw-showcase-grid {
    display: grid;
    gap: 24px;
}

.mlw-showcase-grid.mlw-cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.mlw-showcase-grid.mlw-cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.mlw-showcase-grid.mlw-cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

.mlw-showcase-grid.mlw-cols-5 {
    grid-template-columns: repeat(5, 1fr);
}

.mlw-showcase-grid.mlw-cols-6 {
    grid-template-columns: repeat(6, 1fr);
}

/* Product Card */
.mlw-showcase-product {
    position: relative;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.mlw-showcase-product.mlw-fading-out {
    opacity: 0;
    transform: scale(0.95);
}

.mlw-showcase-product.mlw-fading-in {
    animation: mlw-fade-in 0.4s ease forwards;
}

@keyframes mlw-fade-in {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.mlw-showcase-product-image {
    position: relative;
    aspect-ratio: 1;
    border-radius: 12px;
    overflow: hidden;
    background: #f8f8f8;
    margin-bottom: 12px;
}

.mlw-showcase-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

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

.mlw-showcase-product-image a {
    display: block;
    width: 100%;
    height: 100%;
}

/* Sale Badge */
.mlw-showcase-sale-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #e74c3c;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 4px;
    z-index: 2;
}

/* Hover Actions */
.mlw-showcase-actions {
    position: absolute;
    bottom: 10px;
    right: 10px;
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 2;
}

.mlw-showcase-product:hover .mlw-showcase-actions {
    opacity: 1;
}

.mlw-showcase-add-to-cart,
.mlw-showcase-view-btn {
    width: 36px;
    height: 36px;
    background: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: background 0.2s, transform 0.2s;
    color: #1a1a1a;
    text-decoration: none;
}

.mlw-showcase-add-to-cart:hover,
.mlw-showcase-view-btn:hover {
    background: #1a1a1a;
    color: #fff;
    transform: scale(1.1);
}

.mlw-showcase-add-to-cart.loading {
    pointer-events: none;
}

.mlw-showcase-add-to-cart.loading svg {
    animation: spin 0.8s linear infinite;
}

/* Product Info */
.mlw-showcase-product-info {
    text-align: center;
}

.mlw-showcase-product-title {
    font-size: 14px;
    font-weight: 500;
    margin: 0 0 6px;
}

.mlw-showcase-product-title a {
    color: inherit;
    text-decoration: none;
}

.mlw-showcase-product-title a:hover {
    color: #666;
}

.mlw-showcase-rating {
    margin-bottom: 4px;
}

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

.mlw-showcase-price {
    font-size: 14px;
    color: #666;
}

.mlw-showcase-price del {
    opacity: 0.6;
    margin-right: 6px;
}

.mlw-showcase-price ins {
    text-decoration: none;
    color: #e74c3c;
    font-weight: 500;
}

/* Carousel Layout */
.mlw-showcase-carousel {
    position: relative;
}

.mlw-showcase-carousel .swiper-button-prev,
.mlw-showcase-carousel .swiper-button-next {
    width: 40px;
    height: 40px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.mlw-showcase-carousel .swiper-button-prev:after,
.mlw-showcase-carousel .swiper-button-next:after {
    font-size: 16px;
    color: #1a1a1a;
    font-weight: 700;
}

.mlw-showcase-carousel .swiper-pagination-bullet {
    background: #1a1a1a;
}

.mlw-showcase-carousel .swiper-pagination-bullet-active {
    background: #1a1a1a;
}

/* Auto-Shuffle Layout */
.mlw-showcase-shuffle {
    position: relative;
}

.mlw-shuffle-indicator {
    display: flex;
    justify-content: center;
    margin-top: 20px;
    gap: 6px;
}

.mlw-shuffle-dot {
    width: 8px;
    height: 8px;
    background: #ddd;
    border-radius: 50%;
    animation: mlw-pulse 2s ease-in-out infinite;
}

.mlw-showcase-shuffle[data-paused="true"] .mlw-shuffle-dot {
    animation-play-state: paused;
    background: #999;
}

@keyframes mlw-pulse {
    0%, 100% {
        opacity: 0.4;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 1024px) {
    .mlw-showcase-grid.mlw-cols-5,
    .mlw-showcase-grid.mlw-cols-6 {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    .lw-search-content {
        flex-direction: column;
    }

    .lw-search-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .lw-related-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .lw-lightbox-prev {
        left: 10px;
    }

    .lw-lightbox-next {
        right: 10px;
    }

    .mlw-showcase-grid.mlw-cols-3,
    .mlw-showcase-grid.mlw-cols-4,
    .mlw-showcase-grid.mlw-cols-5,
    .mlw-showcase-grid.mlw-cols-6 {
        grid-template-columns: repeat(2, 1fr);
    }

    .mlw-showcase-title {
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .mlw-showcase-grid.mlw-cols-2,
    .mlw-showcase-grid.mlw-cols-3,
    .mlw-showcase-grid.mlw-cols-4,
    .mlw-showcase-grid.mlw-cols-5,
    .mlw-showcase-grid.mlw-cols-6 {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}
