/*!
Theme Name: کیدنس (کافئین‌مود)
Template: kadence
Version: 0.1.0
Text Domain: kadence-child
Description: Child theme of Kadence for Caffeinemood site customizations.
Author: Caffeinemood
Tags: rtl-language-support, e-commerce
*/

/* Custom CSS goes below this line */

/* WhatsApp button in footer */
.cm-whatsapp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    background: #25d366;
    color: #fff;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: background .2s ease;
}
.cm-whatsapp-btn:hover,
.cm-whatsapp-btn:focus { background: #1ebe57; color: #fff; }

/* Footer column tweaks */
.site-footer .widget-title {
    margin-bottom: 16px;
    font-size: 15px;
    font-weight: 700;
}
.site-footer .widget ul li a {
    transition: color .15s ease;
}

/* Trust badges row inside logo column */
.cm-footer-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 12px;
}
.cm-footer-badges img { max-height: 80px; width: auto; }

/* Category description — spacing from products grid above */
.woocommerce-products-header,
.term-description {
    margin-top: 56px;
}
.term-description > *:first-child {
    margin-top: 0;
}

/* Category description — read more / less toggle */
.term-description.cm-collapsible {
    position: relative;
    overflow: hidden;
    max-height: 320px;
    transition: max-height .35s ease;
}
.term-description.cm-collapsible.is-expanded {
    max-height: 9999px;
}
.term-description.cm-collapsible::after {
    content: "";
    position: absolute;
    inset: auto 0 0 0;
    height: 80px;
    background: linear-gradient(to bottom, rgba(255,255,255,0), var(--global-content-background, #fff));
    pointer-events: none;
}
.term-description.cm-collapsible.is-expanded::after {
    display: none;
}
.term-description img {
    max-width: 100%;
    height: auto;
}

.cm-readmore-btn {
    display: inline-block;
    margin: 16px auto 0;
    padding: 9px 24px;
    background: transparent;
    color: #0e5b3a;
    border: 1px solid currentColor;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.cm-readmore-btn:hover { background: rgba(14, 91, 58, .08); }

.cm-readmore-wrap {
    text-align: center;
    margin-top: 12px;
}

@media (max-width: 600px) {
    .term-description.cm-collapsible { max-height: 240px; }
}

/* Hide top-of-page category description — shown at bottom by caffeinemood plugin */
.product-archive-title .archive-description {
    display: none !important;
}

/* Responsive hero: desktop vs mobile image */
@media (min-width: 768px) {
    .cm-hero-mobile { display: none !important; }
}
@media (max-width: 767px) {
    .cm-hero-desktop { display: none !important; }
}

/* Mobile: hide result count */
@media (max-width: 1024px) {
    .woocommerce-result-count {
        display: none !important;
    }
}

/* ── Layered nav: uniform checkbox style (desktop sidebar + mobile overlay) ── */
.woocommerce-widget-layered-nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.woocommerce-widget-layered-nav-list__item {
    display: flex !important;
    align-items: center !important;
    padding: 4px 0 !important;
}
.woocommerce-widget-layered-nav-list__item .count {
    display: none !important;
}
.woocommerce-widget-layered-nav-list__item a {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    flex: 1 !important;
    font-size: 0.875em !important;
    text-decoration: none !important;
    color: inherit !important;
}
.woocommerce-widget-layered-nav-list__item a::before {
    content: '' !important;
    display: inline-block !important;
    flex-shrink: 0 !important;
    width: 16px !important;
    height: 16px !important;
    border: 1.5px solid #bbb !important;
    border-radius: 3px !important;
    background: #fff !important;
    transition: background 0.15s, border-color 0.15s !important;
}
.woocommerce-widget-layered-nav-list__item--chosen a::before {
    background: #1a6b3c !important;
    border-color: #1a6b3c !important;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolyline points='2.5,8 6,11.5 13.5,4.5' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    background-size: 12px !important;
}

/* Normalize layered_nav headings to match WC Block filter headings */
.widget_layered_nav h5.wp-block-heading {
    margin-top: 0 !important;
    margin-bottom: 0.625rem !important;
}

/* ── Mobile filter button (hidden on desktop, shown on mobile) ── */
.cm-mobile-filter-btn { display: none; }

@media (max-width: 600px) {
    /* Show filter button above products */
    .cm-mobile-filter-btn { display: block; }

    /* Hide classic widgets from sidebar — injected into WC overlay instead */
    #secondary .widget_layered_nav { display: none !important; }

    /* Hide WC block filter in sidebar — duplicate of cm-mobile-filter-btn */
    #secondary .wp-block-woocommerce-product-filters { display: none !important; }

    /* Filter + sort row */
    .cm-filter-sort-row {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 8px !important;
        margin-bottom: 8px !important;
    }
    .cm-filter-sort-row .kadence-shop-top-row {
        flex: 1 !important;
        margin: 0 !important;
        border: none !important;
        padding: 0 !important;
    }
    .cm-filter-sort-row .woocommerce-ordering {
        margin: 0 !important;
        width: 100% !important;
    }
    .cm-filter-sort-row .woocommerce-ordering select {
        width: 100% !important;
        padding: 10px 12px !important;
        font-size: inherit !important;
        font-weight: 700 !important;
        font-family: inherit !important;
        border: 1.5px solid #ddd !important;
        border-radius: 8px !important;
        background: #fff !important;
        color: inherit !important;
        appearance: none !important;
        -webkit-appearance: none !important;
        cursor: pointer !important;
    }

    /* Filter button: half width */
    .cm-mobile-filter-btn {
        flex: 0 0 50% !important;
        display: flex !important;
    }
    .cm-mobile-filter-btn .wc-block-product-filters { width: 100% !important; }
    .cm-mobile-filter-btn .wc-block-product-filters__open-overlay {
        width: 100% !important;
        justify-content: center !important;
        padding: 10px 12px !important;
        font-size: inherit !important;
        font-weight: 700 !important;
        font-family: inherit !important;
        border-radius: 8px !important;
    }
}

/* ── Classic widgets injected into WC Block overlay (mobile) ── */
.cm-injected-widgets {
    padding-bottom: 8px;
    margin-bottom: 8px;
    border-bottom: 1px solid #eee;
}
.cm-injected-widgets .widget {
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}
.cm-injected-widgets .widget:last-child {
    border-bottom: none;
    padding-bottom: 0;
}
.cm-injected-widgets h5.wp-block-heading {
    margin-top: 0 !important;
    margin-bottom: 0.625rem !important;
}

/* ── Checkout ── */
#billing_state_cm,
#billing_city_cm,
#billing_district_cm,
#shipping_state_cm,
#shipping_city_cm,
#shipping_district_cm {
    direction: rtl;
    padding-right: 12px;
    padding-left: 36px;
    background-position: left 10px center;
    text-align: right;
}

ul#shipping_method li {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    text-align: right;
}
ul#shipping_method li input[type="radio"] {
    order: -1;
    margin: 0;
    flex-shrink: 0;
}
ul#shipping_method li label {
    flex: 1;
    text-align: right;
}

.woocommerce #payment #place_order,
.woocommerce-page #payment #place_order {
    margin-top: 0 !important;
}

/* ── Product cards: align add-to-cart button to bottom ── */
li.wc-block-product {
    display: flex !important;
    flex-direction: column !important;
}
li.wc-block-product .wp-block-post-title {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
}

/* ── Login page: hide page title ── */
.page-id-19677 .entry-hero,
.page-id-19677 .entry-header,
body.page-id-19677 .page-title,
body.page-id-19677 h1.entry-title {
    display: none !important;
}

/* ── Mobile hero: edge-to-edge, no blur ── */
@media (max-width: 767px) {
    .cm-hero-mobile {
        margin-left: calc(-1 * var(--global-content-edge-padding));
        margin-right: calc(-1 * var(--global-content-edge-padding));
        width: calc(100% + 2 * var(--global-content-edge-padding));
        max-width: none;
    }
    .cm-hero-mobile img {
        width: 100%;
        height: auto;
        display: block;
    }
}

/* ── Sale badge: red background, white text, percent ── */
.onsale,
.wc-block-components-product-sale-badge {
    background-color: var(--global-palette13, #b82105) !important;
    color: #fff !important;
    border-radius: 0.4rem !important;
    font-weight: 700 !important;
    font-size: 0.8rem !important;
    padding: 2px 8px !important;
}
/* Hide the inner __text span default styling from WC Blocks */
.wc-block-components-product-sale-badge__text {
    color: #fff !important;
}

/* ── Carousel prev/next arrows: green ── */
.wc-block-next-previous-buttons__button {
    background: var(--global-palette1) !important;
    border-radius: 0.4rem !important;
    color: #fff !important;
}
.wc-block-next-previous-buttons__button:hover {
    background: var(--global-palette2) !important;
}
.wc-block-next-previous-buttons__button :where(.wc-block-next-previous-buttons__icon) {
    color: #fff !important;
}
