/* استایل‌های سواچ‌های محصولات متغیر */

.pym-variation-swatches {
    direction: rtl;
    margin-bottom: 20px;
}

.pym-variation-attribute {
    margin-bottom: 15px;
}

.pym-variation-attribute-label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    font-size: 14px;
}

.pym-variation-swatches-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

/* سواچ پایه */
.pym-variation-swatch {
    border: 2px solid #e0e0e0;
    background: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    outline: none;
    min-width: 40px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    border-radius: 6px;
}

.pym-variation-swatch:hover {
    border-color: #ccc;
    transform: scale(1.05);
}

.pym-variation-swatch:focus {
    outline: 2px solid #36BACC;
    outline-offset: 2px;
}

.pym-variation-swatch.active,
.pym-variation-swatch.selected {
    border-color: #36BACC;
    outline: 2px solid #36BACC;
    outline-offset: 0;
    box-shadow: 0 0 0 1px #36BACC;
}

.pym-variation-swatch.active::after,
.pym-variation-swatch.selected::after {
    content: '✓';
    position: absolute;
    top: -8px;
    right: -8px;
    background: #36BACC;
    color: white;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
}

/* سواچ‌های دایره‌ای */
.pym-swatch-circular {
    border-radius: 50%;
}

.pym-swatch-circular.pym-swatch-color {
    width: 40px;
    height: 40px;
    padding: 0;
    position: relative;
}

.pym-swatch-circular.pym-swatch-color::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: inherit;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.pym-swatch-circular.pym-swatch-text {
    min-width: 40px;
    min-height: 40px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}

.pym-swatch-circular.active::after,
.pym-swatch-circular.selected::after {
    top: -6px;
    right: -6px;
    width: 14px;
    height: 14px;
    font-size: 8px;
}

/* سواچ‌های مستطیلی */
.pym-swatch-rectangular {
    border-radius: 6px;
    background: #fff;
    border: 2px solid #e0e0e0;
    padding: 8px 12px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    gap: 6px;
}

.pym-swatch-rectangular:hover {
    border-color: #ccc;
}

.pym-swatch-rectangular.active,
.pym-swatch-rectangular.selected {
    border-color: #36BACC;
    background: #fff;
}

.pym-swatch-rectangular.active::after,
.pym-swatch-rectangular.selected::after {
    content: '✓';
    position: absolute;
    top: -8px;
    right: -8px;
    background: #36BACC;
    color: white;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
}

/* نشانگر رنگ در سواچ‌های مستطیلی */
.pym-rectangular-color-indicator {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    flex-shrink: 0;
}

.pym-rectangular-text {
    flex: 1;
    text-align: center;
    white-space: nowrap;
}

/* سواچ‌های متنی */
.pym-swatch-text {
    padding: 8px 12px;
    min-width: auto;
    white-space: nowrap;
}

/* نشانگر فعال سواچ‌های مستطیلی */
.pym-swatch-rectangular.active::after,
.pym-swatch-rectangular.selected::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #36BACC;
    border-radius: 50%;
    width: 8px;
    height: 8px;
    z-index: 2;
    display: block; /* قابل تنظیم توسط Elementor */
}

/* استایل های متن ویژگی‌ها */
.pym-rectangular-text {
    color: #333; /* قابل تنظیم */
    transition: color 0.2s ease;
}

.pym-variation-swatch:hover .pym-rectangular-text {
    color: #36BACC; /* قابل تنظیم */
}

/* عنوان کانتینر متغیر */
.pym-variation-container-title-wrapper {
    margin-bottom: 20px;
    text-align: left; /* پیش‌فرض چپ */
}

.pym-variation-container-title {
    display: flex;
    align-items: center;
    justify-content: flex-start; /* پیش‌فرض چپ */
    gap: 8px;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.pym-variation-container-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* قیمت محصول متغیر */
.pym-variation-price {
    margin: 0 0 24px 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.pym-variation-price ins {
    text-decoration: none;
}

/* استایل کلمه تومان */
.pym-variation-price del .woocommerce-Price-currencySymbol,
.pym-variation-price ins .woocommerce-Price-currencySymbol {
    font-size: 14px;
    font-weight: 400;
}

.pym-variation-price-range,
.pym-variation-price-single {
    display: block;
}

/* اطلاعات متغیر (SKU و موجودی) */
.pym-variation-meta {
    margin: 10px 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 13px;
    color: #666;
}

.pym-variation-sku,
.pym-variation-stock {
    display: block;
}

.pym-variation-sku:empty,
.pym-variation-stock:empty {
    display: none;
}

/* تصویر محصول متغیر */
.pym-variation-image {
    margin: 15px 0;
    text-align: center;
    display: block;
}

.pym-variation-image img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* مخفی کردن تصویر وقتی تنظیمات غیرفعال است */
.pym-variation-image[style*="display: none"],
.pym-variation-image.hidden {
    display: none !important;
}

/* دکمه غیرفعال برای محصولات متغیر */
.pymaddtocart-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* حالت لودینگ */
.pym-variation-swatch.loading {
    opacity: 0.7;
    pointer-events: none;
}

.pym-variation-swatch.loading::after {
    content: '';
    border: 2px solid #f3f3f3;
    border-top: 2px solid #36BACC;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    animation: pym-spin 1s linear infinite;
    background: none;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* انیمیشن چرخش */
@keyframes pym-spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ریسپانسیو */
@media (max-width: 768px) {
    .pym-variation-swatches-container {
        gap: 6px;
    }

    .pym-variation-swatch {
        min-width: 35px;
        min-height: 35px;
        font-size: 13px;
    }

    .pym-swatch-color {
        width: 35px;
        height: 35px;
    }

    .pym-swatch-color::before {
        width: 28px;
        height: 28px;
    }

    .pym-swatch-text {
        padding: 6px 10px;
    }
}

/* دسترس‌پذیری */
.screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ناوبری کیبورد */
.pym-variation-swatch:focus-visible {
    outline: 2px solid #36BACC;
    outline-offset: 2px;
}

/* پشتیبانی از حالت تاریک (اختیاری) */
@media (prefers-color-scheme: dark) {
    .pym-variation-attribute-label {
        color: #e0e0e0;
    }

    .pym-variation-swatch {
        border-color: #555;
        background: #333;
        color: #e0e0e0;
    }

    .pym-variation-swatch:hover {
        border-color: #777;
    }

    .pym-variation-meta {
        color: #ccc;
    }
}
