/* ---------- استایل برگه‌ها ---------- */

#page-template {
    box-sizing: border-box;
    max-width: 1140px;
    margin-inline: auto;
    margin-top: 20px;
}

/* موبایل کوچک */
@media screen and (max-width: 480px) {
    #page-template {
        margin-inline: 10px;
    }
}

/* موبایل بزرگ / تبلت کوچک */
@media screen and (min-width: 481px) and (max-width: 768px) {
    #page-template {
        margin-inline: 20px;
    }
}

/* تیترها */
h1.rp-entry-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #f24000;
    margin-top: 50px;
}

#page-template h2,
#page-template h3,
#page-template h4,
#page-template h5,
#page-template h6 {
    margin-top: 15px;
    margin-bottom: 15px;
}

#page-template h2 {
    font-size: 19px;
    font-weight: 600;
}

#page-template h3 {
    font-size: 18px;
    font-weight: 500;
}

#page-template h4 {
    font-size: 17px;
    font-weight: 500;
}

#page-template h5 {
    font-size: 16px;
    font-weight: 500;
}

#page-template h6 {
    font-size: 15px;
    font-weight: 600;
}

/* موبایل */
@media screen and (max-width: 768px) {
    h1.rp-entry-title {
        font-size: 17px;
    }

    #page-template h2 {
        font-size: 15px;
    }

    #page-template h3,
    #page-template h4,
    #page-template h5,
    #page-template h6 {
        font-size: 14px;
    }
}

/* لینک‌ها و المان‌های عمومی */
#page-template a {
    font-weight: 400;
    margin-inline: 2px;
}

#page-template hr {
    margin-top: 15px;
    margin-bottom: 15px;
}

#page-template strong {
    font-weight: 500;
    color: #54595f !important;
}

/* ---------- لینک تلفن عمومی ---------- */

.rp-phone-link {
    font-size: 14px;
    font-weight: 400;
    color: #ffffff;
    background: #ff5722;
    height: 27px;
    padding: 4px 15px;
    width: auto;
    border-radius: 15px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.25s ease, color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
    transform-origin: center;
}

.rp-phone-link:hover,
.rp-phone-link:focus-visible {
    color: #ffffff;
    background: #e64a19;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(255, 87, 34, .26);
}

.rp-phone-link:active {
    background: #d84315;
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(255, 87, 34, .20);
}

/* RP v0.1.748 — requested account, favorite, cart and checkout refinements */
body.woocommerce-account .rp-account-favorites__title {
    margin: 0 0 20px !important;
    font-size: 16px !important;
    font-weight: 700 !important;
}

body.woocommerce-account .rp-account-favorites__products .products > li.product {
    width: auto !important;
    margin: 0 !important;
    float: none !important;
    border-radius: 10px !important;
}

body.rp-compare-mode-active .rp-shop-archive .rp-shop-card-mobile .rp-shop-card-mobile-compare,
body.rp-compare-mode-active .rp-shop-archive .rp-shop-card-mobile .rp-product-compare-mini.rp-shop-card-mobile-compare {
    display: inline-flex !important;
    top: 0 !important;
    left: 30px !important;
    right: auto !important;
    width: 20px !important;
    min-width: 20px !important;
    height: 20px !important;
    min-height: 20px !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    transform: none !important;
    z-index: 45 !important;
    border-radius: 6px !important;
}

body.single-product .rp-single-need-box .rp-single-need-card .rp-product-favorite-btn .rp-favorite-icon,
body.single-product .rp-single-need-box .rp-single-need-card .rp-single-need-card-favorite .rp-favorite-icon {
    width: 20px !important;
    height: 20px !important;
    background: #d9d6d6;
}

.rp-product-card-component .rp-product-favorite-btn,
.rp-widget-products .rp-product-card-component .rp-product-favorite-btn,
.related.products .rp-product-card-component .rp-product-favorite-btn,
.upsells.products .rp-product-card-component .rp-product-favorite-btn,
.cross-sells .rp-product-card-component .rp-product-favorite-btn,
body.woocommerce-cart .rp-product-card-component .rp-product-favorite-btn {
    position: absolute !important;
    top: 10px !important;
    left: 10px !important;
    right: auto !important;
    width: 20px !important;
    min-width: 20px !important;
    max-width: 20px !important;
    height: 20px !important;
    min-height: 20px !important;
    max-height: 20px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 50% !important;
    background: rgba(255,255,255,.94) !important;
    color: #d9d6d6 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    transform: none !important;
    z-index: 42 !important;
}

body.woocommerce-cart .woocommerce-cart-form table.shop_table tr.cart_item td.product-price::before,
body.woocommerce-cart .woocommerce-cart-form table.cart tr.cart_item td.product-price::before,
body.woocommerce-cart .woocommerce-cart-form table.shop_table tr.cart_item td.product-quantity::before,
body.woocommerce-cart .woocommerce-cart-form table.cart tr.cart_item td.product-quantity::before,
body.woocommerce-cart .woocommerce-cart-form table.shop_table tr.cart_item td.product-subtotal::before,
body.woocommerce-cart .woocommerce-cart-form table.cart tr.cart_item td.product-subtotal::before {
    flex: 0 0 auto !important;
    color: #8f8f8f !important;
    font-size: 12.5px !important;
    font-weight: 700 !important;
    line-height: 1.7 !important;
    text-align: right !important;
    white-space: nowrap !important;
}

body.woocommerce-cart .woocommerce-cart-form table.shop_table tr.cart_item td.product-name a,
body.woocommerce-cart .woocommerce-cart-form table.cart tr.cart_item td.product-name a {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    color: #111820 !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    line-height: 1.8 !important;
    text-align: right !important;
    text-decoration: none !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
}

body.woocommerce-checkout .rp-checkout-product-title {
    display: inline !important;
    white-space: normal !important;
    word-break: normal !important;
    overflow-wrap: break-word !important;
    font-weight: 500 !important;
}

.rp-cart-sidebar-item {
    position: relative;
    width: 100%;
    padding: 15px 0;
    border-bottom: 1px solid #eeeeee;
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
    direction: rtl;
    margin: 5px 0;
}

/* RP v0.1.749 — unified product-card favorite visibility and sizing */
.rp-widget-products .rp-product-card-component .rp-card-price-values,
.rp-widget-products .rp-product-card-component .rp-shop-card-price-values {
    order: 1 !important;
    margin-right: auto !important;
    margin-left: 10px !important;
    display: flex !important;
    flex-direction: row !important;
    direction: ltr !important;
    align-items: baseline !important;
    justify-content: flex-end !important;
    gap: 6px !important;
    text-align: left !important;
    flex-wrap: nowrap !important;
}

/* Keep every product-card favorite button and icon exactly 20 × 20. */
.rp-product-card-component .rp-product-favorite-btn,
.rp-widget-products .rp-product-card-component .rp-product-favorite-btn,
.related.products .rp-product-card-component .rp-product-favorite-btn,
.upsells.products .rp-product-card-component .rp-product-favorite-btn,
.cross-sells .rp-product-card-component .rp-product-favorite-btn,
body.woocommerce-cart .rp-product-card-component .rp-product-favorite-btn,
body.single-product .rp-single-need-box .rp-single-need-card .rp-product-favorite-btn,
body.single-product .rp-single-need-box .rp-single-need-card .rp-single-need-card-favorite {
    position: absolute !important;
    top: 10px !important;
    left: 10px !important;
    right: auto !important;
    width: 20px !important;
    min-width: 20px !important;
    max-width: 20px !important;
    height: 20px !important;
    min-height: 20px !important;
    max-height: 20px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 50% !important;
    background: rgba(255,255,255,.94) !important;
    color: #d9d6d6 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    transform: none !important;
    pointer-events: auto !important;
    z-index: 42 !important;
}

.rp-product-card-component .rp-product-favorite-btn .rp-favorite-icon,
.rp-widget-products .rp-product-card-component .rp-product-favorite-btn .rp-favorite-icon,
.related.products .rp-product-card-component .rp-product-favorite-btn .rp-favorite-icon,
.upsells.products .rp-product-card-component .rp-product-favorite-btn .rp-favorite-icon,
.cross-sells .rp-product-card-component .rp-product-favorite-btn .rp-favorite-icon,
body.woocommerce-cart .rp-product-card-component .rp-product-favorite-btn .rp-favorite-icon,
body.single-product .rp-single-need-box .rp-single-need-card .rp-product-favorite-btn .rp-favorite-icon,
body.single-product .rp-single-need-box .rp-single-need-card .rp-single-need-card-favorite .rp-favorite-icon,
.rp-shop-archive .rp-product-favorite-btn .rp-favorite-icon {
    width: 20px !important;
    min-width: 20px !important;
    max-width: 20px !important;
    height: 20px !important;
    min-height: 20px !important;
    max-height: 20px !important;
}

/* Desktop: hidden initially; visible on card hover/focus, or permanently when selected/loading. */
@media (min-width: 769px) {
    .rp-product-card-component .rp-product-favorite-btn,
    .rp-widget-products .rp-product-card-component .rp-product-favorite-btn,
    .related.products .rp-product-card-component .rp-product-favorite-btn,
    .upsells.products .rp-product-card-component .rp-product-favorite-btn,
    .cross-sells .rp-product-card-component .rp-product-favorite-btn,
    body.woocommerce-cart .rp-product-card-component .rp-product-favorite-btn,
    body.single-product .rp-single-need-box .rp-single-need-card .rp-product-favorite-btn,
    body.single-product .rp-single-need-box .rp-single-need-card .rp-single-need-card-favorite {
        opacity: 0 !important;
        visibility: hidden !important;
    }

    .rp-product-card-component:hover .rp-product-favorite-btn,
    .rp-product-card-component:focus-within .rp-product-favorite-btn,
    .rp-widget-products .rp-product-card-component:hover .rp-product-favorite-btn,
    .rp-widget-products .rp-product-card-component:focus-within .rp-product-favorite-btn,
    .related.products .rp-product-card-component:hover .rp-product-favorite-btn,
    .related.products .rp-product-card-component:focus-within .rp-product-favorite-btn,
    .upsells.products .rp-product-card-component:hover .rp-product-favorite-btn,
    .upsells.products .rp-product-card-component:focus-within .rp-product-favorite-btn,
    .cross-sells .rp-product-card-component:hover .rp-product-favorite-btn,
    .cross-sells .rp-product-card-component:focus-within .rp-product-favorite-btn,
    body.woocommerce-cart .rp-product-card-component:hover .rp-product-favorite-btn,
    body.woocommerce-cart .rp-product-card-component:focus-within .rp-product-favorite-btn,
    body.single-product .rp-single-need-box .rp-single-need-card:hover .rp-product-favorite-btn,
    body.single-product .rp-single-need-box .rp-single-need-card:focus-within .rp-product-favorite-btn,
    body.single-product .rp-single-need-box .rp-single-need-card:hover .rp-single-need-card-favorite,
    body.single-product .rp-single-need-box .rp-single-need-card:focus-within .rp-single-need-card-favorite,
    .rp-product-favorite-btn.is-active,
    .rp-product-favorite-btn.is-loading {
        opacity: 1 !important;
        visibility: visible !important;
    }
}

/* Mobile/tablet: no hover exists, so the heart is always visible. */
@media (max-width: 768px) {
    .rp-product-card-component .rp-product-favorite-btn,
    .rp-widget-products .rp-product-card-component .rp-product-favorite-btn,
    .related.products .rp-product-card-component .rp-product-favorite-btn,
    .upsells.products .rp-product-card-component .rp-product-favorite-btn,
    .cross-sells .rp-product-card-component .rp-product-favorite-btn,
    body.woocommerce-cart .rp-product-card-component .rp-product-favorite-btn,
    body.single-product .rp-single-need-box .rp-single-need-card .rp-product-favorite-btn,
    body.single-product .rp-single-need-box .rp-single-need-card .rp-single-need-card-favorite {
        opacity: 1 !important;
        visibility: visible !important;
    }
}

/* Selected state must remain fixed and red in every context. */
.rp-product-favorite-btn.is-active,
.rp-single-need-card-favorite.is-active,
.rp-product-favorite-btn[aria-pressed="true"],
.rp-single-need-card-favorite[aria-pressed="true"] {
    color: #ef3f4c !important;
}

/* RP v0.1.750 — exact favorite behavior requested; scoped only to product cards. */
/* Base inactive color and fixed 20x20 icon/button in every product card. */
.rp-product-card-component .rp-product-favorite-btn,
.rp-widget-products .rp-product-card-component .rp-product-favorite-btn,
.related.products .rp-product-card-component .rp-product-favorite-btn,
.upsells.products .rp-product-card-component .rp-product-favorite-btn,
.cross-sells .rp-product-card-component .rp-product-favorite-btn,
body.woocommerce-cart .rp-product-card-component .rp-product-favorite-btn,
body.single-product .rp-single-need-box .rp-single-need-card .rp-product-favorite-btn,
body.single-product .rp-single-need-box .rp-single-need-card .rp-single-need-card-favorite {
    width: 20px !important;
    min-width: 20px !important;
    max-width: 20px !important;
    height: 20px !important;
    min-height: 20px !important;
    max-height: 20px !important;
    color: #d9d6d6 !important;
}

.rp-product-card-component .rp-product-favorite-btn .rp-favorite-icon,
.rp-widget-products .rp-product-card-component .rp-product-favorite-btn .rp-favorite-icon,
.related.products .rp-product-card-component .rp-product-favorite-btn .rp-favorite-icon,
.upsells.products .rp-product-card-component .rp-product-favorite-btn .rp-favorite-icon,
.cross-sells .rp-product-card-component .rp-product-favorite-btn .rp-favorite-icon,
body.woocommerce-cart .rp-product-card-component .rp-product-favorite-btn .rp-favorite-icon,
body.single-product .rp-single-need-box .rp-single-need-card .rp-product-favorite-btn .rp-favorite-icon,
body.single-product .rp-single-need-box .rp-single-need-card .rp-single-need-card-favorite .rp-favorite-icon {
    width: 20px !important;
    min-width: 20px !important;
    max-width: 20px !important;
    height: 20px !important;
    min-height: 20px !important;
    max-height: 20px !important;
    background: currentColor !important;
}

/* Desktop only: hidden until card hover/focus. Active/loading hearts remain visible permanently. */
@media (min-width: 821px) {
    .rp-product-card-component .rp-product-favorite-btn,
    .rp-widget-products .rp-product-card-component .rp-product-favorite-btn,
    .related.products .rp-product-card-component .rp-product-favorite-btn,
    .upsells.products .rp-product-card-component .rp-product-favorite-btn,
    .cross-sells .rp-product-card-component .rp-product-favorite-btn,
    body.woocommerce-cart .rp-product-card-component .rp-product-favorite-btn,
    body.single-product .rp-single-need-box .rp-single-need-card .rp-product-favorite-btn,
    body.single-product .rp-single-need-box .rp-single-need-card .rp-single-need-card-favorite {
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }

    .rp-product-card-component:hover .rp-product-favorite-btn,
    .rp-product-card-component:focus-within .rp-product-favorite-btn,
    body.single-product .rp-single-need-box .rp-single-need-card:hover .rp-product-favorite-btn,
    body.single-product .rp-single-need-box .rp-single-need-card:focus-within .rp-product-favorite-btn,
    body.single-product .rp-single-need-box .rp-single-need-card:hover .rp-single-need-card-favorite,
    body.single-product .rp-single-need-box .rp-single-need-card:focus-within .rp-single-need-card-favorite,
    .rp-product-favorite-btn.is-active,
    .rp-product-favorite-btn.is-loading,
    .rp-product-favorite-btn[aria-pressed="true"],
    .rp-single-need-card-favorite.is-active,
    .rp-single-need-card-favorite.is-loading,
    .rp-single-need-card-favorite[aria-pressed="true"] {
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
    }
}

/* Active remains red and visible after pointer leaves the card. */
.rp-product-favorite-btn.is-active,
.rp-product-favorite-btn[aria-pressed="true"],
.rp-single-need-card-favorite.is-active,
.rp-single-need-card-favorite[aria-pressed="true"] {
    color: #ef3f4c !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

/* Mobile: hearts are always visible; related/product/cart carousels are exactly 10px from top/left. */
@media (max-width: 820px) {
    .rp-product-card-component .rp-product-favorite-btn,
    .rp-widget-products .rp-product-card-component .rp-product-favorite-btn,
    .related.products .rp-product-card-component .rp-product-favorite-btn,
    .upsells.products .rp-product-card-component .rp-product-favorite-btn,
    .cross-sells .rp-product-card-component .rp-product-favorite-btn,
    body.woocommerce-cart .rp-product-card-component .rp-product-favorite-btn,
    body.single-product .rp-single-need-box .rp-single-need-card .rp-product-favorite-btn,
    body.single-product .rp-single-need-box .rp-single-need-card .rp-single-need-card-favorite {
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
    }

    .related.products .rp-product-card-component .rp-product-favorite-btn,
    .upsells.products .rp-product-card-component .rp-product-favorite-btn,
    .cross-sells .rp-product-card-component .rp-product-favorite-btn,
    body.woocommerce-cart .rp-product-card-component .rp-product-favorite-btn,
    .related.products .rp-product-card-component .rp-shop-card-mobile-favorite,
    .upsells.products .rp-product-card-component .rp-shop-card-mobile-favorite,
    .cross-sells .rp-product-card-component .rp-shop-card-mobile-favorite,
    body.woocommerce-cart .rp-product-card-component .rp-shop-card-mobile-favorite {
        top: 10px !important;
        left: 10px !important;
        right: auto !important;
    }

    /* "نیازت میشه": inactive mobile heart is gray by default. */
    body.single-product .rp-single-need-box .rp-single-need-card .rp-product-favorite-btn:not(.is-active):not([aria-pressed="true"]),
    body.single-product .rp-single-need-box .rp-single-need-card .rp-single-need-card-favorite:not(.is-active):not([aria-pressed="true"]) {
        color: #d9d6d6 !important;
    }
}


/* RP v0.1.751 — narrowly scoped mobile card refinements. */
@media (max-width: 820px) {
    /* Widget product cards: add the requested 20px left margin to the price row only. */
    .rp-widget-products .rp-product-card-component .rp-card-price-values,
    .rp-widget-products .rp-product-card-component .rp-shop-card-price-values {
        margin-left: 20px !important;
    }

    /* Related/up-sell and cart cross-sell carousels: pin the favorite to 10px / 10px. */
    .related.products .rp-product-card-component .rp-product-favorite-btn,
    .upsells.products .rp-product-card-component .rp-product-favorite-btn,
    .cross-sells .rp-product-card-component .rp-product-favorite-btn,
    body.woocommerce-cart .rp-product-card-component .rp-product-favorite-btn {
        top: 10px !important;
        left: 10px !important;
        right: auto !important;
    }
}
