.koati-variations-wrapper {
    margin: 20px 0;
}

.koati-attribute-group {
    margin-bottom: 20px;
}

.koati-attribute-label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    font-size: 14px;
    text-transform: capitalize;
    letter-spacing: 0.5px;
}

.koati-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.koati-swatch {
    border: 2px solid #ddd;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
    background-color: transparent;
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    position: relative;
    overflow: hidden;
}

.koati-swatch:hover {
    border-color: #333;
    transform: scale(1.05);
}

.koati-swatch.selected {
    border-color: #333;
    box-shadow: 0 0 0 3px rgba(51, 51, 51, 0.1);
}

.koati-swatch.selected::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 50%;
    z-index: 1;
}

.koati-swatch.selected::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 20px;
    font-weight: bold;
    z-index: 2;
    line-height: 1;
}

.koati-color-swatch {
    background-size: cover !important;
    background-position: center !important;
}

.koati-size-swatch-wrapper {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin: 0 0px;
}

.koati-size-swatch {
    background-color: #f5f5f5;
    color: #333;
    text-transform: uppercase;
    white-space: nowrap;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 12px;
}

.koati-size-swatch:hover {
    background-color: #e8e8e8;
    border-color: #999;
}

.koati-size-swatch.selected {
    background-color: #333;
    color: #fff;
    border-color: #333;
}

.koati-stock-badge {
    background-color: #ff6b6b;
    color: white;
    font-size: 7px;
    padding: 2px 5px;
    border-radius: 10px;
    white-space: nowrap;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.koati-gallery-wrapper {
    margin: 20px 0;
}

.koati-gallery-vertical {
    display: flex;
    gap: 15px;
}

.koati-gallery-vertical .koati-gallery-thumbnails {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-shrink: 0;
    height: 500px;
    overflow-y: auto;
    padding-right: 8px;
}

.koati-gallery-vertical .koati-gallery-thumbnails::-webkit-scrollbar {
    width: 6px;
}

.koati-gallery-vertical .koati-gallery-thumbnails::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.koati-gallery-vertical .koati-gallery-thumbnails::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.koati-gallery-vertical .koati-gallery-thumbnails::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.koati-gallery-vertical .koati-gallery-thumbnail {
    flex-shrink: 0;
}

.koati-gallery-vertical .koati-gallery-main-wrapper {
    flex: 1;
}

.koati-gallery-horizontal {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    overflow-x: auto;
    padding-bottom: 10px;
}

.koati-gallery-horizontal .koati-gallery-thumbnail {
    flex-shrink: 0;
}

.koati-gallery-thumbnail {
    width: 80px;
    height: 80px;
    border: 2px solid #ddd;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
    background-size: cover;
    background-position: center;
    background-color: #f5f5f5;
}

.koati-gallery-thumbnail:hover {
    border-color: #999;
}

.koati-gallery-thumbnail.active {
    border-color: #333;
    box-shadow: 0 0 0 2px rgba(51, 51, 51, 0.2);
}

.koati-gallery-main {
    width: 100%;
    max-width: 500px;
    height: 500px;
    background-color: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.koati-main-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.koati-gallery-main-wrapper {
    position: relative;
}

@media (max-width: 768px) {
    .koati-zoom-btn {
        position: absolute;
        top: 10px;
        right: 10px;
        background: rgba(0, 0, 0, 0.6);
        color: white;
        border: none;
        border-radius: 50%;
        width: 20px;
        height: 20px;
        font-size: 12px;
        cursor: pointer;
        z-index: 10;
        transition: background 0.3s ease;
        display: flex !important;
        align-items: center;
        justify-content: center;
        padding: 0;
    }

    .koati-zoom-btn:hover {
        background: rgba(0, 0, 0, 0.8);
    }
}

@media (min-width: 769px) {
    .koati-zoom-btn {
        display: none !important;
    }
}

.koati-gallery-container {
    display: flex;
    gap: 15px;
}

/* Archive Image and Color Swatches */
.koati-archive-image-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
}

.koati-archive-image-link {
    display: block !important;
    text-decoration: none !important;
    cursor: pointer !important;
}

.koati-archive-main-image {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 1 / 1 !important;
    background-color: #f5f5f5 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
    min-height: 0 !important;
    max-height: none !important;
    position: relative !important;
}

.koati-archive-main-image::before,
.koati-archive-main-image::after {
    content: '' !important;
    position: absolute !important;
    top: 0 !important;
    width: 20% !important;
    height: 100% !important;
    background-size: cover !important;
    background-position: center !important;
    opacity: 0.3 !important;
    z-index: 1 !important;
    pointer-events: none !important;
}

.koati-archive-main-image::before {
    left: 0 !important;
    transform: scaleX(-1) !important;
    background-image: var(--archive-image-url) !important;
}

.koati-archive-main-image::after {
    right: 0 !important;
    background-image: var(--archive-image-url) !important;
}

.koati-archive-main-img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    transition: opacity 0.3s ease !important;
    position: relative !important;
    z-index: 2 !important;
}

.koati-archive-swatches-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    margin-top: 10px !important;
}

.koati-archive-color-swatches {
    display: flex !important;
    gap: 10px !important;
    flex-wrap: wrap !important;
}

.koati-archive-color-swatch {
    width: 35px !important;
    height: 35px !important;
    border-radius: 50% !important;
    border: 2px solid #ddd !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    background-size: cover !important;
    background-position: center !important;
    padding: 0 !important;
    flex-shrink: 0 !important;
}

.koati-archive-color-swatch:hover {
    border-color: #999 !important;
}

.koati-archive-color-swatch.selected {
    border-color: #000 !important;
    box-shadow: 0 0 0 2px #fff, 0 0 0 3px #000 !important;
}

.koati-clear-filter-btn {
    display: inline-block !important;
    margin-top: 10px !important;
    padding: 8px 16px !important;
    background-color: #f0f0f0 !important;
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
    cursor: pointer !important;
    font-size: 14px !important;
    color: #333 !important;
    transition: all 0.3s ease !important;
}

.koati-clear-filter-btn:hover {
    background-color: #e0e0e0 !important;
    border-color: #999 !important;
}

button[data-koati-add-to-cart] {
    background-color: #00ca27 !important;
    color: #fff !important;
    border: none !important;
    cursor: pointer !important;
    transition: background-color 0.3s ease !important;
}

button[data-koati-add-to-cart]:disabled {
    background-color: #06183d !important;
    color: #fff !important;
    cursor: not-allowed !important;
    opacity: 1 !important;
}

/* Elementor overrides for archive */
.elementor-widget-shortcode .elementor-shortcode {
    height: auto !important;
    min-height: auto !important;
}

.elementor-shortcode .koati-archive-image-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: auto !important;
}

.elementor-shortcode .koati-archive-main-image {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 1 / 1 !important;
    min-height: auto !important;
    max-height: none !important;
}

.elementor-shortcode .koati-archive-main-img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
}

.elementor-shortcode .koati-archive-color-swatches {
    display: flex !important;
    gap: 10px !important;
}

.elementor-shortcode .koati-archive-color-swatch {
    width: 35px !important;
    height: 35px !important;
    border-radius: 50% !important;
}

/* Add to Cart shortcode */
.koati-add-to-cart-form .variations,
.koati-add-to-cart-form .variations td,
.koati-add-to-cart-form .variations th,
.koati-add-to-cart-form .variations tr,
.koati-add-to-cart-form table.variations {
    display: none !important;
}

.koati-add-to-cart-form.koati-add-to-cart-hide-quantity .quantity,
.koati-add-to-cart-form.koati-add-to-cart-hide-quantity .quantity input {
    display: none !important;
}

.koati-add-to-cart-form .woocommerce-variation {
    display: none !important;
}

@media (max-width: 768px) {
    .koati-gallery-wrapper {
        display: flex !important;
        flex-direction: column !important;
    }

    .koati-gallery-vertical {
        flex-direction: column !important;
        gap: 10px;
    }

    .koati-gallery-container {
        display: flex !important;
        flex-direction: column-reverse !important;
        gap: 10px;
    }

    .koati-gallery-thumbnails {
        display: flex !important;
        flex-direction: row !important;
        height: auto !important;
        max-height: none !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        width: 100% !important;
        padding-bottom: 10px;
        gap: 10px;
        order: -1;
    }

    .koati-gallery-thumbnail {
        display: flex !important;
        flex-shrink: 0 !important;
        width: 60px !important;
        height: 60px !important;
    }

    .koati-gallery-main-wrapper {
        display: flex !important;
        width: 100% !important;
    }

    .koati-gallery-main {
        height: 400px;
        width: 100%;
    }

    .koati-swatch {
        min-height: 40px;
        min-width: 40px;
    }
}
