/**
 * WooCommerce Visual Attribute Filter Styles
 * Modern Dark UI with Image & Text support
 * Optimized for Shop Sidebars (2, 3, 4 Columns & No-Text Tiles)
 */

.wc-vaf-container {
    margin-bottom: 24px;
    font-family: inherit;
    box-sizing: border-box;
}

.wc-vaf-container *,
.wc-vaf-container *::before,
.wc-vaf-container *::after {
    box-sizing: border-box;
}

/* ==========================================================================
   Clear Filter Button
   ========================================================================== */
.wc-vaf-clear-bar {
    margin-bottom: 12px;
}

.wc-vaf-clear-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    font-weight: 600;
    color: #ff6b6b !important;
    text-decoration: none !important;
    padding: 3px 8px;
    background: rgba(255, 107, 107, 0.12);
    border-radius: 4px;
    transition: all 0.2s ease;
}

.wc-vaf-clear-link:hover {
    background: rgba(255, 107, 107, 0.22);
    color: #ff5252 !important;
}

.wc-vaf-clear-icon {
    font-size: 14px;
    line-height: 1;
}

/* ==========================================================================
   Base List Reset
   ========================================================================== */
.wc-vaf-list {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.wc-vaf-item {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    position: relative;
}

.wc-vaf-item-link {
    text-decoration: none !important;
    color: inherit !important;
    display: flex;
    position: relative;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Active Badge Indicator */
.wc-vaf-active-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 18px;
    height: 18px;
    background: #0088cc;
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 4;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}

.wc-vaf-item.is-active .wc-vaf-active-badge {
    opacity: 1;
    transform: scale(1);
}

/* ==========================================================================
   GRID LAYOUT (2, 3, 4 Columns for Sidebar)
   ========================================================================== */
.wc-vaf-style-grid .wc-vaf-list {
    display: grid !important;
}

/* 2 Columns */
.wc-vaf-style-grid.wc-vaf-cols-2 .wc-vaf-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

/* 3 Columns (Recommended for sidebar with text or tiles) */
.wc-vaf-style-grid.wc-vaf-cols-3 .wc-vaf-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
}

/* 4 Columns (Ultra compact sidebar tiles) */
.wc-vaf-style-grid.wc-vaf-cols-4 .wc-vaf-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
}

.wc-vaf-style-grid .wc-vaf-item-link {
    flex-direction: column;
    background: #252a30;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    overflow: hidden;
    height: 100%;
    position: relative;
}

.wc-vaf-style-grid .wc-vaf-item-link:hover {
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
}

.wc-vaf-style-grid .wc-vaf-item.is-active .wc-vaf-item-link {
    border-color: #0088cc;
    background: #1c242d;
    box-shadow: 0 0 0 1px #0088cc, 0 3px 8px rgba(0, 136, 204, 0.3);
}

/* Image Aspect Ratio */
.wc-vaf-style-grid .wc-vaf-image-wrap {
    width: 100%;
    aspect-ratio: 1 / 1; /* Square for perfect sidebar fit */
    overflow: hidden;
    background: #191c20;
    position: relative;
}

.wc-vaf-style-grid .wc-vaf-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.wc-vaf-style-grid .wc-vaf-item-link:hover .wc-vaf-img {
    transform: scale(1.1);
}

.wc-vaf-style-grid .wc-vaf-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #333942 0%, #1e2227 100%);
}

.wc-vaf-style-grid .wc-vaf-letter {
    font-size: 16px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.45);
    text-transform: uppercase;
}

/* Text Container (When Text is Enabled) */
.wc-vaf-style-grid.wc-vaf-has-text .wc-vaf-text-wrap {
    padding: 5px 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 28px;
}

.wc-vaf-style-grid.wc-vaf-has-text .wc-vaf-title {
    font-size: 11px;
    font-weight: 500;
    color: #d6dbe1;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

.wc-vaf-style-grid.wc-vaf-cols-4.wc-vaf-has-text .wc-vaf-title {
    font-size: 10px;
}

.wc-vaf-style-grid .wc-vaf-item.is-active .wc-vaf-title {
    color: #ffffff;
    font-weight: 600;
}

.wc-vaf-style-grid.wc-vaf-has-text .wc-vaf-count {
    font-size: 9.5px;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 1px;
}

/* ==========================================================================
   WITHOUT TEXT (Image-Only Swatches / Tiles)
   ========================================================================== */
.wc-vaf-style-grid.wc-vaf-no-text .wc-vaf-item-link {
    border-radius: 6px;
}

.wc-vaf-style-grid.wc-vaf-no-text .wc-vaf-image-wrap {
    aspect-ratio: 1 / 1;
}

.wc-vaf-style-grid.wc-vaf-cols-4 .wc-vaf-active-badge {
    width: 15px;
    height: 15px;
    top: 3px;
    right: 3px;
}

.wc-vaf-style-grid.wc-vaf-cols-4 .wc-vaf-active-badge svg {
    width: 10px;
    height: 10px;
}

/* ==========================================================================
   STYLE 2: Pills with Thumbnails
   ========================================================================== */
.wc-vaf-style-pills .wc-vaf-list {
    display: flex !important;
    flex-wrap: wrap;
    gap: 6px;
}

.wc-vaf-style-pills .wc-vaf-item-link {
    align-items: center;
    background: #252a30;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    padding: 3px 10px 3px 3px;
    gap: 6px;
}

.wc-vaf-style-pills .wc-vaf-item-link:hover {
    border-color: rgba(255, 255, 255, 0.35);
    background: #2f363e;
    transform: translateY(-1px);
}

.wc-vaf-style-pills .wc-vaf-item.is-active .wc-vaf-item-link {
    border-color: #0088cc;
    background: #172430;
    color: #ffffff;
    box-shadow: 0 0 0 1px #0088cc;
}

.wc-vaf-style-pills .wc-vaf-active-badge {
    display: none;
}

.wc-vaf-style-pills .wc-vaf-image-wrap {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: #191c20;
}

.wc-vaf-style-pills .wc-vaf-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.wc-vaf-style-pills .wc-vaf-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #39414a;
}

.wc-vaf-style-pills .wc-vaf-letter {
    font-size: 10px;
    font-weight: 700;
    color: #c0c6cc;
    text-transform: uppercase;
}

.wc-vaf-style-pills .wc-vaf-text-wrap {
    display: flex;
    align-items: center;
    gap: 5px;
}

.wc-vaf-style-pills .wc-vaf-title {
    font-size: 12px;
    font-weight: 500;
    color: #d1d7de;
    white-space: nowrap;
}

.wc-vaf-style-pills .wc-vaf-item.is-active .wc-vaf-title {
    color: #ffffff;
    font-weight: 600;
}

.wc-vaf-style-pills .wc-vaf-count {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.45);
}

/* When pills style has text disabled, show circular icon buttons */
.wc-vaf-style-pills.wc-vaf-no-text .wc-vaf-item-link {
    padding: 3px;
    border-radius: 50%;
}
.wc-vaf-style-pills.wc-vaf-no-text .wc-vaf-image-wrap {
    width: 32px;
    height: 32px;
}

/* ==========================================================================
   DISABLED / EMPTY STATE (Grayscale when no active products)
   ========================================================================== */
.wc-vaf-item.is-disabled {
    opacity: 0.38;
    filter: grayscale(100%);
    cursor: not-allowed;
    transition: opacity 0.2s ease, filter 0.2s ease;
}

.wc-vaf-item.is-disabled .wc-vaf-item-link {
    cursor: not-allowed;
    border-color: rgba(255, 255, 255, 0.04) !important;
    background: #1c1f23 !important;
    color: #6b7280 !important;
}

.wc-vaf-item.is-disabled:not(.is-active) .wc-vaf-item-link {
    pointer-events: none;
}

.wc-vaf-item.is-disabled .wc-vaf-item-link:hover {
    transform: none !important;
    border-color: rgba(255, 255, 255, 0.04) !important;
    box-shadow: none !important;
    background: #1c1f23 !important;
}

.wc-vaf-item.is-disabled .wc-vaf-img {
    filter: grayscale(100%) contrast(0.85);
}

.wc-vaf-item.is-disabled:hover .wc-vaf-img {
    transform: none !important;
}

.wc-vaf-item.is-disabled .wc-vaf-placeholder {
    background: #23272c !important;
}

.wc-vaf-item.is-disabled .wc-vaf-letter {
    color: rgba(255, 255, 255, 0.2) !important;
}

.wc-vaf-item.is-disabled .wc-vaf-title {
    color: #6d7580 !important;
}

.wc-vaf-item.is-disabled .wc-vaf-count {
    color: rgba(255, 255, 255, 0.2) !important;
}

