/* ==========================================================================
   WooCommerce Hover Variation Swatches - Frontend Styles
   ========================================================================== */

.woo-hvs-swatches-container {
    margin-bottom: 1.25rem;
    position: relative;
}

.woo-hvs-swatch-items-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    align-items: center;
}

/* Base Swatch Item */
.woo-hvs-swatch-item {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    outline: none;
    box-sizing: border-box;
}

/* Circular Swatches */
.woo-hvs-swatch-item.shape-circle {
    width: 40px;
    height: 40px;
    border-radius: 9999px;
    padding: 3px;
    border: 2px solid rgba(0, 0, 0, 0.12);
    background-color: #ffffff;
}

.woo-hvs-swatch-item.shape-circle .woo-hvs-swatch-visual {
    width: 100%;
    height: 100%;
    border-radius: 9999px;
    background-size: cover;
    background-position: center;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
}

/* Rounded Square Swatches */
.woo-hvs-swatch-item.shape-rounded-square {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    padding: 3px;
    border: 2px solid rgba(0, 0, 0, 0.12);
    background-color: #ffffff;
}

.woo-hvs-swatch-item.shape-rounded-square .woo-hvs-swatch-visual {
    width: 100%;
    height: 100%;
    border-radius: 6px;
    background-size: cover;
    background-position: center;
}

/* Square Swatches */
.woo-hvs-swatch-item.shape-square {
    width: 40px;
    height: 40px;
    border-radius: 0px;
    padding: 3px;
    border: 2px solid rgba(0, 0, 0, 0.12);
    background-color: #ffffff;
}

.woo-hvs-swatch-item.shape-square .woo-hvs-swatch-visual {
    width: 100%;
    height: 100%;
    border-radius: 0px;
    background-size: cover;
    background-position: center;
}

/* Button / Label Swatches */
.woo-hvs-swatch-item.woo-hvs-swatch-button {
    width: auto !important;
    height: auto !important;
    padding: 0.5rem 0.95rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    border: 1.5px solid #d4d4d8;
    background-color: #ffffff;
    color: #18181b;
}

.woo-hvs-swatch-item.woo-hvs-swatch-button:hover {
    border-color: #000000;
    background-color: #fafafa;
}

/* Selected Active States */
.woo-hvs-swatch-item.is-selected.shape-circle,
.woo-hvs-swatch-item.is-selected.shape-rounded-square,
.woo-hvs-swatch-item.is-selected.shape-square {
    border-color: #000000;
    transform: scale(1.1);
    box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px #000000;
}

.woo-hvs-swatch-item.is-selected.woo-hvs-swatch-button {
    background-color: #000000;
    color: #ffffff;
    border-color: #000000;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

/* Disabled / Out of Stock */
.woo-hvs-swatch-item.is-disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.woo-hvs-swatch-item.is-disabled::after {
    content: '';
    position: absolute;
    top: 50%;
    left: -2px;
    right: -2px;
    height: 2px;
    background-color: #ef4444;
    transform: rotate(-45deg);
    z-index: 5;
}

/* ==========================================================================
   HOVER PREVIEW POPOVER TOOLTIP (Large Image + Variation Title)
   ========================================================================== */

.woo-hvs-tooltip-popover {
    position: absolute;
    bottom: calc(100% + 14px);
    left: 50%;
    transform: translateX(-50%) translateY(8px) scale(0.96);
    width: 160px;
    background: #ffffff;
    border-radius: 12px;
    padding: 8px;
    box-shadow: 0 15px 30px -5px rgba(0, 0, 0, 0.2), 0 0 1px 1px rgba(0, 0, 0, 0.08);
    border: 1px solid #e4e4e7;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 99999;
    transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.22s cubic-bezier(0.16, 1, 0.3, 1),
                visibility 0.22s;
    text-align: center;
    box-sizing: border-box;
}

/* Caret Arrow */
.woo-hvs-tooltip-popover::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 7px 7px 0 7px;
    border-style: solid;
    border-color: #ffffff transparent transparent transparent;
    filter: drop-shadow(0 2px 1px rgba(0, 0, 0, 0.08));
}

/* Big Image inside Hover Tooltip */
.woo-hvs-tooltip-popover .woo-hvs-popover-image {
    width: 100%;
    height: 130px;
    border-radius: 8px;
    overflow: hidden;
    background-color: #f4f4f5;
    margin-bottom: 6px;
    position: relative;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.woo-hvs-tooltip-popover .woo-hvs-popover-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

/* Tooltip Variation Title */
.woo-hvs-tooltip-popover .woo-hvs-popover-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: #18181b;
    line-height: 1.25;
    word-break: break-word;
}

/* Trigger Popover on Swatch Hover & Focus */
.woo-hvs-swatch-item:hover .woo-hvs-tooltip-popover,
.woo-hvs-swatch-item:focus-visible .woo-hvs-tooltip-popover {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0) scale(1);
}

.woo-hvs-swatch-item:hover .woo-hvs-tooltip-popover .woo-hvs-popover-image img {
    transform: scale(1.06);
}
