/**
 * RHF Get Price Widget Styles
 *
 * Styled to match rhfturfgrowers.co.uk design
 */

/* Widget container */
.rhf-get-price-widget {
    margin: 20px 0;
    font-family: inherit;
}

/* Add-on product notice */
.rhf-addon-notice {
    background: #fef3cd;
    border: 1px solid #ffc107;
    border-left: 4px solid #ffc107;
    border-radius: 4px;
    padding: 12px 15px;
    margin-bottom: 20px;
    font-size: 14px;
    color: #856404;
    line-height: 1.5;
}

.rhf-addon-notice strong {
    display: block;
    margin-bottom: 4px;
    color: #664d03;
}

/* Form layout */
.rhf-get-price-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.rhf-get-price-inputs {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

/* Input groups */
.rhf-input-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.rhf-input-group label {
    font-size: 14px;
    color: #333;
    font-weight: 500;
}

/* Main "from" price display */
.rhf-from-price-main {
    font-size: inherit;
    font-weight: inherit;
}

/* Quantity input */
.rhf-quantity-group {
    flex: 1;
    min-width: 120px;
    max-width: 180px;
}

.rhf-quantity-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.rhf-quantity {
    width: 80px;
    padding: 12px 15px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 16px;
    text-align: center;
}

.rhf-quantity:focus {
    border-color: #2d6a4f;
    outline: none;
    box-shadow: 0 0 0 2px rgba(45, 106, 79, 0.2);
}

.rhf-unit-label {
    color: #666;
    font-size: 14px;
    white-space: nowrap;
}

/* Postcode input */
.rhf-postcode-group {
    flex: 1;
    min-width: 150px;
    max-width: 220px;
}

.rhf-postcode {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 16px;
    text-transform: uppercase;
}

.rhf-postcode:focus {
    border-color: #2d6a4f;
    outline: none;
    box-shadow: 0 0 0 2px rgba(45, 106, 79, 0.2);
}

.rhf-postcode::placeholder {
    text-transform: none;
    color: #999;
}

/* Button group - aligns with other inputs */
.rhf-button-group {
    flex: 0 0 auto;
}

.rhf-button-group label {
    visibility: hidden;
}

/* Get Price button */
.rhf-get-price-btn {
    background-color: #2d6a4f !important;
    color: #fff !important;
    border: none !important;
    padding: 12px 24px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    border-radius: 4px !important;
    cursor: pointer;
    transition: background-color 0.2s ease;
    white-space: nowrap;
    height: 46px;
}

.rhf-get-price-btn:hover {
    background-color: #1e4d38 !important;
}

.rhf-get-price-btn:disabled {
    background-color: #999 !important;
    cursor: not-allowed;
}

/* Price result section */
.rhf-price-result {
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

/* Price breakdown */
.rhf-price-breakdown {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.rhf-price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.rhf-price-row .rhf-label {
    color: #555;
    font-size: 15px;
}

.rhf-price-row .rhf-value {
    font-weight: 600;
    font-size: 16px;
    color: #333;
}

.rhf-pallet-size {
    font-weight: 400;
    color: #777;
    font-size: 13px;
}

/* VAT info (informational, below total) */
.rhf-vat-info {
    text-align: right;
    font-size: 13px;
    color: #666;
    margin-top: 5px;
}

/* Total line */
.rhf-total-line {
    border-top: 2px solid #2d6a4f;
    padding-top: 15px !important;
    margin-top: 10px;
}

.rhf-total-line .rhf-label {
    font-size: 18px !important;
    font-weight: 600;
    color: #333;
}

.rhf-total-line .rhf-label small {
    font-weight: 400;
    color: #666;
    font-size: 13px;
}

.rhf-total-line .rhf-value {
    font-size: 24px !important;
    color: #2d6a4f;
}

/* Simple price display (non-breakdown) */
.rhf-price-simple {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.rhf-price-simple .rhf-label {
    font-size: 18px;
    font-weight: 600;
}

.rhf-price-simple .rhf-value {
    font-size: 28px;
    font-weight: 700;
    color: #2d6a4f;
}

/* Total row (simplified display) */
.rhf-price-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
}

.rhf-price-total-row .rhf-label {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.rhf-price-total-row .rhf-value {
    font-size: 24px;
    font-weight: 700;
    color: #2d6a4f;
}

/* Price result - stacked layout with right-aligned price */
.rhf-price-result .rhf-price-total-row {
    margin-bottom: 15px;
}

.rhf-price-result .rhf-price-total-row .rhf-value {
    text-align: right;
}

/* Add to Cart button */
.rhf-add-to-cart-btn {
    width: 100%;
    background-color: #2d6a4f !important;
    color: #fff !important;
    border: none !important;
    padding: 16px 30px !important;
    font-size: 18px !important;
    font-weight: 600 !important;
    border-radius: 4px !important;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.rhf-add-to-cart-btn:hover {
    background-color: #1e4d38 !important;
}

.rhf-add-to-cart-btn:disabled {
    background-color: #999 !important;
    cursor: not-allowed;
}

/* Error state */
.rhf-price-error {
    margin-top: 15px;
    padding: 15px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    border-left: 4px solid #ef4444;
}

.rhf-error-message {
    color: #b91c1c;
    font-size: 14px;
}

/* Success state */
.rhf-cart-success {
    margin-top: 15px;
    padding: 15px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 6px;
    border-left: 4px solid #22c55e;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.rhf-success-message {
    color: #166534;
    font-size: 14px;
    font-weight: 500;
}

.rhf-view-cart-link {
    color: #2d6a4f;
    font-weight: 600;
    text-decoration: underline;
}

.rhf-view-cart-link:hover {
    color: #1e4d38;
}

/* Responsive */
@media (max-width: 600px) {
    .rhf-get-price-inputs {
        flex-direction: column;
    }

    .rhf-quantity-group,
    .rhf-postcode-group,
    .rhf-button-group {
        max-width: 100%;
    }

    .rhf-button-group label {
        display: none;
    }

    .rhf-get-price-btn {
        width: 100%;
    }

    .rhf-total-line .rhf-value {
        font-size: 20px !important;
    }
}

/* Hide default WooCommerce add to cart when widget is present */
.rhf-get-price-widget ~ .cart,
.rhf-get-price-widget ~ form.cart,
.rhf-get-price-widget ~ .wp-block-woocommerce-add-to-cart-form,
.rhf-get-price-widget ~ .wc-block-add-to-cart-form {
    display: none !important;
}

/* Hide old postcode checker widget when Get Price widget is on page */
.single-product .rhf-postcode-checker {
    display: none !important;
}

/* Hide any WooCommerce add-to-cart that appears after our widget in block themes */
.wp-block-woocommerce-product-details .rhf-get-price-widget ~ *:has(form.cart),
.wp-block-woocommerce-product-details .rhf-get-price-widget ~ *:has(.cart) {
    display: none !important;
}
