/* 3.1 Hide prices only on single product add-to-cart area; never on category/shop or WAPF price. */
.single-product .product .cart .price,
.single-product .product > .price,
.single-product .woocommerce-variation-price {
    display: none !important;
}

/* Never hide WAPF price: show container and span so "490 € + km" etc. is visible everywhere */
.single-product .product .price:has(.wapf-price-replace),
.single-product .product > .price:has(.wapf-price-replace) {
    display: block !important;
}
.wapf-price-replace,
div.price span.wapf-price-replace,
.price .wapf-price-replace {
    display: block !important;
    visibility: visible !important;
    color: inherit !important;
}

/* Hide cart/checkout only on price-query products (no price). */
body.th-price-query-product .cart-contents,
body.th-price-query-product .widget_shopping_cart,
body.th-price-query-product .woocommerce-cart-form,
body.th-price-query-product .wc-proceed-to-checkout,
body.th-price-query-product .woocommerce-mini-cart,
body.th-price-query-product .woocommerce-checkout,
body.th-price-query-product #add_payment_method {
    display: none !important;
}

/* Hide quantity only in cart/checkout when on those pages; keep visible on single product page */
.woocommerce-cart .quantity,
.woocommerce-checkout .quantity,
.widget_shopping_cart .quantity {
    display: none !important;
}

/* 3.2 Modal overlay */
.th-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 99999;
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

body.th-modal-open {
    overflow: hidden;
}

/* 3.3 Modal box */
.th-modal {
    background: #fff;
    border-radius: 0;
    padding: 30px;
    max-width: 600px;
    width: 100%;
    position: relative;
    margin: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.th-modal h2 {
    margin: 0 0 20px;
    font-size: 22px;
    color: #cc0000;
    padding-right: 30px;
}

.th-modal h3 {
    font-size: 15px;
    font-weight: 700;
    margin: 20px 0 10px;
    color: #333;
    border-bottom: 1px solid #eee;
    padding-bottom: 6px;
}

/* 3.4 Close button */
.th-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: #c31e3b;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 4px;
}

.th-close:hover {
    color: #a01830;
    background: none !important;
    background-color: transparent !important;
}

.th-close-text {
    font-size: 13px;
    font-weight: 600;
    color: #c31e3b;
    line-height: 1;
    vertical-align: middle;
}

/* 3.5 Summary table */
.th-summary-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    color: #333;
}

.th-summary-table th {
    text-align: left;
    width: 120px;
    font-weight: 700;
    padding: 5px 10px 5px 0;
    vertical-align: top;
    white-space: nowrap;
}

.th-summary-table td {
    padding: 5px 0;
    vertical-align: top;
    line-height: 1.5;
}

.th-accessory-row {
    margin-bottom: 4px;
}

/* 3.6 Form fields */
.th-field {
    margin-bottom: 16px;
}

.th-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 5px;
    color: #333;
}

.th-required {
    color: #cc0000;
}

.th-field input,
.th-field textarea,
#th-nimi,
#th-email,
#th-tel,
#th-lisainfo {
    width: 100%;
    box-sizing: border-box;
}

.th-field input,
.th-field textarea {
    padding: 10px 12px;
    border: 1px solid #333;
    border-radius: 0;
    font-size: 14px;
    color: #333;
    transition: border-color 0.2s;
}

.th-field input:focus,
.th-field textarea:focus {
    outline: none;
    border-color: #cc0000;
}

#th-lisainfo,
.th-field textarea {
    border-radius: 0;
    border-color: #333;
    color: #333;
}

.th-error {
    display: block;
    color: #cc0000;
    font-size: 12px;
    margin-top: 4px;
}

/* 3.7 Buttons */
.th-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.th-submit {
    background: #ce203b;
    color: #fff;
    border: none;
    padding: 12px 28px;
    border-radius: 4px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    flex: 1;
    transition: background 0.2s;
}

.th-submit:hover {
    background: #b01c34;
}

.th-submit:disabled {
    background: #999;
    cursor: not-allowed;
}

.th-cancel {
    background: #f5f5f5;
    color: #333;
    border: 1px solid #ddd;
    padding: 12px 20px;
    border-radius: 4px;
    font-size: 15px;
    cursor: pointer;
    transition: background 0.2s;
}

.th-cancel:hover {
    background: #eee;
}

/* 3.8 Feedback messages */
#th-feedback {
    padding: 30px 20px;
    text-align: center;
    font-size: 18px;
    line-height: 1.6;
}

#th-feedback.th-success-msg {
    display: block;
    color: #2a7a2a !important;
    font-size: 15px;
    font-weight: 500;
    padding: 12px 0 0;
    text-align: center;
}

#th-feedback.th-error-msg {
    color: #cc0000 !important;
    font-size: 15px !important;
}


/* Nimi + Ettevõte side by side */
.th-field-row {
    display: flex;
    gap: 12px;
    margin-bottom: 0;
}
.th-field-row .th-field {
    flex: 1;
    margin-bottom: 16px;
}

/* 3.9 Mobile responsive */
@media (max-width: 480px) {
    .th-field-row {
        flex-direction: column;
        gap: 0;
    }
    .th-field-row .th-field {
        margin-bottom: 16px;
    }
}

@media (max-width: 600px) {
    .th-overlay {
        padding: 0;
        align-items: flex-start;
    }

    .th-modal {
        border-radius: 0;
        min-height: 100vh;
        padding: 20px 16px;
    }

    .th-actions {
        flex-direction: column;
    }

    .th-summary-table th {
        width: 100px;
        font-size: 13px;
    }
}

/* Fix sticky bar z-index above BeTheme builder content */
.custom-add-to-cart {
    z-index: 999999 !important;
}

.custom-add-to-cart::after {
    z-index: 999998 !important;  /* just below the container's children */
}

.single_add_to_cart_button {
    z-index: 999999 !important;
    position: relative;
}

.woocommerce div.product form.cart div.quantity {
    z-index: 999999 !important;
    position: relative;
}

/* Hide reCAPTCHA v3 badge - legally required to disclose in privacy policy instead */
.grecaptcha-badge {
    visibility: hidden !important;
}
