/*
 * K87 unified theme layer
 * Loaded last to resolve style conflicts across shared pages.
 */

:root {
    --k87-surface: #ffffff;
    --k87-border: #e6edf5;
    --k87-text: #0f172a;
    --k87-text-muted: #64748b;
    --k87-brand: #2563eb;
    --k87-brand-dark: #1d4ed8;
    --k87-radius: 16px;
    --k87-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}

/* Header */
body .ast-primary-header-bar {
    background: var(--k87-surface) !important;
    border-bottom: 1px solid var(--k87-border) !important;
    box-shadow: 0 3px 16px rgba(15, 23, 42, 0.04) !important;
}

body .main-header-menu > .menu-item > .menu-link {
    color: var(--k87-text) !important;
    font-weight: 700 !important;
}

body .main-header-menu > .menu-item > .menu-link:hover,
body .main-header-menu > .current-menu-item > .menu-link {
    color: var(--k87-brand) !important;
}

body .ast-mobile-header-wrap .ast-button-wrap .mobile-menu-toggle-icon .ast-mobile-svg {
    fill: var(--k87-text) !important;
}

/* Header polish (desktop + mobile) */
body .ast-primary-header-bar .ast-builder-grid-row {
    max-width: 1320px !important;
    margin-inline: auto !important;
    padding-inline: 14px !important;
    align-items: center !important;
    column-gap: 10px !important;
}

body .ast-site-identity img.custom-logo,
body .ast-site-identity .custom-logo-link img {
    max-height: 56px !important;
    width: auto !important;
}

body .main-header-menu {
    gap: 2px !important;
}

body .main-header-menu > .menu-item {
    margin-inline: 2px !important;
}

body .main-header-menu > .menu-item > .menu-link {
    padding: 10px 12px !important;
    border-radius: 10px !important;
    font-size: 14px !important;
    line-height: 1.2 !important;
    transition: 0.2s ease !important;
}

body .main-header-menu > .menu-item:hover > .menu-link,
body .main-header-menu > .current-menu-item > .menu-link,
body .main-header-menu > .current-menu-ancestor > .menu-link {
    background: #eff6ff !important;
    color: var(--k87-brand) !important;
}

body .main-header-menu > .menu-item > .sub-menu,
body .main-header-menu > .menu-item > .astra-full-megamenu-wrapper {
    border: 1px solid var(--k87-border) !important;
    border-radius: 14px !important;
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.10) !important;
    padding: 8px !important;
    background: #fff !important;
}

body .main-header-menu .sub-menu .menu-link {
    padding: 9px 12px !important;
    border-radius: 9px !important;
    font-size: 13px !important;
}

body .main-header-menu .sub-menu .menu-item:hover > .menu-link {
    background: #f8fafc !important;
    color: var(--k87-brand) !important;
}

/* Header utility controls: account, cart, currency */
body .ast-header-account .ast-account-action-link,
body .ast-header-woo-cart .ast-addon-cart-wrap,
body .ast-header-woo-cart .ast-cart-menu-wrap,
body .site-header .k87-wrapper .k87-btn {
    min-height: 42px !important;
    border: 1px solid #dbe5ef !important;
    border-radius: 12px !important;
    background: #fff !important;
    color: var(--k87-text) !important;
    padding-inline: 12px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    box-shadow: none !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    text-align: center !important;
}

/* Currency button in custom K87 header must match cart icon button size exactly */
body .k87-site-header .k87-currency-slot .k87-btn,
body .k87-site-header .k87-wrapper .k87-btn {
    width: 42px !important;
    min-width: 42px !important;
    height: 42px !important;
    min-height: 42px !important;
    max-height: 42px !important;
    padding: 0 !important;
    padding-inline: 0 !important;
    gap: 0 !important;
    line-height: 1 !important;
    box-sizing: border-box !important;
}

/* Keep header controls compact even if a plugin adds ".button" classes there */
body .site-header a.button,
body .site-header button.button,
body .site-header input.button,
body .site-header .wp-element-button,
body .site-header .wp-block-button__link {
    min-height: 40px !important;
    height: auto !important;
    padding: 0 12px !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
    border-radius: 12px !important;
}

body .ast-header-account .ast-account-action-link:hover,
body .ast-header-woo-cart .ast-addon-cart-wrap:hover,
body .ast-header-woo-cart .ast-cart-menu-wrap:hover,
body .site-header .k87-wrapper .k87-btn:hover {
    background: #eff6ff !important;
    border-color: #bfdbfe !important;
    color: var(--k87-brand) !important;
}

body .ast-site-header-cart .count,
body .ast-site-header-cart .ast-count-text {
    background: var(--k87-brand) !important;
    color: #fff !important;
    border-radius: 999px !important;
}

/* Footer */
.k87-main-footer {
    background: var(--k87-surface) !important;
    border-top: 1px solid var(--k87-border) !important;
    color: var(--k87-text-muted) !important;
}

.k87-main-footer .k87-footer-inner {
    max-width: 1200px !important;
    margin: 0 auto !important;
    padding: 0 20px !important;
}

.k87-main-footer .k87-footer-top {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 30px !important;
    justify-content: space-between !important;
    align-items: flex-start !important;
}

.k87-main-footer .k87-footer-bottom {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 14px !important;
}

.k87-main-footer .k87-footer-bottom .k87-copyright {
    color: #94a3b8 !important;
    font-size: 13px !important;
    font-weight: 700 !important;
}

/* Remove the default outer content card (article#post-...) across site pages */
.ast-separate-container .ast-article-single,
.ast-separate-container .ast-article-post,
.ast-separate-container .ast-archive-description,
.ast-separate-container .comments-area,
.ast-separate-container .no-results,
.ast-separate-container .error-404 {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Keep custom template wrappers flat as well */
.k87-page-wrap article,
.k87-single-wrap article,
.k87-archive-wrap article,
.k87-home-wrap article,
.k87-shell-card {
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Search page (general store search) */
.k87-search-wrap {
    width: min(100% - 2rem, 1200px);
    margin: 24px auto 42px;
    direction: rtl;
}

.k87-search-results {
    border: 1px solid var(--k87-border);
    border-radius: var(--k87-radius);
    background: var(--k87-surface);
    box-shadow: var(--k87-shadow);
    padding: 16px;
}

.k87-search-no-results {
    border: 1px dashed #cbd5e1;
    border-radius: var(--k87-radius);
    background: #f8fafc;
    color: var(--k87-text-muted);
    padding: 22px;
    text-align: center;
}

/* Product cards + product loops */
body .woocommerce ul.products li.product,
body .s-product-card-entry {
    border: 1px solid var(--k87-border) !important;
    border-radius: var(--k87-radius) !important;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.05) !important;
    overflow: hidden !important;
}

body .woocommerce ul.products li.product .button,
body .woocommerce ul.products li.product .added_to_cart,
body .s-product-card-entry .button {
    background: var(--k87-brand) !important;
    color: #fff !important;
    border: none !important;
    font-weight: 800 !important;
    min-height: 40px !important;
}

body .woocommerce ul.products li.product .button:hover,
body .woocommerce ul.products li.product .added_to_cart:hover,
body .s-product-card-entry .button:hover {
    background: var(--k87-brand-dark) !important;
}

/* Single product surface */
body.single-product div.product {
    background: var(--k87-surface) !important;
    border: 1px solid var(--k87-border) !important;
    border-radius: 16px !important;
    box-shadow: var(--k87-shadow) !important;
}

/* Cart / Checkout / Account unified surfaces */
body.woocommerce-cart .k87-cart-card,
body.woocommerce-cart .cart_totals,
body.woocommerce-checkout .salla-card-section,
body.woocommerce-checkout .woocommerce-checkout-review-order-table,
body.woocommerce-account .woocommerce-MyAccount-navigation,
body.woocommerce-account .k87-dashboard-container {
    background: var(--k87-surface) !important;
    border: 1px solid var(--k87-border) !important;
    border-radius: var(--k87-radius) !important;
    box-shadow: var(--k87-shadow) !important;
}

/* Keep checkout payment wrapper flat; only inner custom boxes should appear */
body.woocommerce-checkout #payment,
body.woocommerce-checkout #payment.woocommerce-checkout-payment {
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

body.woocommerce-account .woocommerce-MyAccount-content {
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
}

body.woocommerce-cart .cart-main-wrapper,
body.woocommerce-checkout .my-checkout-container,
body.woocommerce-checkout form.checkout,
body.woocommerce-account .woocommerce {
    width: min(100% - 2rem, 1200px) !important;
    margin-inline: auto !important;
}

/* View-order page: collapse nested wrappers and keep one gutter only. */
body:is(.k87-view-order-page, .woocommerce-account.woocommerce-view-order) #primary,
body:is(.k87-view-order-page, .woocommerce-account.woocommerce-view-order) .content-area,
body:is(.k87-view-order-page, .woocommerce-account.woocommerce-view-order) .site-main,
body:is(.k87-view-order-page, .woocommerce-account.woocommerce-view-order) .entry-content,
body:is(.k87-view-order-page, .woocommerce-account.woocommerce-view-order) .woocommerce,
body:is(.k87-view-order-page, .woocommerce-account.woocommerce-view-order) .woocommerce-MyAccount-content {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}

/* Final button normalization on commerce pages (CTA only, no icon buttons) */
body.woocommerce-cart a.button,
body.woocommerce-cart button.button,
body.woocommerce-checkout a.button,
body.woocommerce-checkout button.button,
body.woocommerce-checkout .checkout-button,
body.woocommerce-checkout #place_order,
body.woocommerce-checkout .wc-forward,
body.woocommerce-account a.button,
body.woocommerce-account button.button,
body.woocommerce-account .woocommerce-Button.button {
    border-radius: 12px !important;
    min-height: 46px !important;
    font-weight: 800 !important;
    box-shadow: none !important;
}

body.woocommerce-cart input[type="text"],
body.woocommerce-cart input[type="email"],
body.woocommerce-cart input[type="tel"],
body.woocommerce-checkout input[type="text"],
body.woocommerce-checkout input[type="email"],
body.woocommerce-checkout input[type="tel"],
body.woocommerce-checkout input[type="number"],
body.woocommerce-checkout select,
body.woocommerce-checkout textarea,
body.woocommerce-account input[type="text"],
body.woocommerce-account input[type="email"],
body.woocommerce-account input[type="tel"],
body.woocommerce-account input[type="password"],
body.woocommerce-account select,
body.woocommerce-account textarea {
    border: 1px solid #dbe5ef !important;
    border-radius: 12px !important;
    background: #fff !important;
}

.k87-hidden-update-cart {
    display: none !important;
}

/* ---------------------------------------------------------
   Global Button Unification
   Except add-to-cart buttons in product displays/catalog pages.
--------------------------------------------------------- */
body .site-main a.button:not(.add_to_cart_button):not(.added_to_cart):not(.single_add_to_cart_button):not(.product_type_simple):not(.product_type_variable):not(.product_type_grouped):not(.product_type_external):not(.ajax_add_to_cart):not(.k87-hidden-update-cart),
body .site-main button.button:not(.add_to_cart_button):not(.single_add_to_cart_button):not(.ajax_add_to_cart):not(.k87-hidden-update-cart),
body .site-main input.button:not(.add_to_cart_button):not(.single_add_to_cart_button):not(.ajax_add_to_cart):not(.k87-hidden-update-cart),
body .site-main .wp-element-button:not(.add_to_cart_button):not(.single_add_to_cart_button):not(.ajax_add_to_cart):not(.k87-hidden-update-cart),
body .site-main .wp-block-button__link:not(.add_to_cart_button):not(.single_add_to_cart_button):not(.ajax_add_to_cart):not(.k87-hidden-update-cart),
body .site-main .checkout-button,
body .site-main .wc-forward,
body .site-main #place_order,
body .site-main .woocommerce-Button.button,
body .site-main .tc-main-btn,
body .site-main .tc-submit-btn,
body .site-main .tc-submit-action {
    background: #2f66df !important;
    color: #ffffff !important;
    border: 0 !important;
    border-radius: 16px !important;
    min-height: 56px !important;
    padding: 0 24px !important;
    font-size: 18px !important;
    font-weight: 800 !important;
    line-height: 1.2 !important;
    text-align: center !important;
    text-decoration: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: none !important;
}

body .site-main a.button:not(.add_to_cart_button):not(.added_to_cart):not(.single_add_to_cart_button):not(.product_type_simple):not(.product_type_variable):not(.product_type_grouped):not(.product_type_external):not(.ajax_add_to_cart):not(.k87-hidden-update-cart):hover,
body .site-main button.button:not(.add_to_cart_button):not(.single_add_to_cart_button):not(.ajax_add_to_cart):not(.k87-hidden-update-cart):hover,
body .site-main input.button:not(.add_to_cart_button):not(.single_add_to_cart_button):not(.ajax_add_to_cart):not(.k87-hidden-update-cart):hover,
body .site-main .wp-element-button:not(.add_to_cart_button):not(.single_add_to_cart_button):not(.ajax_add_to_cart):not(.k87-hidden-update-cart):hover,
body .site-main .wp-block-button__link:not(.add_to_cart_button):not(.single_add_to_cart_button):not(.ajax_add_to_cart):not(.k87-hidden-update-cart):hover,
body .site-main .checkout-button:hover,
body .site-main .wc-forward:hover,
body .site-main #place_order:hover,
body .site-main .woocommerce-Button.button:hover,
body .site-main .tc-main-btn:hover,
body .site-main .tc-submit-btn:hover,
body .site-main .tc-submit-action:hover {
    background: #1d4ed8 !important;
    color: #ffffff !important;
}

/* WooCommerce internal update-cart submit: keep functional but fully hidden */
body .site-main .k87-hidden-update-cart,
body .site-main button.k87-hidden-update-cart,
body .site-main input.k87-hidden-update-cart {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    min-height: 0 !important;
    min-width: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    overflow: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Remove "View cart" link generated after ajax add-to-cart (site-wide) */
body a.added_to_cart,
body a.added_to_cart.wc-forward,
body .woocommerce ul.products li.product a.added_to_cart,
body ul.products li.product a.added_to_cart,
body .s-product-card-entry a.added_to_cart {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    min-height: 0 !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    opacity: 0 !important;
    visibility: hidden !important;
    overflow: hidden !important;
    pointer-events: none !important;
}

/* Keep product add-to-cart actions on their own design */
body .woocommerce ul.products li.product .button,
body .woocommerce ul.products li.product .added_to_cart,
body .s-product-card-entry .button,
body .s-product-card-entry .added_to_cart,
body li.wc-block-grid__product .wc-block-grid__product-add-to-cart .wp-block-button__link,
body .single_add_to_cart_button,
body .add_to_cart_button,
body .ajax_add_to_cart {
    font-size: 13px !important;
}

/* Keep mobile layout cohesive */
@media (max-width: 991px) {
    body .ast-primary-header-bar .ast-builder-grid-row {
        padding-inline: 10px !important;
        column-gap: 8px !important;
    }

    body .ast-site-identity img.custom-logo,
    body .ast-site-identity .custom-logo-link img {
        max-height: 46px !important;
    }

    body .ast-mobile-popup-inner .main-header-menu .menu-item > .menu-link {
        border-radius: 10px !important;
        margin-inline: 8px !important;
        font-size: 14px !important;
    }

    body .ast-mobile-popup-inner .main-header-menu .menu-item > .menu-link:hover {
        background: #f8fafc !important;
    }

    body .site-main a.button:not(.add_to_cart_button):not(.added_to_cart):not(.single_add_to_cart_button):not(.product_type_simple):not(.product_type_variable):not(.product_type_grouped):not(.product_type_external):not(.ajax_add_to_cart):not(.k87-hidden-update-cart),
    body .site-main button.button:not(.add_to_cart_button):not(.single_add_to_cart_button):not(.ajax_add_to_cart):not(.k87-hidden-update-cart),
    body .site-main input.button:not(.add_to_cart_button):not(.single_add_to_cart_button):not(.ajax_add_to_cart):not(.k87-hidden-update-cart),
    body .site-main .wp-element-button:not(.add_to_cart_button):not(.single_add_to_cart_button):not(.ajax_add_to_cart):not(.k87-hidden-update-cart),
    body .site-main .wp-block-button__link:not(.add_to_cart_button):not(.single_add_to_cart_button):not(.ajax_add_to_cart):not(.k87-hidden-update-cart),
    body .site-main .checkout-button,
    body .site-main .wc-forward,
    body .site-main #place_order,
    body .site-main .woocommerce-Button.button,
    body .site-main .tc-main-btn,
    body .site-main .tc-submit-btn,
    body .site-main .tc-submit-action {
        min-height: 52px !important;
        font-size: 16px !important;
    }

    .k87-search-wrap {
        width: calc(100% - 1rem);
        margin-top: 14px;
    }

    .k87-main-footer .k87-footer-top,
    .k87-main-footer .k87-footer-bottom {
        justify-content: center !important;
        text-align: center !important;
    }

    body.woocommerce-cart .cart-main-wrapper,
    body.woocommerce-checkout .my-checkout-container,
    body.woocommerce-checkout form.checkout,
    body.woocommerce-account .woocommerce {
        width: calc(100% - 1rem) !important;
    }

    body:is(.k87-view-order-page, .woocommerce-account.woocommerce-view-order) #primary,
    body:is(.k87-view-order-page, .woocommerce-account.woocommerce-view-order) .content-area,
    body:is(.k87-view-order-page, .woocommerce-account.woocommerce-view-order) .site-main,
    body:is(.k87-view-order-page, .woocommerce-account.woocommerce-view-order) .entry-content,
    body:is(.k87-view-order-page, .woocommerce-account.woocommerce-view-order) .woocommerce,
    body:is(.k87-view-order-page, .woocommerce-account.woocommerce-view-order) .woocommerce-MyAccount-content {
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

}
