/*
Theme Name: Nooni Child
Theme URI: https://demo.theme-sky.com/nooni/
Author: Theme Sky Team
Author URI: http://theme-sky.com/
Description: A Premium and Responsive WordPress theme, designed for E-Commerce websites
Template: nooni
Version: 1.0.0
License: GNU General Public License v2 or later
License URI:  http://www.gnu.org/licenses/gpl-2.0.html
Tags: two-columns, left-sidebar, custom-background, custom-colors, custom-header, custom-menu, editor-style, featured-images, microformats, post-formats, rtl-language-support, sticky-post, threaded-comments, translation-ready
Text Domain: nooni-child
*/

/* Color Swatches on Product Loop */
.loop-color-swatches {
    margin-top: 10px;
    margin-bottom: 10px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    min-height: 28px;
    clear: both;
}

/* Color circle swatches - Desktop */
.swatch-circle {
    position: relative;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid #e0e0e0;
    display: inline-block;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Better visibility for all colors */
.swatch-circle::before {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    bottom: -1px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.5);
    pointer-events: none;
}

/* Hover effect - Desktop only */
@media (hover: hover) {
    .swatch-circle:hover {
        transform: scale(1.3);
        box-shadow: 0 3px 8px rgba(0,0,0,0.2);
        z-index: 2;
        border-color: #999;
    }
}

/* Active/selected state */
.swatch-circle.active,
.swatch-circle:active {
    transform: scale(1.2);
    box-shadow: 0 0 0 2px #fff,
                0 0 0 4px #333;
}

/* Special handling for white/light colors */
.swatch-circle[data-color*="white"],
.swatch-circle[data-color*="branco"],
.swatch-circle[data-color*="ivory"],
.swatch-circle[data-color*="cream"] {
    border-color: #999 !important;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.1),
                0 2px 4px rgba(0,0,0,0.15);
}

/* Fallback text label */
.swatch-default {
    font-size: 12px;
    padding: 4px 8px;
    background: #f8f8f8;
    border: 1px solid #ddd;
    border-radius: 4px;
    line-height: 1;
    color: #333;
    font-weight: 600;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.swatch-default:hover {
    background: #e8e8e8;
    border-color: #bbb;
}

/* Tooltip on hover - Desktop only */
@media (min-width: 769px) {
    .swatch-circle::after {
        content: attr(title);
        position: absolute;
        bottom: 100%;
        left: 50%;
        transform: translateX(-50%);
        padding: 4px 8px;
        background: rgba(0,0,0,0.85);
        color: white;
        font-size: 11px;
        white-space: nowrap;
        border-radius: 3px;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
        margin-bottom: 5px;
        z-index: 10;
    }
    
    .swatch-circle:hover::after {
        opacity: 1;
    }
}

/* MOBILE SPECIFIC STYLES */
@media (max-width: 768px) {
    .loop-color-swatches {
        gap: 10px;
        margin-top: 12px;
        margin-bottom: 12px;
        padding: 5px 0;
    }
    
    .swatch-circle {
        width: 28px;
        height: 28px;
        border-width: 2px;
        box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    }
    
    /* Touch feedback */
    .swatch-circle:active {
        transform: scale(0.95);
    }
    
    .swatch-default {
        font-size: 13px;
        padding: 5px 10px;
        font-weight: 600;
    }
}

/* Small mobile devices */
@media (max-width: 480px) {
    .loop-color-swatches {
        gap: 12px;
        margin-top: 15px;
        margin-bottom: 15px;
    }
    
    .swatch-circle {
        width: 32px;
        height: 32px;
        border-width: 2.5px;
        box-shadow: 0 3px 8px rgba(0,0,0,0.15);
    }
    
    .swatch-default {
        font-size: 14px;
        padding: 6px 12px;
        font-weight: 600;
    }
}

/* Very small screens */
@media (max-width: 360px) {
    .loop-color-swatches {
        gap: 10px;
    }
    
    .swatch-circle {
        width: 30px;
        height: 30px;
    }
    
    .swatch-default {
        font-size: 13px;
        padding: 5px 10px;
    }
}

/* Fix layout ordering - Force proper element order */
.woocommerce ul.products li.product {
    display: flex;
    flex-direction: column;
}

.woocommerce ul.products li.product .attachment-woocommerce_thumbnail,
.woocommerce ul.products li.product img {
    order: 1;
}

.woocommerce ul.products li.product .woocommerce-loop-product__title,
.woocommerce ul.products li.product h2 {
    order: 2;
}

.woocommerce ul.products li.product .price {
    order: 3;
    margin-bottom: 5px;
}

.woocommerce ul.products li.product .loop-color-swatches {
    order: 4;
    width: 100%;
    margin-bottom: 10px;
}

/* Add to cart buttons are hidden - keeping this for reference */
.woocommerce ul.products li.product .button,
.woocommerce ul.products li.product .added_to_cart {
    order: 5;
    margin-top: 10px;
    display: none !important; /* Hidden per client request */
}

/* Integration with Nooni theme grid */
.ts-product .loop-color-swatches,
.product-wrapper .loop-color-swatches {
    margin-bottom: 10px;
}

/* Ensure swatches center properly in grid */
.products .product .loop-color-swatches {
    width: 100%;
    display: flex;
    justify-content: center;
}

/* Fix for grid layout on mobile */
@media (max-width: 768px) {
    .products.columns-2 .product .loop-color-swatches {
        min-height: 40px;
    }
}

/* Additional visibility improvements */
.woocommerce ul.products li.product .loop-color-swatches {
    clear: both;
    width: 100%;
}

/* Hide duplicate add to cart buttons at bottom of product cards */
.woocommerce ul.products li.product .button.add_to_cart_button,
.woocommerce ul.products li.product .button.product_type_simple,
.woocommerce ul.products li.product .button.product_type_variable,
.woocommerce ul.products li.product a.add_to_cart_button,
.woocommerce ul.products li.product .add_to_cart_button {
    display: none !important;
}

/* Also hide via WooCommerce's after shop loop item hook area */
.woocommerce ul.products li.product .add-to-cart-button-wrapper,
.woocommerce ul.products li.product .product-action,
.woocommerce ul.products li.product .product-buttons {
    display: none !important;
}

/* Focus styles for accessibility */
.swatch-circle:focus {
    outline: 2px solid #333;
    outline-offset: 2px;
}

.swatch-circle:focus:not(:focus-visible) {
    outline: none;
}

/* Animation for swatch appearance */
@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.loop-color-swatches .swatch-circle {
    animation: fadeInScale 0.3s ease-out;
}

.loop-color-swatches .swatch-circle:nth-child(1) { animation-delay: 0.05s; }
.loop-color-swatches .swatch-circle:nth-child(2) { animation-delay: 0.1s; }
.loop-color-swatches .swatch-circle:nth-child(3) { animation-delay: 0.15s; }
.loop-color-swatches .swatch-circle:nth-child(4) { animation-delay: 0.2s; }
.loop-color-swatches .swatch-circle:nth-child(5) { animation-delay: 0.25s; }

/* Disable animations on mobile for performance */
@media (max-width: 768px) {
    .loop-color-swatches .swatch-circle {
        animation: none;
    }
}