/**
 * WC Product Variant Swatch - Public CSS
 * Styling for color swatches display
 */

.wc-product-variant-swatches {
    margin: 20px 0;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 5px;
    border: 1px solid #e0e0e0;
}

.wc-product-variant-swatches label {
    display: block;
    font-weight: 600;
    margin-bottom: 12px;
    color: #333;
    font-size: 14px;
}

.swatches-container {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    --swatch-size: 50px;
}

.swatch-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.swatch-item:hover {
    transform: scale(1.1);
}

.swatch-button {
    width: var(--swatch-size);
    height: var(--swatch-size);
    border-radius: 50%;
    border: 2px solid #ddd;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 0;
    appearance: none;
    -webkit-appearance: none;
    background-clip: padding-box;
}

.swatch-button:hover {
    border-color: #999;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.swatch-button:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.25);
}

.swatch-button.active {
    border-color: #007cba;
    border-width: 3px;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #007cba;
}

.swatch-label {
    font-size: 12px;
    color: #666;
    text-align: center;
    font-weight: 500;
    max-width: var(--swatch-size);
    word-wrap: break-word;
    white-space: normal;
    line-height: 1.2;
}

.swatch-item.active .swatch-label {
    color: #007cba;
    font-weight: 600;
}

/* Responsive design */
@media (max-width: 768px) {
    .swatches-container {
        gap: 10px;
    }

    .swatch-item {
        gap: 5px;
    }
}

@media (max-width: 480px) {
    .wc-product-variant-swatches {
        padding: 10px;
        margin: 15px 0;
    }

    .swatches-container {
        gap: 8px;
        --swatch-size: 40px;
    }

    .swatch-button {
        border-width: 1px;
    }

    .swatch-label {
        font-size: 10px;
    }
}

/* Accessibility */
.swatch-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: #ccc;
}

.swatch-button:disabled:hover {
    transform: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Hide original WooCommerce color dropdown when swatches are active */
.wc-swatch-hidden-row {
    display: none !important;
}

.wc-product-variant-table {
    margin: 20px 0;
    padding: 18px;
    background: #ffffff;
    border: 1px solid #e4e7eb;
    border-radius: 8px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.wc-product-variant-table__header {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 14px;
}

.wc-product-variant-table__header label {
    display: block;
    font-weight: 600;
    color: #111827;
    font-size: 15px;
    margin: 0;
}

.wc-product-variant-table__hint {
    color: #6b7280;
    font-size: 13px;
}

.wc-product-variant-table__wrap {
    overflow-x: auto;
}

.wc-product-variant-table table {
    width: 100%;
    border-collapse: collapse;
    min-width: 520px;
}

.wc-product-variant-table th,
.wc-product-variant-table td {
    padding: 12px 10px;
    border-bottom: 1px solid #eef2f7;
    text-align: left;
    vertical-align: middle;
}

.wc-product-variant-table th {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #64748b;
}

.wc-product-variant-table tbody tr:last-child td {
    border-bottom: 0;
}

.wc-product-variant-table__row.is-active {
    background: #f0f7ff;
}

.wc-product-variant-table__name {
    font-weight: 600;
    color: #111827;
}

.wc-product-variant-table__meta {
    margin-top: 4px;
    font-size: 12px;
    color: #6b7280;
}

.wc-product-variant-table__price {
    font-weight: 600;
    color: #111827;
    white-space: nowrap;
}

.wc-product-variant-table__price-note {
    margin-top: 4px;
    font-size: 12px;
    font-weight: 400;
    color: #6b7280;
    white-space: normal;
}

.wc-product-variant-table__qty {
    width: 88px;
    min-height: 40px;
    padding: 8px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
}

.wc-product-variant-table__add.button {
    min-height: 40px;
    padding: 0 16px;
    border-radius: 6px;
    white-space: nowrap;
}

.wc-product-variant-table__row.is-unavailable {
    opacity: 0.6;
}

@media (max-width: 480px) {
    .wc-product-variant-table {
        padding: 14px;
    }

    .wc-product-variant-table th,
    .wc-product-variant-table td {
        padding: 10px 8px;
    }

    .wc-product-variant-table__qty {
        width: 72px;
    }
}
