/*
Theme Name:     Merida [Kadence child theme]
Theme URI:      https://merida.com.pl
Description:    Kadence child theme made for Merida sp. z o.o.
Author:         Mateusz Zadorożny
Author URI:     https://zadorozny.rocks
Template:       kadence
Version:        0.5.2
*/

/* Category Custom Content Styles */
.merida-category-custom-content {
    margin: 24px 0;
    position: relative;
    overflow: visible;
    padding: 40px 0;
}

/* Pełnoekranowa linia u góry */
.merida-category-custom-content::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    width: 100vw;
    height: 1px;
    background: #DADADA;
    transform: translateX(-50%);
    pointer-events: none;
    z-index: 1;
}

.merida-category-custom-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 30px;
}

.merida-category-custom-description {
    flex: 2;
    min-width: 300px;
}

.merida-category-custom-description h3 {
    margin-bottom: 20px;
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
}

.merida-category-custom-description p {
    margin-bottom: 15px;
    line-height: 1.6;
    color: #333;
}

.merida-category-custom-description p:last-child {
    margin-bottom: 0;
}

.merida-category-custom-thumbnail {
    flex: 1;
    max-width: 33.33%;
}

.merida-category-custom-thumbnail img {
    width: 100%;
    height: auto;
    display: block;
}

/* Responsive adjustments */
@media (max-width: 768px) {

    .merida-category-custom-content {
        margin: 32px 0;
        padding: 24px 8px;
    }

    .merida-category-custom-wrapper {
        flex-direction: column;
        gap: 20px;
    }

    .merida-category-custom-description {
        min-width: unset;
    }

    .merida-category-custom-thumbnail {
        align-self: stretch;
        max-width: 100%;
    }

    .merida-category-custom-thumbnail img {
        width: 100%;
        max-width: 100%;
        height: auto;
    }
}

/* Merida Product Info Block Styles */
.merida-product-info-block {
    /*margin: 20px 0;*/
}

.merida-product-info-block>div {
    border-bottom: 1px solid #DADADA;
    padding: 10px 0px;
}

.merida-product-info-block .merida-availability-section:last-child,
.merida-product-info-block .merida-sku-section:last-child {
    margin-bottom: 0;
}



/* Product relations styling */
.merida-product-relations {
    margin-top: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.merida-relation-link {
    display: inline-block;
}

.merida-relation-button {
    display: inline-block;
    padding: 8px 16px;
    border: 1px solid #ddd;
    border-radius: 20px;
    background: #fff;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    font-weight: 400;
    transition: all 0.2s ease;
}

.merida-relation-button:hover {
    background: #f5f5f5;
    border-color: #ccc;
    text-decoration: none;
    color: #333;
}

/* Product Relations Display Block */
.merida-product-relation-section {
    margin: 40px 0;
    padding-top: 20px;
}

.merida-product-relation-section:first-child {
    margin-top: 20px;
}

.merida-relation-heading {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 20px 0;
    color: #333;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 10px;
}

/* Ensure proper spacing for WooCommerce product loops */
.merida-product-relation-section .products {
    margin: 0;
    display: grid;
    gap: 20px;
}

.merida-product-relation-section .products.columns-2 {
    grid-template-columns: repeat(2, 1fr);
}

.merida-product-relation-section .products.columns-3 {
    grid-template-columns: repeat(3, 1fr);
}

.merida-product-relation-section .products.columns-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* Responsive adjustments */
@media (max-width: 768px) {

    .merida-product-relation-section .products.columns-3,
    .merida-product-relation-section .products.columns-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .merida-product-relation-section .products {
        grid-template-columns: 1fr;
    }
}

/* Kadence shop top row (desktop) */
@media screen and (min-width: 768px) {
    .kadence-shop-top-row p.woocommerce-result-count {
        text-align: right;
    }

    .kadence-shop-top-row {
        gap: 24px;
    }
}

/* Horizontal Carousel Styles */
.merida-products-carousel {
    position: relative;
    margin: 20px 0;
}

/* Scrollable ul.products container */
.merida-products-carousel .merida-carousel-track.products {
    display: flex;
    overflow-x: auto;
    scroll-behavior: smooth;
    gap: 20px;
    padding: 10px 0;
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE/Edge */
    /* Override Kadence grid styles for horizontal layout */
    grid-template-columns: none !important;
}

.merida-products-carousel .merida-carousel-track.products::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

/* Individual product items in carousel */
.merida-products-carousel .merida-carousel-track.products>li {
    flex: 0 0 auto;
    width: 309px;
    max-width: 309px;
    list-style: none;
    /* Remove any list dots */
}

/* Overlay arrow positioning */
.merida-carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.7);
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: opacity 0.2s ease;
    padding: 0;
}

.merida-carousel-icon {
    filter: brightness(0) invert(1);
    width: 14px;
    height: 14px;
    display: block;
}

/* Arrow positioning */
.merida-carousel-prev {
    left: 10px;
}

.merida-carousel-next {
    right: 10px;
}

/* Hide arrows when not needed */
.merida-carousel-arrow[style*="display: none"] {
    display: none !important;
}

.merida-products-carousel::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 4rem;
    pointer-events: none;
    background: linear-gradient(to left, #fff 0%, rgba(255, 255, 255, 0) 100%);
    z-index: 5;
}

/* Responsive adjustments for carousel */
@media (max-width: 768px) {
    .merida-products-carousel .merida-carousel-track.products>li {
        width: 240px;
        max-width: 240px;
    }

    .merida-carousel-arrow {
        width: 36px;
        height: 36px;
    }

    .merida-carousel-arrow svg {
        width: 14px;
        height: 14px;
    }
}

@media (max-width: 480px) {
    .merida-products-carousel .merida-carousel-track.products>li {
        width: 200px;
        max-width: 200px;
    }

    .merida-products-carousel .merida-carousel-track.products {
        gap: 15px;
    }
}

/* Single product price box */
#infobox p.price-net-gross {
    text-align: right;
    font-size: 20px;
    line-height: 24px;
    margin: 0;
}

.box-single .price-net {
    font-weight: 700;
    font-size: 32px;
    line-height: 24px;
    margin-bottom: 0px;
}

#infobox p.price {
    margin-top: 24px;
    margin-bottom: 6px;
    text-align: right;
}

/* Jednolita szerokość formularza i notice'ów */
.woo-checkout-wrap {
    max-width: 1242px;
    /* ustaw docelową szerokość */
    margin: 0 auto;
    padding: 0 16px;
}

/* Nie pozwól notice'om rozpychać się szerzej niż wrapper */
.woo-checkout-wrap .woocommerce-message,
.woo-checkout-wrap .woocommerce-error,
.woo-checkout-wrap .woocommerce-info,
.woo-checkout-wrap .woocommerce-notices-wrapper {
    box-sizing: border-box;
    width: 100%;
}

.woocommerce-privacy-policy-text {
    display: none;
}

/* Customer type radio buttons styling */
.customer-type-radio ul.woocommerce-input-wrapper {
    list-style: none;
    padding: 0;
    margin: 10px 0;
}

.customer-type-radio ul.woocommerce-input-wrapper li {
    margin-bottom: 8px;
}

.customer-type-radio input[type="radio"] {
    margin-right: 8px;
}

.customer-type-radio label {
    display: inline-block;
    margin-left: 0;
    font-weight: 400;
}

/* NIP tools styling */
#merida-nip-tools {
    margin-top: 6px;
}

#merida-nip-msg.success {
    color: #28a745;
    font-weight: 500;
}

#merida-nip-msg.error {
    color: #dc3545;
    font-weight: 500;
}

/* Recipient fields styling */
.recipient-field {
    margin-top: 10px;
}

.recipient-toggle {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

/* Ensure hidden fields via JS are truly hidden */
.form-row.type-10-hide,
.form-row.type-20-30-hide {
    display: none !important;
}

/* Initial state: hide recipient fields until JS shows them */
.form-row:has(.recipient-field) {
    display: none;
}

/* Fallback for browsers without :has() support */
.form-row.recipient-field,
#billing_recipient_name_field,
#billing_recipient_address_field,
#billing_recipient_zip_code_field,
#billing_recipient_city_field,
#billing_recipient_country_field,
#billing_recipient_invoice_email_field {
    display: none;
}

/* When fields have js-show class, display them */
.form-row.recipient-field.js-show,
#billing_recipient_name_field.js-show,
#billing_recipient_address_field.js-show,
#billing_recipient_zip_code_field.js-show,
#billing_recipient_city_field.js-show,
#billing_recipient_country_field.js-show,
#billing_recipient_invoice_email_field.js-show {
    display: block !important;
}

/* Hide recipient toggle by default - JS will show for type 30 */
#billing_use_recipient_field {
    display: none !important;
}

/* When JS adds show class, display the recipient toggle */
#billing_use_recipient_field.js-show {
    display: block !important;
}
