/* CDW Plugin Location Cart - Buy Now Popup Styles */
body.cdw-popup-open {
    overflow-x: hidden;
}

.cdw-plc-buy-now-popup .button,
.cdw-plc-buy-now-popup button,
.cdw-plc-buy-now-popup fieldset,
.cdw-plc-buy-now-popup input,
.cdw-plc-buy-now-popup select,
.cdw-plc-buy-now-popup textarea {
    margin-bottom: 0 !important;
}

/* Main popup container */
.cdw-plc-buy-now-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: none;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
}

.cdw-plc-buy-now-popup.is-visible {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Overlay */
.cdw-plc-popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* Popup container */
.cdw-plc-popup-container {
    position: relative;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-width: 1000px;
    width: 95%;
    max-height: 90vh;
    overflow: hidden;
    animation: cdw-popup-enter 0.3s ease-out;
}

@keyframes cdw-popup-enter {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.shipping-method-cost {
    font-style: italic !important;
}


.cdw-plc-popup-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
}

.cdw-plc-product-summary .cdw-plc-section-title {
    margin-bottom: 0;
}

.cdw-plc-price-current bdi {
    color: #BF1A1A !important;
}

.cdw-plc-price-sale bdi {
    color: #BF1A1A !important;
}

.cdw-plc-price-regular bdi {
    font-weight: 400 !important;
}

.cdw-plc-popup-close {
    border: none;
    color: rgb(180, 180, 180);
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: absolute;
    right: 15px;
    top: 15px;
    background-color: transparent;
}

.cdw-plc-popup-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

/* Content */
.cdw-plc-popup-content {
    max-height: calc(90vh - 80px);
    overflow-y: auto;
    padding: 0;
    display: flex;
}

/* Product Summary */
.cdw-plc-product-summary {
    padding: 24px;
    background: #f9fafb;
    flex: 0 0 40%;
}

.cdw-plc-checkout-form {
    flex: 0 0 60%;

}

.cdw-plc-product-image {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border-radius: 12px;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cdw-plc-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cdw-plc-product-placeholder {
    color: #9ca3af;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.cdw-plc-product-details {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-gap: 20px;
}

.cdw-plc-product-image-wrapper {
    width: 120px;
}

.cdw-plc-quantity-selector {
    display: flex;
    align-items: center;
    width: fit-content;
    padding: 0;
    border-radius: 100px;
    border: 1px solid #e5e7eb;
    min-height: 30px;
    margin-top: auto;
    background-color: #fff;
}

button:focus,
button:focus-visible,
button,
input:focus,
input:focus-visible,
input,
select,
select:focus,
select:focus-visible {
    box-shadow: none !important;
    outline: none !important;
    border-color: inherit;
}

input,
select {
    border-radius: 4px !important;
    border-color: black !important;
}

.cdw-plc-quantity-selector button {
    height: 100%;
    border-radius: 100px;
    border: 0;
    width: 35px !important;
    padding: 0;
}

.cdw-plc-product-info label {
    font-weight: 700;
    font-size: 16px;
}

.cdw-plc-quantity-selector input {
    max-width: 40px !important;
    text-align: center !important;
    padding: 0 !important;
    border: none !important;
    height: 35px !important;
    display: block !important;
    background: transparent !important;
}

.cdw-plc-product-variable {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.cdw-plc-vat,
.cdw-plc-product-variable,
.cdw-plc-total {
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    background-color: white;
}

.shipping-method-item span.shipping-method-cost {
    margin-left: auto !important;
}

.cdw-plc-popup-content {
    display: grid;
    grid-template-columns: 0.7fr 1fr;
    grid-gap: 0;
}

.cdw-plc-product-info {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.cdw-plc-product-variable select {
    padding: 5px 0 5px 10px;
    border-radius: 8px !important;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5' stroke='black' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-size: 16px;
    background-repeat: no-repeat;
    background-position: right 5px center !important;
    width: 100%;
}

.cdw-plc-vat-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.cdw-plc-vat-checkbox input[type="checkbox"] {
    margin: 0;
    width: 20px;
    height: 20px;
    border-radius: 100%;
    accent-color: black;
}

.cdw-plc-product-summary {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.cdw-plc-variable-item {
    display: flex;
    flex-direction: column;
}

.cdw-plc-product-price-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
}

.cdw-plc-product-price-wrapper span bdi {
    font-weight: 700;
    font-size: 24px;
}

input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type=number] {
    -moz-appearance: textfield;
}

.cdw-plc-quantity-selector input:focus {
    outline: none;
    box-shadow: none;
}

.cdw-plc-product-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    aspect-ratio: 1/1;
}

.cdw-plc-product-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: black;
    line-height: 1.4;
    text-align: left;
}

.cdw-plc-product-price {
    margin-bottom: 16px;
    font-size: 18px;
    font-weight: 700;
    color: #059669;
}

.cdw-plc-applied-coupons:empty,
.cdw-plc-coupon-message:empty {
    margin-top: 0 !important;
}

.cdw-plc-coupon {
    padding: 12px !important;
    border-radius: 8px !important;
    background-color: white !important;
    border: 1px solid #e5e7eb !important;
}

.cdw-plc-coupon-section {
    margin-top: 12px;
}

.cdw-plc-coupon-section .woocommerce-form-coupon {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
}

.cdw-plc-coupon-section .form-row {
    display: flex;
    gap: 8px;
    margin: 0;
}

.cdw-plc-coupon-section input[type="text"] {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
}

.cdw-plc-coupon-section button {
    padding: 8px 16px;
    background: #4f46e5;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.cdw-plc-coupon-section button:hover {
    background: #4338ca;
}

.cdw-plc-price-regular span bdi {
    font-size: 18px !important;
    text-decoration: line-through !important;
    font-weight: 400 !important;
}

/* Form sections */
.cdw-plc-customer-details {
    padding: 24px;
    border-right: 1px solid #e5e7eb;
}

/* Section titles */
.cdw-plc-product-meta {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cdw-plc-section-title {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 20px;
    text-align: left;
    color: black !important;
}

.cdw-plc-section-icon {
    width: 20px;
    height: 20px;
    color: #6b7280;
}

/* Billing section */
.cdw-plc-billing-section {
    margin-bottom: 0;
}

.cdw-plc-billing-section .woocommerce-billing-fields>h3 {
    display: none;
}

/* Additional fields section */
.cdw-plc-additional-section {
    margin-bottom: 24px;
}

.cdw-plc-additional-fields textarea {
    width: 100%;
    min-height: 80px;
    padding: 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    transition: border-color 0.2s ease;
}

.cdw-plc-additional-fields textarea:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Order review */
.cdw-plc-order-review {
    margin-bottom: 24px;
}

.cdw-plc-order-review table.shop_table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.cdw-plc-order-review table.shop_table thead {
    display: none;
}

.cdw-plc-order-review table.shop_table tbody tr {
    border-bottom: 1px solid #f3f4f6;
}

.cdw-plc-order-review table.shop_table tbody tr:last-child {
    border-bottom: none;
}

.cdw-plc-order-review table.shop_table td {
    padding: 16px;
    font-size: 14px;
    color: #374151;
    vertical-align: middle;
}

.cdw-plc-order-review table.shop_table .product-name {
    font-weight: 500;
}

.cdw-plc-order-review table.shop_table .product-total {
    text-align: right;
    font-weight: 600;
    color: #059669;
}

.cdw-plc-order-review tfoot tr.cart-subtotal {
    display: none;
}

.cdw-plc-order-review tfoot tr.order-total td,
.cdw-plc-order-review tfoot tr.order-total th {
    border: none;
    padding: 20px 16px;
    font-size: 14px;
    font-weight: 700;
    background: #f3f4f6;
}

/* Payment section */
.cdw-plc-payment-section {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.cdw-plc-payment-section .wc_payment_methods {
    list-style: none;
    margin: 0;
    padding: 0;
}

.cdw-plc-payment-section .wc_payment_methods li {
    margin: 0 0 12px 0;
    padding: 16px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.cdw-plc-payment-section .wc_payment_methods li:hover {
    border-color: #4f46e5;
    background: #f8faff;
}

.cdw-plc-payment-section .wc_payment_methods li.wc_payment_method input {
    margin: 0 8px 0 0;
}

.cdw-plc-payment-section .wc_payment_methods li+li {
    border-top: none;
    margin-top: 0;
}

.cdw-plc-payment-section .payment_box {
    background: #f8faff;
    border: 1px solid #e0e7ff;
    border-radius: 6px;
    padding: 16px;
    margin-top: 12px;
}

.cdw-plc-payment-section .payment_box p {
    margin: 0;
    font-size: 14px;
    color: #4b5563;
}

/* Place order button */
.cdw-plc-payment-section button#place_order {
    width: 100%;
    padding: 16px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cdw-plc-payment-section button#place_order:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
}

.cdw-plc-payment-section button#place_order:active {
    transform: translateY(0);
}

/* Form styling */
.cdw-plc-buy-now-popup .woocommerce-billing-fields__field-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 0;
}

.cdw-plc-buy-now-popup .woocommerce-billing-fields__field-wrapper p {
    margin: 0 0 20px 0;
    width: 100%;
}

.cdw-plc-buy-now-popup .woocommerce-billing-fields__field-wrapper p.validate-email,
.cdw-plc-buy-now-popup .customer-vietnam #billing_last_name_field,
.cdw-plc-buy-now-popup .customer-vietnam #billing_address_2_field,
.cdw-plc-buy-now-popup .customer-vietnam #billing_phone_field,
.cdw-plc-buy-now-popup .customer-vietnam #billing_address_1_field {
    grid-column: 1 / -1;
}

.cdw-plc-buy-now-popup .customer-vietnam #billing_phone_field {
    grid-column: 1/2;
}

.cdw-plc-buy-now-popup .customer-vietnam #billing_email_field {
    grid-column: 2/3;
}

.cdw-plc-buy-now-popup .form-row label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: black;
    font-size: 14px;
}

.cdw-plc-buy-now-popup .form-row label .required {
    color: #ef4444;
}

.cdw-plc-buy-now-popup .form-row input[type="text"],
.cdw-plc-buy-now-popup .form-row input[type="email"],
.cdw-plc-buy-now-popup .form-row input[type="tel"],
.cdw-plc-buy-now-popup .form-row select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid black !important;
    border-radius: 8px !important;
    font-size: 14px;
    transition: all 0.2s ease;
    background: white;
}

.cdw-plc-buy-now-popup .form-row input:focus,
.cdw-plc-buy-now-popup .form-row select:focus {
    outline: none;
    border-color: black;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Select2 styling */
.cdw-plc-buy-now-popup .select2-container {
    width: 100% !important;
    margin: 0 !important;
}

.cdw-plc-total>.cdw-plc-total-row.cdw-plc-product-total>span {
    font-weight: bold;
}

.cdw-plc-vat-checkbox {
    margin-bottom: 0 !important;
}

.cdw-plc-total span {
    font-weight: 400;
    font-size: 16px;
    color: black !important;
}

.cdw-plc-total {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cdw-plc-total .cdw-plc-total-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cdw-plc-total-row.cdw-plc-product-total .cdw-plc-total-amount {
    color: #BF1A1A !important;
}

.cdw-plc-total-row.cdw-plc-product-total {
    padding-top: 10px;
    border-top: 1px solid #e5e7eb;
}

.cdw-plc-buy-now-popup .select2-container .select2-selection--single {
    height: 45px !important;
    border: 1px solid black !important;
    border-radius: 8px !important;
    padding: 0;
    background: white;
}

.cdw-plc-buy-now-popup .select2-container .select2-selection--single .select2-selection__rendered {
    padding: 12px 16px;
    line-height: normal !important;
    color: black;
    font-size: 14px;
}

.cdw-plc-buy-now-popup .select2-container .select2-selection--single .select2-selection__arrow {
    height: 46px;
    right: 12px;
}

.cdw-plc-buy-now-popup .select2-container--default .select2-selection--single:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Additional Select2 styling for legacy compatibility */
.cdw-plc-buy-now-popup .body-bottom span.select2.select2-container {
    width: 100% !important;
}

.cdw-plc-buy-now-popup .body-bottom .woocommerce-billing-fields__field-wrapper input,
.cdw-plc-buy-now-popup .body-bottom .form-row .select2-container span.select2-selection.select2-selection--single {
    margin: 0;
    border-radius: 5px;
}

.cdw-plc-buy-now-popup .body-bottom .form-row .select2-container {
    margin: 0;
}

/* Loading states */
.cdw-loading {
    position: relative;
    opacity: 0.6;
    pointer-events: none;
}

.cdw-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #e5e7eb;
    border-top-color: #4f46e5;
    border-radius: 50%;
    animation: cdw-spin 1s linear infinite;
}

@keyframes cdw-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Quick buy button */
.cdw-plc-quick-buy-button {
    display: inline-block;
    width: auto;
    padding: 16px 24px;
    background: black;
    color: white;
    text-decoration: none;
    border-radius: 0;
    font-size: 16px;
    font-weight: 500;
    text-align: center;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    grid-column: 3/4 !important;
}

.cdw-plc-quick-buy-button:hover {
    color: white;
    opacity: 0.8;
}

.single_add_to_cart_button {
    justify-self: unset !important;
}

.cdw-plc-quick-buy-button span {
    display: block;
    font-size: 11px;
    opacity: 0.9;
    margin-top: 4px;
    font-weight: 400;
}

.cdw-plc-buy-now-button {
    padding: 20px;
    background: black;
    font-size: 16px;
    font-weight: 500;
    text-align: center;
    color: white;
    border-radius: 0;
    border: 0;
    cursor: pointer;
}

.cdw-plc-buy-now-button:hover {
    opacity: 0.8;
}

/* Message wrapper */
.cdw-plc-buy-now-popup .message-wrapper {
    display: none;
}



.cdw-plc-billing-section .form-row {
    padding: 0 !important;
    margin-bottom: 0 !important;
}

/* VAT section integration */
.cdw-plc-buy-now-popup .cdw-context-tax {
    background: none;
    border: 0;
    border-radius: 0;
    padding: 0;
    margin: 0;
    display: none;
}

/* Show VAT form when active class is added */
.cdw-plc-buy-now-popup .cdw-context-tax.active {
    display: block;
}

/* Hide the default VAT checkbox in popup since we use .cdw-plc-vat-input */
.cdw-plc-buy-now-popup .cdw-context-tax h3#choose-tax {
    display: none;
}

.cdw-plc-buy-now-popup .cdw-context-tax-info {
    display: block;
    /* Always show the VAT fields when the form is visible */
}

.cdw-plc-buy-now-popup .cdw-context-tax.active .cdw-context-tax-info {
    display: block;
    margin-top: 24px;
}

.cdw-plc-buy-now-popup .cdw-context-tax-info fieldset {
    border: 1px solid black;
    border-radius: 8px;
    padding: 16px;
    margin: 0;
    background: white;
}

.cdw-plc-payment-sections {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    padding: 0 24px 24px 24px;
}

.cdw-plc-shipping-methods ul,
.cdw-plc-payment ul {
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.shipping-method-item,
.wc_payment_method {
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.shipping-method-item:has(input:checked) {
    border-color: black;
}


.shipping-method-item label,
.wc_payment_method {
    display: flex;
    align-items: center;
    gap: 10px;
}

.wc_payment_method:has(input:checked) {
    border-color: black;
}

.shipping-method-item label,
.wc_payment_method>* {
    cursor: pointer !important;

}

.shipping-method-item label:last-child,
.wc_payment_method:last-child {
    margin-bottom: 0 !important;
}

.shipping-method-item label span,
.wc_payment_method label,
.wc_payment_method span {
    font-size: 16px;
    font-weight: 500;
    margin: 0 !important;
}

.cdw-plc-coupon-input-wrapper {
    display: grid !important;
    grid-template-columns: auto max-content !important;
    gap: 10px !important;
}

.cdw-plc-coupon-input {
    width: 100% !important;
    border: 1px solid black;
    height: 45px !important;
    padding: .9rem 1.1rem;
    border-radius: 8px !important;
    font-family: inherit !important;
}

.cdw-plc-coupon-title {
    font-weight: 700 !important;
    font-size: 16px !important;
    color: black !important;
    margin-bottom: 10px !important;
    display: block !important;
    text-align: left !important;
}

.cdw-plc-coupon-message {
    margin-top: 10px !important;
    background-color: transparent !important;
}

.cdw-plc-coupon-message.success {
    color: #7a9c59;
}

.cdw-plc-applied-coupons {
    margin-top: 10px !important;
}

.cdw-plc-applied-coupons .cdw-plc-applied-coupon-item {
    display: flex !important;
    align-items: center;
    gap: 20px;
}

.cdw-plc-qty-btn {
    margin: 0 !important;
}

.cdw-plc-remove-coupon-btn {
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    font-size: 20px !important;
    line-height: 1 !important;
}

.cdw-plc-applied-coupons .cdw-plc-applied-coupon-item span {
    font-weight: 500 !important;
}

.cdw-plc-apply-coupon-btn {
    padding: 10px 20px !important;
    background: black !important;
    color: white !important;
    font-weight: 500 !important;
    text-transform: uppercase !important;
    font-size: 14px !important;
    cursor: pointer !important;
    line-height: normal !important;
    border: 0 !important;
    border-radius: 8px !important;
    font-family: inherit !important;
    margin: 0 !important;
}

.cdw-plc-coupon-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 !important;
}

.cdw-plc-coupon-item input[type="radio"] {
    margin: 0 !important;
    width: 18px;
    height: 18px;
    accent-color: black;
}

.cdw-plc-coupon-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto;
    gap: 10px;
    margin-top: 10px;
}

.cdw-plc-coupon-item label {
    font-size: 16px;
    font-weight: 500;
    margin: 0 !important;
}

.cdw-plc-submit-order {
    opacity: 1;
    grid-column: 1 / -1;
    padding: 20px;
    background: black;
    color: white;
    font-weight: 500;
    text-transform: uppercase;
    font-size: 18px;
    cursor: pointer;
    line-height: normal;
    border: 0;
    border-radius: 8px !important;
}

.woocommerce-variation-add-to-cart.variations_button,
.wp-block-add-to-cart-form form {
    gap: 10px;
}

.woocommerce-variation-add-to-cart.variations_button .quantity,
.wp-block-add-to-cart-form form .quantity {
    margin: 0 !important;
}

.woocommerce-variation-add-to-cart.variations_button .quantity input,
.wp-block-add-to-cart-form form .quantity input {
    margin: 0 !important;
}

.cdw-plc-submit-order:hover {
    opacity: 0.8;
}

.shipping-method-item label input[type="radio"],
.wc_payment_method input[type="radio"] {
    margin: 2px 0 0 0;
    width: 18px;
    height: 18px;
    accent-color: black;
}

.payment_box {
    display: none !important;
}

.cdw-plc-buy-now-popup .cdw-context-tax-info fieldset legend {
    background: white;
    padding: 0 8px;
    font-size: 14px;
    font-weight: 500;
    color: black;
}

.cdw-plc-buy-now-popup .choose-tax_label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    margin: 0;
    font-weight: 500;
    font-size: 14px;
}

.cdw-plc-buy-now-popup .choose-tax_label input[type="checkbox"] {
    margin: 0;
    width: 18px;
    height: 18px;
}

/* Scrollbar styling */
.cdw-plc-popup-content::-webkit-scrollbar {
    width: 6px;
}

.cdw-plc-popup-content::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.cdw-plc-popup-content::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.cdw-plc-popup-content::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Error states */
.woocommerce-error,
.woocommerce-message,
.woocommerce-info {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 12px 16px;
    border-radius: 6px;
    margin: 16px 0;
    font-size: 14px;
}

.woocommerce-message {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #166534;
}

.woocommerce-info {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1e40af;
}

/* Animation for smooth interactions */
.cdw-plc-buy-now-popup * {
    box-sizing: border-box;
}

.cdw-plc-buy-now-popup input,
.cdw-plc-buy-now-popup select,
.cdw-plc-buy-now-popup textarea,
.cdw-plc-buy-now-popup button {
    transition: all 0.2s ease;
}

.woocommerce-billing-fields__field-wrapper input,
.woocommerce-billing-fields__field-wrapper select {
    height: 45px !important;
}

/* Focus management */
.cdw-plc-buy-now-popup input:focus,
.cdw-plc-buy-now-popup select:focus,
.cdw-plc-buy-now-popup textarea:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.cdw-plc-buy-now-popup .screen-reader-text {
    position: unset !important;
    clip-path: unset !important;
    height: auto !important;
    width: auto !important;
    overflow: visible !important;
    opacity: 1 !important;
}

.cdw-plc-buy-now-popup .select2-selection {
    box-shadow: none !important;
}

/* Accessibility improvements */
.cdw-plc-popup-close {
    padding: 0 !important;
}

.cdw-plc-popup-close:focus {
    outline: 2px solid #4f46e5;
    outline-offset: 2px;
}

.cdw-plc-buy-now-popup button:focus {
    outline: 2px solid #4f46e5;
    outline-offset: 2px;
}

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

    .cdw-plc-product-image-wrapper {
        width: 100%;
    }

    .cdw-plc-product-details {
        grid-template-columns: 1fr;
    }

    .cdw-plc-popup-container {
        width: 98%;
        max-height: 95vh;
        border-radius: 12px;
    }

    .cdw-plc-payment-sections {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .cdw-plc-form-sections {
        grid-template-columns: 1fr;
    }

    .cdw-plc-customer-details {
        border-right: none;
    }

    .cdw-plc-product-summary {
        flex-direction: column;
        text-align: left;
        gap: 16px;
    }

    .cdw-plc-product-image {
        width: 100px;
        height: 100px;
    }

    .cdw-plc-popup-header {
        padding: 16px 20px;
    }

    .cdw-plc-popup-title {
        font-size: 14px;
    }

    .cdw-plc-buy-now-popup .woocommerce-billing-fields__field-wrapper {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .cdw-plc-buy-now-popup .woocommerce-billing-fields__field-wrapper p {
        grid-column: 1/3 !important;
    }

    .cdw-plc-quick-buy-button {
        grid-row: 2 / 3;
        grid-column: 1 / 4 !important;
    }

    .single_add_to_cart_button {
        grid-column: 2/4 !important;
    }

}

@media (max-width: 480px) {
    .cdw-plc-popup-container {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .cdw-plc-popup-content {
        max-height: 100vh;
    }

    .cdw-plc-popup-content {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   VALIDATION ERROR STYLES
   ======================================== */

/* Error message displayed below fields */
.cdw-error-message {
    display: block;
    color: #dc2626;
    font-size: 12px;
    line-height: 1.4;
    margin-top: 4px;
    padding: 0;
    font-weight: 400;
}

/* Error message in containers (shipping/payment) */
.cdw-error-message.cdw-container-error {
    margin-top: 8px;
    padding: 8px 12px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 4px;
}

/* Field with error - input/select styling */
.cdw-plc-buy-now-popup .woocommerce-billing-fields__field-wrapper .form-row .cdw-field-error,
.cdw-plc-buy-now-popup .woocommerce-billing-fields__field-wrapper .form-row .cdw-field-error:focus,
.cdw-plc-buy-now-popup .woocommerce-billing-fields__field-wrapper .form-row input.cdw-field-error,
.cdw-plc-buy-now-popup .woocommerce-billing-fields__field-wrapper .form-row select.cdw-field-error,
.cdw-plc-buy-now-popup .woocommerce-billing-fields__field-wrapper .form-row textarea.cdw-field-error {
    border-color: #dc2626 !important;
    background-color: #fef2f2 !important;
    /*box-shadow: 0 0 0 1px #dc2626 !important;*/
}

.cdw-context-tax-info fieldset .form-row:not(:last-child) {
    margin-bottom: 10px !important;
}

/* Select2 field with error */
.cdw-plc-buy-now-popup .woocommerce-billing-fields__field-wrapper .form-row .cdw-field-error+.select2-container .select2-selection {
    border-color: #dc2626 !important;
    background-color: #fef2f2 !important;
}

/* Shake animation for error fields */
@keyframes cdw-shake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-4px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(4px);
    }
}

.cdw-field-error {
    animation: cdw-shake 0.5s ease-in-out;
}

/* Form row with error - add some spacing */
.form-row:has(.cdw-error-message) {
    margin-bottom: 8px;
}

/* Fix for select2 error message positioning */
.select2-container+.cdw-error-message {
    margin-top: 4px;
}

/* VAT fields error styling */
.cdw-context-tax .cdw-error-message {
    display: block;
    margin-top: 4px;
}

/* Ensure error message is visible after woocommerce-input-wrapper */
.woocommerce-input-wrapper+.cdw-error-message {
    display: block;
    margin-top: 4px;
}

/* Form row with error message spacing */
.form-row .cdw-error-message,
p.form-row .cdw-error-message {
    display: block;
    margin-top: 4px;
    clear: both;
}