/* ==========================================================================
   K-Tech Quick Buy Modal Popup Styles (Match Sample Screenshot)
   ========================================================================== */

.ktech-qb-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.65);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
    box-sizing: border-box;
    backdrop-filter: blur(2px);
}

.ktech-qb-modal {
    background: #ffffff;
    width: 100%;
    max-width: 820px;
    border-radius: 6px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    overflow: hidden;
    position: relative;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: ktechQbFadeIn 0.25s ease-out;
}

@keyframes ktechQbFadeIn {
    from {
        opacity: 0;
        transform: translateY(-15px);
    }

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

/* 1. Header Banner */
.ktech-qb-header {
    background: #ff0000;
    color: #ffffff;
    padding: 12px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
}

.ktech-qb-header-text {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 15px;
}

.ktech-qb-close-btn {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    margin: 0;
    opacity: 0.9;
    transition: opacity 0.2s ease;
    height: auto;
    min-height: auto;
    min-width: auto;
    padding: .25rem .5rem;
}

.ktech-qb-close-btn:hover {
    opacity: 1;
}

/* Loader */
.ktech-qb-loader {
    padding: 40px;
    text-align: center;
    font-size: 14px;
    color: #666;
}

.ktech-qb-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #ff0000;
    border-radius: 50%;
    margin: 0 auto 12px;
    animation: ktechSpin 0.8s linear infinite;
}

@keyframes ktechSpin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* 2. Modal Body Grid */
.ktech-qb-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    padding: 20px 24px;
    overflow-y: auto;
    box-sizing: border-box;
}

/* Left Column */
.ktech-qb-col-left {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.ktech-qb-product-top {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.ktech-qb-img-wrapper {
    width: 90px;
    height: 90px;
    min-width: 90px;
    border: 1px solid #efefef;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.ktech-qb-img-wrapper img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.ktech-qb-product-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ktech-qb-product-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #222222;
    margin: 0;
    line-height: 1.35;
}

.ktech-qb-product-price {
    font-size: 1rem;
    font-weight: 700;
    color: #222222;
}

.ktech-qb-product-price del {
    color: #888888;
    font-weight: 400;
    font-size: 13px;
    margin-right: 6px;
}

.ktech-qb-product-price ins,
.ktech-qb-product-price bdi {
    color: #222222;
    text-decoration: none;
    font-weight: 700;
}

/* Swatches */
.ktech-qb-label {
    font-size: 1rem;
    font-weight: 700;
    color: #333333;
    display: block;
    margin-bottom: 6px;
}

.ktech-qb-label>* {
    font-weight: 500;
}

.ktech-qb-swatches-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ktech-qb-swatch-item {
    border: 1px solid #d0d0d0 !important;
    border-radius: 2px !important;
    padding: 6px 12px !important;
    font-size: 13px !important;
    font-weight: 400 !important;
    color: #333333 !important;
    background-color: #ffffff !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    outline: none !important;
    margin: 0 !important;
}

.ktech-qb-swatch-item:hover {
    border-color: #888888 !important;
}

.ktech-qb-swatch-item.selected {
    border: 2px solid #111111 !important;
    font-weight: 600 !important;
    color: #111111 !important;
    padding: 5px 11px !important;
}

/* Desc & Stock */
.ktech-qb-desc {
    font-size: 13px;
    color: #555555;
    line-height: 1.4;
    margin: 0;
}

.ktech-qb-stock {
    font-size: 12px;
    color: #2e7d32;
    font-weight: 600;
    margin: 0;
}

/* Quantity Box */
.ktech-qb-qty-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ktech-qb-qty-row .ktech-qb-label {
    font-size: 14px;
}

.ktech-qb-qty-box {
    display: inline-flex;
    align-items: center;
    border: 1px solid #ccc;
    border-radius: 4px;
    overflow: hidden;
}

.ktech-qb-qty-box button,
.ktech-qb-qty-box input {
    margin: 0 !important;
}

.ktech-qb-qty-box .qty-btn {
    width: 32px;
    height: 32px;
    background: #f4f4f4;
    border: none;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ktech-qb-qty-box .qty-btn:hover {
    background: #e0e0e0;
}

.ktech-qb-qty-box input {
    width: 40px;
    height: 32px;
    border: none;
    border-left: 1px solid #ccc;
    border-right: 1px solid #ccc;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    box-shadow: none;
}

.ktech-qb-notice {
    font-size: 12px;
    color: #555555;
    line-height: 1.4;
    padding: 10px;
    background: #fafafa;
    border: 1px dashed #dcdcdc;
    border-radius: 4px;
}

/* Right Column */
.ktech-qb-col-right {
    display: flex;
    flex-direction: column;
}

.ktech-qb-section-title {
    font-size: 14px;
    font-weight: 700;
    color: #222222;
    margin: 4px 0 6px 0;
}

/* Container nhóm các ô nhập dữ liệu của người mua */
.ktech-qb-form-fields-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0 10px;
    margin-bottom: 8px;
}

/* Các trường chiếm trọn 100% chiều rộng (textarea Địa chỉ, Ghi chú) */
.ktech-qb-form-fields-grid .ktech-qb-field-full {
    grid-column: 1 / -1;
}

.ktech-qb-form-group {
    width: 100%;
}


.ktech-qb-input,
.ktech-qb-textarea {
    width: 100%;
    border: 1px solid #cccccc !important;
    border-radius: 4px !important;
    padding: 9px 12px !important;
    font-size: 13px !important;
    color: #333333 !important;
    box-sizing: border-box !important;
    background: #ffffff !important;
    box-shadow: none !important;
}

.ktech-qb-input:focus,
.ktech-qb-textarea:focus {
    border-color: #888888 !important;
    outline: none !important;
}

.ktech-qb-textarea {
    height: 60px;
    resize: vertical;
}

.ktech-qb-payment-box {
    margin-bottom: 4px;
}

.ktech-qb-radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #333333;
    cursor: pointer;
}

.ktech-qb-radio-label>input {
    margin-bottom: 0;
}

/* Coupon */
.ktech-qb-coupon-row {
    display: flex;
    gap: 8px;
}

.ktech-qb-coupon-btn {
    background: #c59b27;
    color: #ffffff;
    border: none;
    border-radius: 4px;
    padding: 0 16px;
    margin-right: 0 !important;
    min-width: 100px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s ease;
}

.ktech-qb-coupon-btn:hover {
    background: #b0891e;
}

.ktech-qb-msg {
    font-size: 12px;
    color: #2e7d32;
}

.ktech-qb-error-msg {
    font-size: 13px;
    color: #d32f2f;
    background: #ffebee;
    border: 1px solid #ffcdd2;
    padding: 8px 12px;
    border-radius: 4px;
}

/* Total */
.ktech-qb-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    font-weight: 700;
    color: #222222;
    margin-top: 6px;
    padding-top: 8px;
    border-top: 1px solid #eee;
}

.ktech-qb-total-amount {
    font-size: 17px;
    color: #222222;
    font-weight: 800;
}

/* Big Red Submit Button */
.ktech-qb-submit-btn {
    width: 100%;
    background: #ff0000 !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 4px !important;
    line-height: 1;
    padding: 16px 18px !important;
    font-size: 16px !important;
    font-weight: 800 !important;
    text-transform: uppercase !important;
    cursor: pointer !important;
    margin-top: 8px !important;
    transition: background 0.2s ease !important;
    box-shadow: none !important;
}

.ktech-qb-submit-btn:hover {
    background: #e00000 !important;
}

.ktech-qb-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed !important;
}

/* Responsive Media Queries */
@media (max-width: 768px) {
    .ktech-qb-body {
        grid-template-columns: 1fr;
        gap: 16px;
        padding: 16px;
    }

    .ktech-qb-header-text {
        font-size: 13px;
    }

    .ktech-qb-modal {
        max-height: 95vh;
    }
}