/**
 * Plantscount Attribute Swatches
 * Color, image, and size swatches for product variations
 */

/* ===== Base Swatch ===== */
.pc-swatch {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    background: #ffffff;
    border: 2px solid #e5e8e5;
    border-radius: 8px;
    font-family: 'DM Sans', -apple-system, sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: #2c2c2c;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    min-width: 44px;
    text-align: center;
    -webkit-appearance: none;
    appearance: none;
    user-select: none;
}

.pc-swatch:hover {
    border-color: #89A550;
    background: rgba(137, 165, 80, 0.05);
    transform: translateY(-1px);
}

.pc-swatch:focus {
    outline: 2px solid #89A550;
    outline-offset: 2px;
}

.pc-swatch.selected {
    border-color: #2D5A3D;
    background: #2D5A3D;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(45, 90, 61, 0.25);
}

.pc-swatch.disabled,
.pc-variation-btn.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
    background: #f5f5f5;
    border-color: #e0e0e0;
    color: #aaa;
    transform: none !important;
    box-shadow: none !important;
}

/* Strikethrough effect for unavailable options */
.pc-swatch.disabled::after,
.pc-variation-btn.disabled::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 5%;
    right: 5%;
    height: 1px;
    background: #999;
    transform: rotate(-15deg);
}

/* ===== Color Swatch ===== */
.pc-swatch--color {
    width: 40px;
    height: 40px;
    min-width: 40px;
    padding: 0;
    border-radius: 50%;
    border-width: 3px;
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.5);
}

.pc-swatch--color:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), inset 0 0 0 2px rgba(255, 255, 255, 0.5);
}

.pc-swatch--color.selected {
    border-color: #2D5A3D;
    box-shadow: 0 0 0 3px #ffffff, 0 0 0 5px #2D5A3D, inset 0 0 0 2px rgba(255, 255, 255, 0.5);
}

/* Light colors need visible border */
.pc-swatch--color[style*="background-color: #FFF"],
.pc-swatch--color[style*="background-color: #fff"],
.pc-swatch--color[style*="background-color: rgb(255"],
.pc-swatch--color[style*="background-color: #FFFFF"] {
    border-color: #e0e0e0;
}

/* ===== Size Swatch (Potmaat) ===== */
.pc-swatch--size {
    min-width: 50px;
    padding: 6px 10px;
    flex-direction: column;
    gap: 1px;
    border-radius: 8px;
}

.pc-swatch__size-value {
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
}

.pc-swatch__size-unit {
    font-size: 10px;
    font-weight: 500;
    opacity: 0.7;
    text-transform: lowercase;
}

.pc-swatch--size.selected .pc-swatch__size-value,
.pc-swatch--size.selected .pc-swatch__size-unit {
    color: #ffffff;
}

/* ===== Image Swatch ===== */
.pc-swatch--image {
    width: 50px;
    height: 50px;
    min-width: 50px;
    padding: 3px;
    border-radius: 10px;
    overflow: hidden;
}

.pc-swatch--image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
}

.pc-swatch--image:hover {
    transform: scale(1.05);
}

.pc-swatch--image.selected {
    padding: 2px;
}

/* ===== Label Swatch ===== */
.pc-swatch--label {
    min-width: 70px;
}

/* ===== Swatch Group ===== */
.pc-swatch-group {
    margin-bottom: 16px;
}

.pc-swatch-group__label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #1a3a1a;
    margin-bottom: 10px;
    text-transform: none;
}

.pc-swatch-group__options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* ===== Variations Container ===== */
.pc-variations {
    margin: 6px 0;
}

.pc-variation-group {
    margin-bottom: 6px;
}

.pc-variation-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #1a3a1a;
    margin-bottom: 4px;
}

.pc-variation-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
    .pc-swatch {
        padding: 8px 12px;
        font-size: 13px;
        min-width: 44px;
    }

    .pc-swatch--color {
        width: 36px;
        height: 36px;
        min-width: 36px;
    }

    .pc-swatch--size {
        min-width: 54px;
    }

    .pc-swatch__size-value {
        font-size: 16px;
    }

    .pc-swatch--image {
        width: 44px;
        height: 44px;
        min-width: 44px;
    }
}

/* ===== Shop Page Swatches ===== */
.pc-shop-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
    justify-content: center;
}

/* Shop swatch (link version) */
.pc-shop-swatch {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.2s ease;
}

.pc-shop-swatch:hover {
    transform: scale(1.15);
    z-index: 2;
}

/* Color swatches in shop loop */
.pc-shop-swatches .pc-swatch--color,
.pc-shop-swatch.pc-swatch--color {
    width: 22px;
    height: 22px;
    min-width: 22px;
    padding: 0;
    border-radius: 50%;
    border: 2px solid #e5e8e5;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4);
}

.pc-shop-swatch.pc-swatch--color:hover {
    border-color: #2D5A3D;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15), inset 0 0 0 1px rgba(255, 255, 255, 0.4);
}

/* Size swatches in shop loop */
.pc-shop-swatches .pc-swatch--size,
.pc-shop-swatch.pc-swatch--size {
    min-width: 36px;
    padding: 3px 6px;
    background: #ffffff;
    border: 1px solid #e5e8e5;
    border-radius: 6px;
    font-size: 10px;
    flex-direction: column;
    gap: 1px;
}

.pc-shop-swatch.pc-swatch--size:hover {
    border-color: #89A550;
    background: rgba(137, 165, 80, 0.08);
}

.pc-shop-swatches .pc-swatch__size-value {
    font-size: 12px;
    font-weight: 700;
    color: #2c2c2c;
    line-height: 1;
}

.pc-shop-swatches .pc-swatch__size-unit {
    font-size: 8px;
    color: #888;
}

/* Label swatches in shop loop */
.pc-shop-swatch.pc-swatch--label {
    padding: 3px 8px;
    background: #ffffff;
    border: 1px solid #e5e8e5;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 500;
    color: #2c2c2c;
}

.pc-shop-swatch.pc-swatch--label:hover {
    border-color: #89A550;
    color: #2D5A3D;
}

/* "More" indicator */
.pc-shop-swatches__more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 22px;
    padding: 0 6px;
    background: #f5f5f5;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    color: #666;
}