/**
 * Jahan Rayane - Store Enhancements (jahanrco.ir) v1.0.0
 */

/* =========================================================
   ۱. تصاویر اصلی و کامل محصولات در کارت‌ها و نمایش سریع
   ========================================================= */
body.jahanrco-se-full-images ul.products li.product img.attachment-full,
body.jahanrco-se-full-images .mw_product_item img.wp-post-image,
body.jahanrco-se-full-images .mw_product_item > a img {
    width: 100%;
    height: auto !important;
    object-fit: contain;
}

body.jahanrco-se-full-images .ah-quick-product .ah-thumbnail-image img {
    width: 100%;
    height: auto !important;
    max-height: 380px;
    object-fit: contain;
}

body.jahanrco-se-full-images .ah-quick-product .ah-gallery-images img {
    width: 100%;
    height: 80px;
    object-fit: contain !important;
    background: #ffffff;
}

/* =========================================================
   ۲. جایگاه و اندازه لوگوی برند در صفحه تکی محصول (بالای عنوان، سمت چپ)
   ========================================================= */
body.jahanrco-se-brand-reposition.single-product .summary.entry-summary > .wpcbr-wrap,
body.jahanrco-se-brand-reposition.single-product div.product div.summary .wpcbr-wrap {
    display: flex !important;
    flex-wrap: wrap;
    width: 100% !important;
    direction: ltr !important;
    justify-content: flex-start !important;
    align-items: center !important;
    margin: 0 0 10px 0 !important;
    padding: 0 !important;
    clear: both;
}

body.jahanrco-se-brand-reposition.single-product .summary.entry-summary > .wpcbr-wrap .wpcbr-brands {
    display: inline-flex !important;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

body.jahanrco-se-brand-reposition.single-product .summary.entry-summary > .wpcbr-wrap .wpcbr-brand-image a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    border-radius: 8px;
    background: rgba(248, 250, 252, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.08);
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

body.jahanrco-se-brand-reposition.single-product .summary.entry-summary > .wpcbr-wrap .wpcbr-brand-image a:hover {
    border-color: rgba(0, 0, 0, 0.22);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.06);
}

body.jahanrco-se-brand-reposition.single-product .summary.entry-summary > .wpcbr-wrap .wpcbr-brand-image img {
    max-height: var(--jahanrco-brand-max-h, 34px) !important;
    max-width: 96px !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    display: block !important;
    margin: 0 !important;
}

/* =========================================================
   ۳. خط مشکی کمرنگ زیر تصاویر کوچک گالری (صفحه محصول و نمایش سریع)
   ========================================================= */
body.jahanrco-se-gallery-underline .product-gallery-thumbs-slider .swiper-slide,
body.jahanrco-se-gallery-underline .ah-quick-product-thumb-carousel .swiper-slide {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
    cursor: pointer;
}

body.jahanrco-se-gallery-underline .product-gallery-thumbs-slider .swiper-slide img,
body.jahanrco-se-gallery-underline .ah-quick-product-thumb-carousel .swiper-slide img {
    width: 100% !important;
    display: block !important;
}

body.jahanrco-se-gallery-underline .product-gallery-thumbs-slider .swiper-slide img {
    height: auto !important;
}

body.jahanrco-se-gallery-underline .product-gallery-thumbs-slider .swiper-slide:not(.swiper-slide-thumb-active)::after,
body.jahanrco-se-gallery-underline .ah-quick-product-thumb-carousel .swiper-slide:not(.swiper-slide-thumb-active)::after {
    content: "";
    display: block;
    width: 100%;
    height: 2px;
    margin-top: 2px;
    background-color: rgba(0, 0, 0, 0.22);
    border-radius: 1px;
    transition: background-color 0.2s ease;
    flex-shrink: 0;
}

body.jahanrco-se-gallery-underline .product-gallery-thumbs-slider .swiper-slide:not(.swiper-slide-thumb-active):hover::after,
body.jahanrco-se-gallery-underline .ah-quick-product-thumb-carousel .swiper-slide:not(.swiper-slide-thumb-active):hover::after {
    background-color: rgba(0, 0, 0, 0.78);
}

/* پشتیبانی پیش‌فرض در صورت غیرفعال شدن اسلایدر گالری */
body.jahanrco-se-gallery-underline .woocommerce-product-gallery .flex-control-thumbs li {
    display: flex;
    flex-direction: column;
    align-items: center;
}

body.jahanrco-se-gallery-underline .woocommerce-product-gallery .flex-control-thumbs li img {
    width: 100%;
    display: block;
}

body.jahanrco-se-gallery-underline .woocommerce-product-gallery .flex-control-thumbs li img:not(.flex-active) {
    padding-bottom: 2px;
    border-bottom: 2px solid rgba(0, 0, 0, 0.22);
    transition: border-color 0.2s ease;
}

body.jahanrco-se-gallery-underline .woocommerce-product-gallery .flex-control-thumbs li img:not(.flex-active):hover {
    border-bottom-color: rgba(0, 0, 0, 0.78);
}

/* =========================================================
   ۴. استایل شیشه‌ای، فارسی‌سازی و اندازه باکس ویژگی‌های اضافی (WPCPO)
   ========================================================= */
body.jahanrco-se-options-box .wpcpo-wrapper {
    background: rgba(255, 255, 255, 0.64) !important;
    -webkit-backdrop-filter: blur(12px) saturate(140%);
    backdrop-filter: blur(12px) saturate(140%);
    border: 1px solid rgba(0, 0, 0, 0.14) !important;
    border-radius: 14px !important;
    padding: var(--jahanrco-wpcpo-pad, 12px 14px) !important;
    margin: 10px 0 18px !important;
    width: var(--jahanrco-wpcpo-width, 88%);
    max-width: 100%;
    font-size: var(--jahanrco-wpcpo-font-size, 12.5px) !important;
    box-sizing: border-box;
    transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.25s ease, border-color 0.25s ease !important;
}

body.jahanrco-se-options-box .wpcpo-wrapper:hover {
    transform: translateY(-4px) !important;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.09) !important;
    border-color: rgba(0, 0, 0, 0.24) !important;
}

body.jahanrco-se-options-box .wpcpo-wrapper .wpcpo-option-name strong {
    font-size: 1.04em;
}

body.jahanrco-se-options-box .wpcpo-wrapper .wpcpo-option-description p {
    margin: 4px 0 8px;
    font-size: 0.94em;
    color: #475569;
}

body.jahanrco-se-options-box .wpcpo-wrapper .wpcpo-option-form p.form-row {
    margin-bottom: 0 !important;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

body.jahanrco-se-options-box .wpcpo-wrapper .wpcpo-option-form label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    cursor: pointer;
    line-height: 1.55;
}

body.jahanrco-se-options-box .wpcpo-wrapper .wpcpo-total {
    margin: 12px 0 2px !important;
    padding: 10px 0 0 !important;
    border-top: 1px solid rgba(0, 0, 0, 0.08) !important;
    border-bottom: none !important;
}

body.jahanrco-se-options-box .wpcpo-wrapper .wpcpo-total ul li {
    padding: 4px 0;
    gap: 10px;
    align-items: baseline;
}

body.jahanrco-se-options-box .wpcpo-wrapper .wpcpo-total ul li.wpcpo-subtotal {
    margin-top: 8px !important;
    padding: 8px 0 2px !important;
    border-top: 1px dashed rgba(0, 0, 0, 0.12) !important;
}

body.jahanrco-se-options-box .wpcpo-wrapper .wpcpo-subtotal-amount {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    font-weight: 700;
    color: #0f172a;
}

body.jahanrco-se-options-box .wpcpo-wrapper .wpcpo-total ul li.wpcpo-subtotal .amount {
    margin-left: 0 !important;
}

body.jahanrco-se-options-box .wpcpo-wrapper .woocommerce-Price-amount,
body.jahanrco-se-options-box .wpcpo-wrapper .amount {
    display: inline-flex !important;
    flex-direction: row !important;
    direction: rtl !important;
    align-items: baseline;
    gap: 4px;
    unicode-bidi: isolate;
}

@media (max-width: 576px) {
    body.jahanrco-se-options-box .wpcpo-wrapper {
        width: 100%;
    }
}

/* =========================================================
   ۵. سیستم دوگانه دکمه خرید مستقیم + افزودن به سبد خرید و توست ۵ ثانیه‌ای
   ========================================================= */

/* چیدمان کنار هم دکمه‌ها در صفحه تکی محصول */
body.jahanrco-se-dual-cart.single-product form.cart .single_add_to_cart_button {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    margin-inline-end: 8px !important;
    margin-bottom: 8px !important;
}

body.jahanrco-se-dual-cart.single-product form.cart .jahanrco-single-add-cart-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 7px;
    vertical-align: middle;
    padding: 10px 18px !important;
    min-height: 44px;
    margin-bottom: 8px !important;
    background: #f0fdf4 !important;
    color: #15803d !important;
    border: 1.5px solid #22c55e !important;
    border-radius: 10px !important;
    font-size: 13.5px !important;
    font-weight: 700 !important;
    cursor: pointer;
    transition: all 0.2s ease !important;
    font-family: inherit;
    line-height: 1.4;
}

body.jahanrco-se-dual-cart.single-product form.cart .jahanrco-single-add-cart-btn:hover:not(:disabled) {
    background: #16a34a !important;
    color: #ffffff !important;
    border-color: #16a34a !important;
    box-shadow: 0 6px 16px rgba(22, 163, 74, 0.24);
}

body.jahanrco-se-dual-cart.single-product form.cart .jahanrco-single-add-cart-btn.is-disabled,
body.jahanrco-se-dual-cart.single-product form.cart .jahanrco-single-add-cart-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

body.jahanrco-se-dual-cart.single-product form.cart .jahanrco-single-add-cart-btn .jahanrco-single-cart-icon {
    display: inline-flex;
    align-items: center;
}

/* نماد کوچک سبد خرید خالی با افکت ورود محصول هنگام هاور در کارت‌های بایگانی */
body.jahanrco-se-dual-cart .mw_product_item .woo-shop-product-after-loop-item {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px;
    flex-wrap: wrap;
}

body.jahanrco-se-dual-cart .mw_product_item .woo-shop-product-after-loop-item > a.button.mw_add_to_cart {
    margin-bottom: 10px !important;
}

body.jahanrco-se-dual-cart .jahanrco-card-cart-btn {
    position: relative;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 39px;
    height: 39px;
    margin-bottom: 10px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    background: #ffffff !important;
    color: #1e73be !important;
    border: 1.5px solid #cbd5e1 !important;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
    transition: all 0.22s ease !important;
    flex-shrink: 0;
}

body.jahanrco-se-dual-cart .jahanrco-card-cart-btn:hover {
    background: #eff6ff !important;
    border-color: #1e73be !important;
    color: #1d4ed8 !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(30, 115, 190, 0.18);
}

body.jahanrco-se-dual-cart .jahanrco-card-cart-btn.is-added {
    background: #16a34a !important;
    border-color: #16a34a !important;
    color: #ffffff !important;
}

body.jahanrco-se-dual-cart .jahanrco-cart-svg-wrap {
    position: relative;
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

body.jahanrco-se-dual-cart .jahanrco-svg-empty,
body.jahanrco-se-dual-cart .jahanrco-svg-hover {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: opacity 0.2s ease, transform 0.22s ease;
}

body.jahanrco-se-dual-cart .jahanrco-svg-empty {
    opacity: 1;
}

body.jahanrco-se-dual-cart .jahanrco-svg-hover {
    opacity: 0;
    transform: translate(-50%, -62%);
}

body.jahanrco-se-dual-cart .jahanrco-card-cart-btn:hover .jahanrco-svg-empty,
body.jahanrco-se-dual-cart .jahanrco-card-cart-btn:focus-visible .jahanrco-svg-empty {
    opacity: 0;
    transform: translate(-50%, -40%) scale(0.85);
}

body.jahanrco-se-dual-cart .jahanrco-card-cart-btn:hover .jahanrco-svg-hover,
body.jahanrco-se-dual-cart .jahanrco-card-cart-btn:focus-visible .jahanrco-svg-hover {
    opacity: 1;
    transform: translate(-50%, -50%);
}

body.jahanrco-se-dual-cart .jahanrco-card-cart-btn:hover .jahanrco-drop-arrow {
    animation: jahanrcoCartDropIn 0.65s ease-in-out infinite alternate;
}

body.jahanrco-se-dual-cart .jahanrco-card-cart-btn.is-loading .jahanrco-cart-svg-wrap {
    opacity: 0;
}

body.jahanrco-se-dual-cart .jahanrco-card-cart-btn.is-loading::after,
body.jahanrco-se-dual-cart .jahanrco-btn-spin {
    content: "";
    width: 16px;
    height: 16px;
    border: 2px solid rgba(30, 115, 190, 0.25);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: jahanrcoSeSpin 0.7s linear infinite;
    display: inline-block;
}

body.jahanrco-se-dual-cart .jahanrco-card-cart-btn.is-loading::after {
    position: absolute;
}

@keyframes jahanrcoCartDropIn {
    from {
        transform: translateY(-2px);
    }
    to {
        transform: translateY(2px);
    }
}

@keyframes jahanrcoSeSpin {
    to {
        transform: rotate(360deg);
    }
}

/* اعلان توست ۵ ثانیه‌ای بالای صفحه */
.jahanrco-se-toast-container {
    position: fixed;
    top: 22px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 99999999;
    width: calc(100% - 28px);
    max-width: 560px;
    pointer-events: none;
    direction: rtl;
}

.jahanrco-se-toast {
    position: relative;
    overflow: hidden;
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 13px 16px;
    background: rgba(255, 255, 255, 0.96);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid #bbf7d0;
    border-right: 4px solid #16a34a;
    border-radius: 12px;
    box-shadow: 0 16px 38px rgba(15, 23, 42, 0.16);
    color: #0f172a;
    animation: jahanrcoToastSlideDown 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.jahanrco-se-toast.is-error {
    border-color: #fecaca;
    border-right-color: #dc2626;
}

.jahanrco-se-toast-main {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13.8px;
    font-weight: 600;
    line-height: 1.5;
    flex: 1 1 auto;
}

.jahanrco-se-toast-icon {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #dcfce7;
    color: #16a34a;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-weight: 700;
    font-size: 14px;
}

.jahanrco-se-toast.is-error .jahanrco-se-toast-icon {
    background: #fee2e2;
    color: #dc2626;
}

.jahanrco-se-toast-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.jahanrco-se-toast-view-cart {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    padding: 7px 14px !important;
    background: #16a34a !important;
    color: #ffffff !important;
    border-radius: 8px !important;
    font-size: 12.8px !important;
    font-weight: 700 !important;
    text-decoration: none !important;
    transition: background-color 0.2s ease;
    white-space: nowrap;
}

.jahanrco-se-toast-view-cart:hover {
    background: #15803d !important;
    color: #ffffff !important;
}

.jahanrco-se-toast-close {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 5px;
    transition: color 0.15s ease;
}

.jahanrco-se-toast-close:hover {
    color: #334155;
}

.jahanrco-se-toast-progress {
    position: absolute;
    bottom: 0;
    right: 0;
    height: 3px;
    width: 100%;
    background: #16a34a;
    transform-origin: right center;
}

.jahanrco-se-toast.is-error .jahanrco-se-toast-progress {
    background: #dc2626;
}

@keyframes jahanrcoToastSlideDown {
    from {
        opacity: 0;
        transform: translateY(-16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes jahanrcoToastProgress {
    from {
        transform: scaleX(1);
    }
    to {
        transform: scaleX(0);
    }
}
