/**
 * Quick Buy Popup Styles - Customizable Design System
 * Styled for admin customization via WordPress settings
 * Inspired by https://ui.shadcn.com/
 */

/* CSS Variables for Admin Customization - có thể override qua WordPress Customizer */
:root {
    /* Design System Colors - Admin có thể thay đổi */
    --qb-background: 0 0% 100%;
    --qb-foreground: 222.2 84% 4.9%;
    --qb-card: 0 0% 100%;
    --qb-card-foreground: 222.2 84% 4.9%;
    --qb-popover: 0 0% 100%;
    --qb-popover-foreground: 222.2 84% 4.9%;
    --qb-primary: 221.2 83.2% 53.3%;
    --qb-primary-foreground: 210 40% 98%;
    --qb-secondary: 210 40% 96%;
    --qb-secondary-foreground: 222.2 84% 4.9%;
    --qb-muted: 210 40% 96%;
    --qb-muted-foreground: 215.4 16.3% 46.9%;
    --qb-accent: 210 40% 96%;
    --qb-accent-foreground: 222.2 84% 4.9%;
    --qb-destructive: 0 84.2% 60.2%;
    --qb-destructive-foreground: 210 40% 98%;
    --qb-border: 214.3 31.8% 91.4%;
    --qb-input: 214.3 31.8% 91.4%;
    --qb-ring: 221.2 83.2% 53.3%;
    --qb-success: 173 58% 39%;
    --qb-warning: 43 74% 66%;
    
    /* Typography Customization */
    --qb-font-size-xs: 0.75rem;
    --qb-font-size-sm: 0.875rem;
    --qb-font-size-base: 1rem;
    --qb-font-size-lg: 1.125rem;
    --qb-font-size-xl: 1.25rem;
    --qb-font-size-2xl: 1.5rem;
    
    /* Spacing Customization */
    --qb-spacing-xs: 0.25rem;
    --qb-spacing-sm: 0.5rem;
    --qb-spacing-md: 1rem;
    --qb-spacing-lg: 1.5rem;
    --qb-spacing-xl: 2rem;
    --qb-spacing-2xl: 2.5rem;
    
    /* Component Sizes */
    --qb-input-height: 2.5rem;
    --qb-button-height: 2.5rem;
    --qb-popup-max-width: 1200px;
    --qb-popup-padding: 2rem;
    
    /* Layout Customization */
    --qb-layout-breakpoint-tablet: 768px;
    --qb-layout-breakpoint-mobile: 480px;
    
}


/* Container chính của popup - overlay toàn màn hình */
.order-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: hsl(0 0% 0% / 0.8);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s cubic-bezier(0.4,0,0.2,1);
}

.order-container.show {
    opacity: 1;
    visibility: visible;
}

.order-container.show #content {
    overflow-y: scroll;
}

/* Nội dung popup chính - 2 Column Layout */
.popup-content {
    background: hsl(var(--qb-card));
    border: 1px solid hsl(var(--qb-border));
    border-radius: 0.5rem;
    max-width: var(--qb-popup-max-width);
    width: 98%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    display: flex;
    flex-direction: column;
}

/* Header của popup */
.order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid hsl(var(--qb-border));
    background: hsl(var(--qb-card));
    flex-shrink: 0;
}

.order-header span {
    font-size: 16px;
    font-weight: 600;
    color: hsl(var(--qb-foreground));
    line-height: 1;
}

/* Nút đóng popup */
.close-button {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: hsl(var(--qb-muted-foreground));
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
}

.close-button:hover {
    color: hsl(var(--qb-foreground));
    background: hsl(var(--qb-secondary));
}

/* Body của popup - 2 Column Layout */
.order-body {
    display: flex;
    flex-direction: row;
    gap: 0;
    flex: 1;
    width: 100%;
    overflow: hidden;
}

/* Cột trái - Thông tin sản phẩm */
.product-info {
    width: 50%;
    flex: 0 0 50%;
    padding: 20px;
    border-right: 1px solid hsl(var(--qb-border));
    overflow-y: auto;
    background: hsl(var(--qb-muted) / 0.3);
}

/* Cột phải - Form đặt hàng */
.buyer-form {
    width: 50%;
    flex: 0 0 50%;
    padding: 20px;
    overflow-y: auto;
    background: hsl(var(--qb-card));
}

/* Product Header */
.qb-product-header {
    margin-bottom: 16px;
}

.qb-product-basic-info {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 16px;
}

.qb-product-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 0.5rem;
    border: 1px solid hsl(var(--qb-border));
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.qb-product-details {
    flex: 1;
}

.qb-product-title {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    color: hsl(var(--qb-foreground));
    line-height: 1.3;
}

.product-details {
    flex: 1;
}

.product-title {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    color: hsl(var(--qb-foreground));
    line-height: 1.3;
}

/* Product price styles - renamed to avoid conflicts */
.qb-product-price {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

/* Sale price (current price) */
.qb-product-price ins {
    text-decoration: none;
    order: 1;
}

.qb-product-price ins .woocommerce-Price-amount {
    color: hsl(var(--qb-destructive));
    font-size: 16px;
    font-weight: 600;
}

/* Original price (strikethrough) */
.qb-product-price del {
    order: 2;
    opacity: 0.7;
}

.qb-product-price del .woocommerce-Price-amount {
    color: hsl(var(--qb-muted-foreground));
    font-size: 14px;
    font-weight: 400;
}

/* When no sale - just regular price */
.qb-product-price:not(:has(del)) .woocommerce-Price-amount,
.qb-product-price > .woocommerce-Price-amount {
    color: hsl(var(--qb-destructive));
    font-size: 16px;
    font-weight: 600;
}

/* Hide screen reader text */
.qb-product-price .screen-reader-text {
    display: none;
}

/* Product options section */
.qb-product-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Labels theo Shadcn/UI */
.label {
    font-weight: 500;
    margin: 0 0 6px 0;
    color: hsl(var(--qb-foreground));
    font-size: 13px;
    line-height: 1.2;
}

/* Variation groups */
.qb-variation-group {
    margin-bottom: 12px;
}

/* Nhóm options cho variants */
.options-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.option-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    border-radius: 0.375rem;
    font-size: 12px;
    font-weight: 400;
    height: 28px;
    padding: 0 10px;
    border: 0.5px solid hsl(var(--qb-input));
    background: hsl(var(--qb-background));
    color: hsl(var(--qb-foreground));
    cursor: pointer;
}

.option-button:hover:not(:disabled):not(.disabled) {
    background: hsl(var(--qb-accent));
    color: hsl(var(--qb-accent-foreground));
    border: 0.5px solid hsl(var(--qb-ring));
}

.option-button.selected {
    background: hsl(var(--qb-primary));
    color: hsl(var(--qb-primary-foreground));
    border: 0.5px solid hsl(var(--qb-primary));
    box-shadow: 0 0 0 1px hsl(var(--qb-ring) / 0.15);
}

.option-button.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: hsl(var(--qb-muted));
    color: hsl(var(--qb-muted-foreground));
    border: 0.5px solid hsl(var(--qb-border));
    pointer-events: none;
}

.option-button.selected:hover {
    opacity: 0.9;
    transform: scale(0.98);
}

/* Quantity section */
.qb-quantity-section {
    margin-bottom: 12px;
}

.qb-quantity-group {
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: flex-start;
}

.qb-quantity-input {
    width: 60px;
    height: 32px;
    padding: 0 8px;
    text-align: center;
    border: 1px solid hsl(var(--qb-border));
    border-radius: 0.5rem;
    font-size: 13px;
    font-weight: 500;
    background: hsl(var(--qb-background));
    color: hsl(var(--qb-foreground));
    -moz-appearance: textfield; /* Firefox */
    appearance: textfield;
}

/* Hide spinner arrows for Chrome, Safari, Edge */
.qb-quantity-input::-webkit-outer-spin-button,
.qb-quantity-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Hide spinner arrows for Firefox */
.qb-quantity-input[type=number] {
    -moz-appearance: textfield;
}

.qb-quantity-input:focus {
    outline: none;
    border-color: hsl(var(--qb-ring));
    box-shadow: 0 0 0 2px hsl(var(--qb-ring) / 0.2);
}

.qb-quantity-button-increase,
.qb-quantity-button-decrease {
    width: 32px;
    height: 32px;
    border: 1px solid hsl(var(--qb-border));
    background: hsl(var(--qb-background));
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    border-radius: 0.5rem;
    color: hsl(var(--qb-foreground));
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}

.qb-quantity-button-increase:hover,
.qb-quantity-button-decrease:hover {
    background: hsl(var(--qb-secondary));
    border-color: hsl(var(--qb-ring));
}

.qb-quantity-button-increase:active,
.qb-quantity-button-decrease:active {
    background: hsl(var(--qb-muted));
    transform: scale(0.95);
}

/* Alert/Note component theo Shadcn/UI */
.note {
    border: 1px solid hsl(var(--qb-warning) / 0.2);
    background: hsl(var(--qb-warning) / 0.1);
    color: hsl(var(--qb-foreground));
    padding: 10px 12px;
    border-radius: 0.5rem;
    font-size: 14px;
    line-height: 1.4;
}

/* Form styling theo Shadcn/UI */
/* Section title styles - using p tag instead of h3 */
.section-title {
    margin: 0 0 12px 0;
    color: hsl(var(--qb-foreground));
    font-size: 15px;
    font-weight: 600;
    line-height: 1;
}

.form-row {
    display: flex;
    flex-direction: row;
    gap: var(--qb-spacing-sm);
    margin-bottom: var(--qb-spacing-sm);
}

.form-row:last-child {
    margin-bottom: 0;
}

.form-rows:after,
.form-row:before {
    content: none !important;
}

.form-row:after {
    content: none !important;
}

.form-row:has(textarea),
.form-row:has(.form-discount) {
    flex-direction: column;
}

/* Input fields styling theo Shadcn/UI */
.buyer-form input,
.buyer-form textarea,
.buyer-form select {
    display: flex;
    height: 36px !important;
    width: 100%;
    max-width: 100%;
    border-radius: 0.5rem !important;
    border: 1px solid hsl(var(--qb-input)) !important;
    background: hsl(var(--qb-background)) !important;
    padding: 8px 12px !important;
    font-size: 13px !important;
    color: hsl(var(--qb-foreground)) !important;
    box-sizing: border-box;
}

.buyer-form textarea {
    min-height: 60px;
    height: 60px !important;
    resize: none;
}

.buyer-form input:focus,
.buyer-form textarea:focus,
.buyer-form select:focus {
    outline: none;
    border-color: hsl(var(--qb-ring));
    box-shadow: 0 0 0 2px hsl(var(--qb-ring) / 0.2);
}

.buyer-form input::placeholder,
.buyer-form textarea::placeholder {
    color: hsl(var(--qb-muted-foreground));
}

/* Select dropdown styling */
.form-select,
.wc-country-select,
.wc-state-select {
    appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 20 20"><path stroke="%236b7280" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M6 8l4 4 4-4"/></svg>');
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    padding-right: 2.5rem;
}

/* Form discount section */
.form-discount {
    display: flex;
    gap: var(--qb-spacing-sm);
    align-items: stretch;
}

.form-discount input {
    flex: 1;
    margin: 0;
    height: 36px;
    padding: 8px 12px;
    font-size: 13px;
    border: 1px solid hsl(var(--qb-border));
    border-radius: 0.5rem;
    background: hsl(var(--qb-background));
}

.apply-discount-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    border-radius: 0.5rem;
    font-size: 13px;
    font-weight: 500;
    height: 36px;
    padding: 0 16px;
    background: hsl(var(--qb-primary));
    color: hsl(var(--qb-primary-foreground));
    border: none;
    cursor: pointer;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.apply-discount-button:hover {
    background: hsl(var(--qb-primary) / 0.9);
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
}

/* Order summary section - Consistent styling */
.order-summary {
    background: hsl(var(--qb-background));
    border: 1px solid hsl(var(--qb-border));
    border-radius: 0.5rem;
    padding: 10px 12px;
    margin: 12px 0;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    min-height: 24px;
}

.summary-row {
    border-bottom: 1px solid hsl(var(--qb-border) / 0.5);
}

.summary-row:last-child,
.summary-row.total-row,
.summary-row:nth-last-child(2) {
    border-bottom: none !important;
}

.summary-row.total-row {
    padding-top: 8px;
    margin-top: 6px;
    border-top: 1px solid hsl(var(--qb-border));
    min-height: auto;
}

/* When total row is first child (no other rows before it), remove top border and spacing */
.order-summary .summary-row.total-row:first-child {
    padding-top: 0;
    padding-bottom: 0;
    margin-top: 0;
    border-top: none;
}

/* Also handle when only discount row is before total */
.order-summary > .summary-row:first-child + .summary-row.total-row {
    padding-top: 8px;
    margin-top: 6px;
    border-top: 1px solid hsl(var(--qb-border));
}

.summary-label {
    color: hsl(var(--qb-foreground));
    font-size: 13px;
    font-weight: 400;
}

.summary-value {
    color: hsl(var(--qb-foreground));
    font-weight: 500;
    font-size: 13px;
}

/* Override WooCommerce .amount styling in order summary */
.order-summary .amount {
    font-size: 13px !important;
    font-weight: 500 !important;
}

.order-summary .total-row .amount {
    font-size: 14px !important;
    font-weight: 600 !important;
}

/* Ensure all summary values have consistent styling */
#subtotal .amount,
#shipping-fee .amount,
#discount-amount .amount {
    font-size: 13px !important;
    font-weight: 500 !important;
}

#total-amount .amount {
    font-size: 14px !important;
    font-weight: 600 !important;
}

.total-row .summary-label {
    font-weight: 600;
    font-size: 13px;
}

.total-row .summary-value {
    color: hsl(var(--qb-destructive));
    font-size: 14px;
    font-weight: 600;
}

/* Button component theo Shadcn/UI */
.submit-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    border-radius: 0.5rem;
    font-size: 14px;
    font-weight: 600;
    height: 40px;
    padding: 0 20px;
    width: 100%;
    background: hsl(var(--qb-destructive));
    color: hsl(var(--qb-destructive-foreground));
    border: none;
    cursor: pointer;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.submit-button:hover {
    background: hsl(var(--qb-destructive) / 0.9);
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
}

.submit-button:active {
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

/* Nút Quick Buy trên trang sản phẩm */
#quick-buy-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    border-radius: 0.5rem;
    font-size: 14px;
    font-weight: 600;
    height: 40px;
    padding: 0 20px;
    background: hsl(var(--qb-destructive));
    color: hsl(var(--qb-destructive-foreground));
    border: none;
    cursor: pointer;
    margin: 12px 0;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

#quick-buy-button:hover {
    background: hsl(var(--qb-destructive) / 0.9);
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

/* Responsive design */
@media (max-width: 1024px) {
    .popup-content {
        max-width: 900px;
    }
    
    .order-body {
        flex-direction: column;
    }
    
    .product-info,
    .buyer-form {
        padding: 16px;
    }
}

@media (max-width: 768px) {
    .popup-content {
        width: 98%;
        max-height: 95vh;
        margin: 8px;
    }
    
    .order-body {
        flex-direction: column;
        gap: 0;
        flex: none;
        overflow: visible;
    }
    
    .product-info {
        width: 100%;
        flex: none;
        border-right: none;
        border-bottom: 1px solid hsl(var(--qb-border));
        padding: 16px;
    }
    
    .buyer-form {
        width: 100%;
        flex: none;
        padding: 16px;
    }
    
    .product-basic-info {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .product-image {
        width: 100px;
        height: 100px;
    }
    
    /* Keep name/phone and province/commune in same row on mobile */
    .form-row {
        flex-direction: row;
        gap: 8px;
    }
    
    /* Only make these specific rows column layout */
    .form-row:has(textarea),
    .form-row:has(.form-discount),
    .form-row:has(input[name="billing_address_1"]) {
        flex-direction: column;
    }
    
    .form-discount {
        flex-direction: column;
        gap: 8px;
    }
    
    .quantity-group {
        justify-content: center;
    }
    
    .options-group {
        justify-content: center;
    }
    
    /* Remove margin from quantity section on mobile */
    .qb-quantity-section {
        margin-bottom: 0;
    }
}

@media (max-width: 480px) {
    .popup-content {
        width: 100%;
        height: auto;
        border-radius: 0;
        max-height: none;
    }
    
    .order-header {
        padding: 10px 12px;
    }
    
    .product-info,
    .buyer-form {
        padding: 12px;
        flex: none;
    }
    
    .product-title {
        font-size: 15px;
    }
    
    .product-price {
        font-size: 14px;
    }
    
    .product-image {
        width: 70px;
        height: 70px;
    }
    
    /* Keep name/phone and province/commune in same row on small mobile */
    .form-row {
        flex-direction: row;
        gap: 6px;
    }
    
    /* Ensure inputs take equal space */
    .form-row input[name="name"],
    .form-row input[name="phone"],
    .form-row select[name="billing_province"],
    .form-row select[name="billing_commune"] {
        flex: 1;
        min-width: 0;
    }
    
    /* Only these rows should be column */
    .form-row:has(textarea),
    .form-row:has(input[name="billing_address_1"]) {
        flex-direction: column;
    }
    
    /* Smaller input height on mobile to save space */
    .buyer-form input,
    .buyer-form select {
        height: 34px !important;
        font-size: 12px !important;
        padding: 6px 10px !important;
    }
    
    .buyer-form textarea {
        height: 50px !important;
        font-size: 12px !important;
        padding: 6px 10px !important;
    }
    
    /* Remove margin from quantity section on small mobile */
    .qb-quantity-section {
        margin-bottom: 0;
    }
}

/* Scrollbar tùy chỉnh */
.product-info::-webkit-scrollbar,
.buyer-form::-webkit-scrollbar {
    width: 6px;
}

.product-info::-webkit-scrollbar-track,
.buyer-form::-webkit-scrollbar-track {
    background: hsl(var(--qb-muted));
    border-radius: 3px;
}

.product-info::-webkit-scrollbar-thumb,
.buyer-form::-webkit-scrollbar-thumb {
    background: hsl(var(--qb-muted-foreground) / 0.3);
    border-radius: 3px;
}

.product-info::-webkit-scrollbar-thumb:hover,
.buyer-form::-webkit-scrollbar-thumb:hover {
    background: hsl(var(--qb-muted-foreground) / 0.5);
}

/* Loading state */
.buyer-form.loading {
    pointer-events: none;
    opacity: 0.7;
}

.buyer-form.loading .submit-button {
    position: relative;
}

.buyer-form.loading .submit-button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 1rem;
    height: 1rem;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: qb-spin 1s linear infinite;
}

@keyframes qb-spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Error states */
.form-error {
    border-color: hsl(var(--qb-destructive)) !important;
    box-shadow: 0 0 0 2px hsl(var(--qb-destructive) / 0.2) !important;
}

.error-message {
    color: hsl(var(--qb-destructive));
    font-size: 11px;
    margin-top: 4px;
    display: block;
}

/* Success states for validation */
.form-success {
    border-color: hsl(var(--qb-success)) !important;
    box-shadow: 0 0 0 2px hsl(var(--qb-success) / 0.2) !important;
}

.success-message {
    color: hsl(var(--qb-success));
    font-size: 11px;
    margin-top: 4px;
    display: block;
}

/* Focus ring improvements */
.option-button:focus-visible,
.quantity-button-increase:focus-visible,
.quantity-button-decrease:focus-visible,
.apply-discount-button:focus-visible,
.submit-button:focus-visible,
#quick-buy-button:focus-visible {
    outline: 2px solid hsl(var(--qb-ring));
    outline-offset: 2px;
}

/* Disabled states */
.option-button:disabled,
.quantity-button-increase:disabled,
.quantity-button-decrease:disabled,
.apply-discount-button:disabled,
.submit-button:disabled {
    pointer-events: none;
    opacity: 0.5;
}

/* Admin Customization Classes - để admin có thể override */
.qb-custom-button-style {
    /* Admin có thể override button styles */
}

.qb-custom-form-style {
    /* Admin có thể override form styles */
}

.qb-custom-popup-style {
    /* Admin có thể override popup styles */
}

/* Utility Classes cho Admin */
.qb-hidden { display: none !important; }
.qb-visible { display: block !important; }
.qb-text-center { text-align: center !important; }
.qb-text-left { text-align: left !important; }
.qb-text-right { text-align: right !important; }


.quick-buy-no-scroll {
	overflow: hidden !important;
	height: 100vh;
}

.buyer-form.form-section .form-row {
    padding: 0px !important;
}

.form-select > * {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

/* ===========================
   Hiệu ứng chuyển động mượt mà cho popup, nút, section
   =========================== */
.order-container,
.popup-content,
.order-header,
.order-body,
.product-info,
.buyer-form {
    transition: all 0.15s cubic-bezier(0.4,0,0.2,1);
}

/* Nút và các thành phần có thể tương tác */
.close-button,
.submit-button,
#quick-buy-button,
.option-button,
.quantity-button-increase,
.quantity-button-decrease,
.apply-discount-button {
    transition: background 0.15s, color 0.15s, box-shadow 0.15s, border-color 0.15s, transform 0.15s;
}

/* Hiệu ứng hover/active cho nút */
.submit-button:hover,
#quick-buy-button:hover,
.option-button:hover,
.apply-discount-button:hover {
    box-shadow: 0 6px 18px rgba(0,0,0,0.10);
    transform: translateY(-2px) scale(1.03);
}

.submit-button:active,
#quick-buy-button:active,
.option-button:active,
.apply-discount-button:active {
    transform: scale(0.97);
}

/* ===========================
   Hiệu ứng cho notification (thông báo)
   =========================== */
.quick-buy-notification {
    opacity: 0;
    transform: translateX(100%);
    transition: opacity 0.15s, transform 0.15s;
}
.quick-buy-notification.show {
    opacity: 1;
    transform: translateX(0);
}

/* ===========================
   Hiệu ứng cho input, focus, error
   =========================== */
.buyer-form input:focus,
.buyer-form textarea:focus,
.buyer-form select:focus {
    border-color: hsl(var(--qb-ring));
    box-shadow: 0 0 0 2px hsl(var(--qb-ring) / 0.25);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-error {
    border-color: hsl(var(--qb-destructive)) !important;
    box-shadow: 0 0 0 2px hsl(var(--qb-destructive) / 0.25) !important;
    transition: border-color 0.2s, box-shadow 0.2s;
}

/* ===========================
   Flat Layout Styles (No Accordion)
   =========================== */
.flat-section {
    margin-bottom: 16px;
}

.shipping-payment-section {
    margin-top: 16px;
}

.shipping-payment-fields {
    padding: 0;
}

/* Radio Group Styles */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.radio-option {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    height: 36px;
    min-height: 36px;
    border: 1px solid hsl(var(--qb-border));
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.15s;
    background: hsl(var(--qb-background));
    position: relative;
}

.radio-option:hover {
    background: hsl(var(--qb-muted) / 0.5);
    border-color: hsl(var(--qb-ring));
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* Checked state using :has() for modern browsers */
.radio-option:has(input[type="radio"]:checked) {
    background: hsl(var(--qb-primary) / 0.05);
    border-color: hsl(var(--qb-primary));
    box-shadow: 0 0 0 1px hsl(var(--qb-primary) / 0.2);
}

/* Fallback for older browsers using adjacent sibling */
.radio-option input[type="radio"]:checked ~ .radio-label {
    color: hsl(var(--qb-primary));
}

.radio-option input[type="radio"] {
    width: 14px;
    height: 14px;
    min-width: 14px;
    margin: 0;
    margin-right: 8px;
    cursor: pointer;
    accent-color: hsl(var(--qb-primary));
}

.radio-label {
    flex: 1;
    font-weight: 400;
    font-size: 13px;
    line-height: 1.4;
    color: hsl(var(--qb-foreground));
    user-select: none;
}

.radio-cost {
    margin-left: auto;
    font-weight: 500;
    font-size: 13px;
    color: hsl(var(--qb-primary));
}

/* Single Shipping Method Display - Consistent with payment method */
.single-shipping-method {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    height: 36px;
    min-height: 36px;
    border: 1px solid hsl(var(--qb-primary));
    border-radius: 0.5rem;
    background: hsl(var(--qb-primary) / 0.05);
    box-shadow: 0 0 0 1px hsl(var(--qb-primary) / 0.2);
    transition: all 0.15s;
}

.shipping-method-name {
    flex: 1;
    font-weight: 400;
    font-size: 13px;
    line-height: 1.4;
    color: hsl(var(--qb-foreground));
}

.shipping-method-cost {
    margin-left: auto;
    color: hsl(var(--qb-primary));
    font-weight: 500;
    font-size: 13px;
}

.loading-text {
    color: hsl(var(--qb-muted-foreground));
    font-style: italic;
    font-size: 13px;
}

.no-shipping {
    color: hsl(var(--qb-destructive));
    font-style: italic;
    font-size: 13px;
}

/* Form Group Styles */
.form-group {
    margin-bottom: 12px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group .label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
    color: hsl(var(--qb-foreground));
}

/* ===========================
   Hiệu ứng mở rộng/collapse section (DISABLED for flat layout)
   =========================== */
.collapsible-section {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.2s cubic-bezier(0.4,0,0.2,1), padding 0.15s, margin 0.15s;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    border: none !important;
    margin-bottom: 0 !important;
}
.collapsible-section.expanded {
    /* Không set max-height cố định ở đây! */
    /* Padding/margin sẽ được set động bằng JS */
}

/* ===========================
   Responsive mượt mà
   =========================== */
@media (max-width: 1024px) {
    .popup-content {
        transition: max-width 0.3s;
    }
}


/* ===========================
   Hiệu ứng loading cho nút submit
   =========================== */
.buyer-form.loading .submit-button::after {
    animation: qb-spin 1s linear infinite;
    transition: border-top-color 0.2s;
}

.quick-buy-notification {
	position: fixed;
	top: 30px;
	right: 30px;
	z-index: 9999;
	background: #333;
	color: #fff;
	padding: 16px 24px;
	border-radius: 6px;
	box-shadow: 0 2px 8px rgba(0,0,0,0.15);
	opacity: 0;
	transform: translateY(-20px);
	transition: opacity 0.3s, transform 0.3s;
	pointer-events: none;
	font-size: 16px;
}
.quick-buy-notification.success { background: #28a745; }
.quick-buy-notification.error { background: #dc3545; }
.quick-buy-notification.info { background: #17a2b8; }
.quick-buy-notification.show {
	opacity: 1;
	transform: translateY(0);
	pointer-events: auto;
}