/**
 * استایل‌های WC Quick Add
 * نسخه: 1.0.60
 */

/* CSS Reset برای جلوگیری از تداخل */
.wcqa-container *,
.wcqa-container *::before,
.wcqa-container *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 100%;
    font: inherit;
    vertical-align: baseline;
}

/* کانتینر اصلی با Namespace Protection */
.wcqa-container {
    margin: 10px 0;
    font-family: inherit;
    /* جلوگیری از تداخل با سایر استایل‌ها */
    contain: layout style;
    isolation: isolate;
    /* CSS Reset برای جلوگیری از تداخل */
    box-sizing: border-box;
    position: relative;
    z-index: 1;
}

/* دکمه افزودن به سبد */
.wcqa-container .wcqa-btn {
    display: inline-block;
    width: 100%;
    padding: 12px 20px;
    margin: 5px 0;
    background-color: #ff3800;
    color: #f2f2f2;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    cursor: pointer !important;
    transition: none !important;
    box-sizing: border-box;
    line-height: 1.4;
    position: relative;
    z-index: 999;
    pointer-events: auto !important;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.wcqa-container .wcqa-btn:hover {
    background-color: #e52e00;
    color: #f2f2f2;
    text-decoration: none;
    transform: none !important;
    box-shadow: none;
}

.wcqa-container .wcqa-btn:active {
    transform: none !important;
    box-shadow: none;
}

.wcqa-container .wcqa-btn:disabled {
    background-color: #cccccc;
    color: #666666;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none;
}

.wcqa-container .wcqa-btn:disabled:hover {
    background-color: #cccccc;
    color: #666666;
    transform: none !important;
    box-shadow: none;
}

/* دکمه افزودن */
.wcqa-container .wcqa-btn-add {
    background-color: #ff3800;
}

.wcqa-container .wcqa-btn-add:hover {
    background-color: #e52e00;
}

/* کنترل‌های تعداد */
.wcqa-container .wcqa-quantity-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #ffffff;
    border: 1px solid #ff3800;
    border-radius: 8px;
    padding: 8px 15px;
    margin: 5px 0;
    gap: 15px;
    min-height: 45px;
}

/* دکمه رفتن به سبد داخل کنترل تعداد */
.wcqa-container .wcqa-btn-go-cart {
    background-color: transparent !important;
    color: #ff3800 !important;
    border: 1px dashed #ff3800 !important;
    border-radius: 6px;
    padding: 6px 10px;
    min-height: 32px;
    font-size: 13px;
    width: auto;
}

.wcqa-container .wcqa-btn-go-cart:hover,
.wcqa-container .wcqa-btn-go-cart:focus {
    background-color: rgba(255,56,0,0.08) !important;
}

.wcqa-container .wcqa-btn-plus,
.wcqa-container .wcqa-btn-minus {
    width: auto;
    height: auto;
    padding: 5px 10px;
    margin: 0;
    background-color: transparent;
    color: #ff3800;
    border: none;
    border-radius: 0;
    font-size: 18px;
    font-weight: bold;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: none !important;
    min-width: auto;
}

/* استایل SVG در دکمه منفی */
.wcqa-btn-minus svg {
    width: 16px;
    height: 16px;
    vertical-align: middle;
}

/* استایل‌های جدید برای دکمه‌های مثبت و منفی - تمام حالت‌ها */
button.wcqa-btn.wcqa-btn-plus,
button.wcqa-btn.wcqa-btn-plus:hover,
button.wcqa-btn.wcqa-btn-plus:active,
button.wcqa-btn.wcqa-btn-plus:focus {
    background-color: transparent !important;
    color: #ff3800 !important;
    transform: none !important;
    box-shadow: none !important;
    border: none !important;
    outline: none !important;
}

button.wcqa-btn.wcqa-btn-minus,
button.wcqa-btn.wcqa-btn-minus:hover,
button.wcqa-btn.wcqa-btn-minus:active,
button.wcqa-btn.wcqa-btn-minus:focus {
    background-color: transparent !important;
    color: #ff3800 !important;
    transform: none !important;
    box-shadow: none !important;
    border: none !important;
    outline: none !important;
}

span.wcqa-container .wcqa-quantity {
    background-color: transparent !important;
    color: #ff3800 !important;
}

.wcqa-quantity-controls {
    border: 0px !important;
    background-color: transparent !important;
    box-shadow: none !important;
    outline: none !important;
}

.wcqa-container .wcqa-quantity {
    min-width: 30px;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    color: #ff3800;
    padding: 5px 10px;
    background-color: transparent;
    border: none;
    border-radius: 0;
    line-height: 1;
}

/* انتخاب واریانت */
.wcqa-variation-selector {
    margin-bottom: 15px;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* دراپ داون واریانت - اجباری */
.wcqa-container .wcqa-variation-dropdown {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 100% !important;
    height: auto !important;
    min-height: 40px !important;
}

/* استایل‌های سفارشی کاربر */
span.wcqa-quantity {
    background-color: transparent !important;
    color: #ff3800 !important;
}

.wcqa-quantity-controls {
    border: 2px solid #ff3800 !important;
}

/* رفع مشکل aria-hidden */
.wcqa-container {
    pointer-events: auto !important;
}

.wcqa-container * {
    pointer-events: auto !important;
}

/* رفع مشکل focus */
.wcqa-btn:focus {
    outline: 2px solid #ff3800 !important;
    outline-offset: 2px !important;
}

/* رفع مشکل Swiper slider */
.swiper-slide .wcqa-container {
    pointer-events: auto !important;
}

.swiper-slide .wcqa-container * {
    pointer-events: auto !important;
}

/* رفع مشکل aria-hidden در Swiper */
.swiper-slide[aria-hidden="true"] .wcqa-container {
    pointer-events: auto !important;
}

.swiper-slide[aria-hidden="true"] .wcqa-container * {
    pointer-events: auto !important;
}

/* رفع مشکل inert در Swiper */
.swiper-slide[inert] .wcqa-container {
    pointer-events: auto !important;
}

.swiper-slide[inert] .wcqa-container * {
    pointer-events: auto !important;
}

/* رفع مشکل کلیک در Swiper */
.swiper-slide .wcqa-btn {
    pointer-events: auto !important;
    cursor: pointer !important;
}

.swiper-slide[aria-hidden="true"] .wcqa-btn {
    pointer-events: auto !important;
    cursor: pointer !important;
}

.swiper-slide[inert] .wcqa-btn {
    pointer-events: auto !important;
    cursor: pointer !important;
}

/* رفع مشکل focus در Swiper */
.swiper-slide .wcqa-btn:focus {
    outline: 2px solid #ff3800 !important;
    outline-offset: 2px !important;
    pointer-events: auto !important;
}

.wcqa-container .wcqa-variation-dropdown {
    width: 100%;
    padding: 12px 15px;
    background-color: #ffffff;
    color: #333333;
    border: 2px solid #ff3800;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: none !important;
    box-sizing: border-box;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ff3800' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
    position: relative;
    z-index: 1;
}

/* استایل گزینه‌های واریانت مطابق ووکامرس */
.wcqa-variation-dropdown option {
    padding: 8px 12px;
    background-color: #ffffff;
    color: #333333;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.4;
}

.wcqa-variation-dropdown option.attached {
    font-weight: 500;
}

.wcqa-variation-dropdown option.enabled {
    color: #333333;
    cursor: pointer;
}

.wcqa-variation-dropdown option.disabled {
    color: #999999;
    cursor: not-allowed;
}

.wcqa-variation-dropdown option:checked {
    background-color: #ff3800;
    color: #ffffff;
}

.wcqa-variation-dropdown option:hover {
    background-color: #f5f5f5;
}

.wcqa-variation-dropdown option:focus {
    background-color: #ff3800;
    color: #ffffff;
}

.wcqa-variation-dropdown:focus {
    outline: none;
    border-color: #ff3800;
    box-shadow: 0 0 0 3px rgba(255, 56, 0, 0.1);
}

.wcqa-variation-dropdown:hover {
    border-color: #e52e00;
}

.wcqa-variation-dropdown:invalid {
    border-color: #dc3545;
}

.wcqa-variation-dropdown:valid {
    border-color: #28a745;
}

/* پیام‌ها */
.wcqa-container .wcqa-message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    z-index: 9999;
    max-width: 300px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: none !important;
}

.wcqa-message-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.wcqa-message-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* حذف انیمیشن‌ها برای بهبود عملکرد */

/* حذف انیمیشن از کنترل‌های تعداد */
.wcqa-quantity-controls {
    animation: none !important;
}

/* حذف انیمیشن لودینگ برای بهبود عملکرد */
.wcqa-btn.loading {
    position: relative;
    color: transparent;
}

.wcqa-btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #ffffff;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: none !important;
}

/* ریسپانسیو - بهبود یافته */
/* تبلت بزرگ */
@media (max-width: 1024px) {
    .wcqa-container {
        margin: 8px 0;
    }
    
    .wcqa-btn {
        padding: 11px 18px;
        font-size: 13px;
    }
    
    .wcqa-quantity-controls {
        padding: 7px 12px;
        gap: 12px;
    }
    
    .wcqa-btn-plus,
    .wcqa-btn-minus {
        width: 32px;
        height: 32px;
        font-size: 16px;
        min-width: 32px;
    }
    
    .wcqa-container .wcqa-quantity {
        font-size: 15px;
        padding: 6px 12px;
        min-width: 28px;
    }
    
    .wcqa-container .wcqa-variation-dropdown {
        padding: 11px 14px;
        font-size: 13px;
    }
}

/* تبلت */
@media (max-width: 768px) {
    .wcqa-container {
        margin: 6px 0;
    }
    
    .wcqa-btn {
        padding: 10px 15px;
        font-size: 13px;
        min-height: 44px; /* بهبود دسترسی لمسی */
    }
    
    .wcqa-quantity-controls {
        padding: 6px 10px;
        gap: 10px;
        min-height: 44px; /* بهبود دسترسی لمسی */
    }
    
    .wcqa-btn-plus,
    .wcqa-btn-minus {
        width: 30px;
        height: 30px;
        font-size: 16px;
        min-width: 30px;
        min-height: 30px; /* بهبود دسترسی لمسی */
        transition: none !important;
    }
    
    .wcqa-container .wcqa-quantity {
        font-size: 14px;
        padding: 6px 10px;
        min-width: 25px;
    }
    
    .wcqa-container .wcqa-variation-dropdown {
        padding: 10px 12px;
        font-size: 13px;
        min-height: 44px; /* بهبود دسترسی لمسی */
    }
    
    .wcqa-container .wcqa-message {
        right: 10px;
        left: 10px;
        max-width: none;
        font-size: 13px;
    }
}

/* موبایل بزرگ */
@media (max-width: 600px) {
    .wcqa-container {
        margin: 5px 0;
    }
    
    .wcqa-btn {
        padding: 9px 14px;
        font-size: 12px;
        min-height: 42px;
    }
    
    .wcqa-quantity-controls {
        padding: 5px 8px;
        gap: 8px;
        min-height: 42px;
    }
    
    .wcqa-btn-plus,
    .wcqa-btn-minus {
        width: 28px;
        height: 28px;
        font-size: 15px;
        min-width: 28px;
        min-height: 28px;
    }
    
    .wcqa-container .wcqa-quantity {
        font-size: 13px;
        padding: 5px 8px;
        min-width: 22px;
    }
    
    .wcqa-container .wcqa-variation-dropdown {
        padding: 9px 11px;
        font-size: 12px;
        min-height: 42px;
    }
}

/* موبایل */
@media (max-width: 480px) {
    .wcqa-container {
        margin: 4px 0;
    }
    
    .wcqa-btn {
        padding: 8px 12px;
        font-size: 12px;
        min-height: 40px;
        width: 100%;
    }
    
    .wcqa-quantity-controls {
        padding: 4px 6px;
        gap: 6px;
        min-height: 40px;
        width: 100%;
    }
    
    .wcqa-btn-plus,
    .wcqa-btn-minus {
        width: 26px;
        height: 26px;
        font-size: 14px;
        min-width: 26px;
        min-height: 26px;
        transition: none !important;
    }
    
    .wcqa-container .wcqa-quantity {
        font-size: 13px;
        padding: 5px 8px;
        min-width: 20px;
    }
    
    .wcqa-container .wcqa-variation-dropdown {
        padding: 8px 10px;
        font-size: 12px;
        min-height: 40px;
        width: 100%;
    }
    
    .wcqa-container .wcqa-message {
        right: 5px;
        left: 5px;
        font-size: 12px;
        padding: 8px 12px;
    }
}

/* موبایل کوچک */
@media (max-width: 360px) {
    .wcqa-container {
        margin: 3px 0;
    }
    
    .wcqa-btn {
        padding: 7px 10px;
        font-size: 11px;
        min-height: 38px;
    }
    
    .wcqa-quantity-controls {
        padding: 3px 5px;
        gap: 5px;
        min-height: 38px;
    }
    
    .wcqa-btn-plus,
    .wcqa-btn-minus {
        width: 24px;
        height: 24px;
        font-size: 13px;
        min-width: 24px;
        min-height: 24px;
    }
    
    .wcqa-container .wcqa-quantity {
        font-size: 12px;
        padding: 4px 6px;
        min-width: 18px;
    }
    
    .wcqa-container .wcqa-variation-dropdown {
        padding: 7px 9px;
        font-size: 11px;
        min-height: 38px;
    }
}

/* حالت landscape موبایل */
@media (max-height: 500px) and (orientation: landscape) {
    .wcqa-container {
        margin: 2px 0;
    }
    
    .wcqa-btn {
        padding: 6px 12px;
        font-size: 11px;
        min-height: 32px;
    }
    
    .wcqa-quantity-controls {
        padding: 2px 6px;
        gap: 4px;
        min-height: 32px;
    }
    
    .wcqa-btn-plus,
    .wcqa-btn-minus {
        width: 22px;
        height: 22px;
        font-size: 12px;
        min-width: 22px;
        min-height: 22px;
    }
    
    .wcqa-container .wcqa-quantity {
        font-size: 11px;
        padding: 3px 6px;
        min-width: 16px;
    }
    
    .wcqa-container .wcqa-variation-dropdown {
        padding: 6px 8px;
        font-size: 11px;
        min-height: 32px;
    }
}

/* بهبود برای صفحات لمسی */
@media (hover: none) and (pointer: coarse) {
    .wcqa-btn {
        min-height: 44px;
        padding: 12px 20px;
    }
    
    .wcqa-quantity-controls {
        min-height: 44px;
        padding: 8px 15px;
    }
    
    .wcqa-btn-plus,
    .wcqa-btn-minus {
        min-width: 32px;
        min-height: 32px;
    }
    
    .wcqa-container .wcqa-variation-dropdown {
        min-height: 44px;
        padding: 12px 15px;
    }
}

/* بهبود برای صفحات با DPI بالا */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .wcqa-btn {
        border-width: 0.5px;
    }
    
    .wcqa-quantity-controls {
        border-width: 0.5px;
    }
    
    .wcqa-container .wcqa-variation-dropdown {
        border-width: 0.5px;
    }
}

/* سازگاری با تم‌های مختلف */
.theme-twenty-twenty-one .wcqa-container,
.theme-twenty-twenty-two .wcqa-container,
.theme-twenty-twenty-three .wcqa-container {
    font-family: inherit;
}

/* سازگاری با ووکامرس */
.woocommerce .wcqa-container {
    margin: 15px 0;
}

.woocommerce .wcqa-btn {
    font-family: inherit;
}

/* سازگاری با المنتور */
.elementor-widget-wcqa-quick-add .wcqa-container {
    width: 100%;
}

.elementor-widget-wcqa-quick-add .wcqa-btn {
    width: 100%;
}

/* حالت تاریک */
@media (prefers-color-scheme: dark) {
    .wcqa-quantity-controls {
        background-color: #2d3748;
        border-color: #4a5568;
    }
    
    .wcqa-btn-plus,
    .wcqa-btn-minus {
        background-color: transparent;
        color: #ff3800;
        border-color: transparent;
        transition: none !important;
    }
    
    .wcqa-container .wcqa-quantity {
        background-color: #4a5568;
        color: #e2e8f0;
        border-color: #4a5568;
    }
    
    .wcqa-container .wcqa-variation-dropdown {
        background-color: #2d3748;
        color: #e2e8f0;
        border-color: #4a5568;
    }
    
    .wcqa-variation-dropdown:focus {
        border-color: #ff6b35;
    }
}

/* پیام‌ها */
.wcqa-container .wcqa-message {
    padding: 10px;
    margin: 5px 0;
    border-radius: 4px;
    font-size: 14px;
    text-align: center;
    display: block;
    width: 100%;
    box-sizing: border-box;
}

.wcqa-message-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.wcqa-message-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* پیام‌های محصولات غیرقابل خرید */
.wcqa-container .wcqa-container .wcqa-message {
    margin: 5px 0;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 500;
}

/* بهبود دسترسی */
.wcqa-btn:focus {
    outline: 2px solid #ff6b35;
    outline-offset: 2px;
}

.wcqa-btn-plus:focus,
.wcqa-btn-minus:focus {
    outline: 2px solid #ff6b35;
    outline-offset: 2px;
}

.wcqa-variation-dropdown:focus {
    outline: 2px solid #ff6b35;
    outline-offset: 2px;
}

/* حالت پرینت */
@media print {
    .wcqa-container {
        display: none;
    }
}

/* کلاس‌های ریسپانسیو جدید */
.wcqa-mobile-optimized {
    /* بهینه‌سازی خودکار برای موبایل - تنظیمات در JavaScript اعمال می‌شود */
    position: relative;
}

.wcqa-touch-friendly {
    /* بهبود تجربه لمسی - تنظیمات در JavaScript اعمال می‌شود */
    position: relative;
}

.wcqa-touch-friendly .wcqa-btn {
    padding: 5px !important;
}

.wcqa-touch-friendly .wcqa-quantity-controls {
    min-height: 44px;
    padding: 8px 15px;
}

.wcqa-touch-friendly .wcqa-container .wcqa-variation-dropdown {
    min-height: 44px;
    padding: 12px 15px;
}

/* کلاس‌های breakpoint */
.wcqa-mobile .wcqa-container {
    width: 100%;
}

.wcqa-mobile .wcqa-btn {
    width: 100%;
    min-height: 40px;
}

.wcqa-mobile .wcqa-quantity-controls {
    width: 100%;
    min-height: 40px;
}

.wcqa-mobile .wcqa-container .wcqa-variation-dropdown {
    width: 100%;
    min-height: 40px;
}

.wcqa-tablet .wcqa-btn {
    min-height: 44px;
}

.wcqa-tablet .wcqa-quantity-controls {
    min-height: 44px;
}

.wcqa-tablet .wcqa-container .wcqa-variation-dropdown {
    min-height: 44px;
}

.wcqa-mobile-landscape .wcqa-container {
    margin: 2px 0;
}

.wcqa-mobile-landscape .wcqa-btn {
    min-height: 32px;
    padding: 6px 12px;
}

.wcqa-mobile-landscape .wcqa-quantity-controls {
    min-height: 32px;
    padding: 2px 6px;
}

.wcqa-mobile-landscape .wcqa-container .wcqa-variation-dropdown {
    min-height: 32px;
    padding: 6px 8px;
}

/* بهبود عملکرد در دستگاه‌های ضعیف */
@media (prefers-reduced-motion: reduce) {
    .wcqa-container * {
        transition: none !important;
        animation: none !important;
    }
}

/* بهبود کنتراست برای دسترسی */
@media (prefers-contrast: high) {
    .wcqa-btn {
        border: 2px solid currentColor;
    }
    
    .wcqa-quantity-controls {
        border: 2px solid currentColor;
    }
    
    .wcqa-container .wcqa-variation-dropdown {
        border: 2px solid currentColor;
    }
}
