/* -- OVERLAY -- */
#qb-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: .25s ease;
    z-index: 9998;
}
#qb-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* -- BASE DRAWER -- */
#qb-drawer,
#cart-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 380px;
    height: 100%;
    background: #fff;
    box-shadow: -10px 0 30px rgba(0,0,0,.12);
    transform: translateX(100%);
    transition: transform .3s ease;
    z-index: 9999;
    display: flex;
    flex-direction: column;
}
#qb-drawer.open,
#cart-drawer.open {
    transform: translateX(0);
}

/* -- HEADER COMPARTILHADO -- */
.qb-drawer-header,
#cart-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    height: 56px;
    background: #dd2663;
    color: #fff;
    font-weight: 600;
    font-size: 15px;
    flex-shrink: 0;
}
#cart-drawer-title {
    display: flex;
    align-items: center;
    gap: 8px;
}
.qb-drawer-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
    opacity: .85;
}
.qb-drawer-close:hover { opacity: 1; }

/* -- CART: SUMMARY BAR -- */
#cart-drawer-summary,
#qb-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    background: #ffeefd;
    font-size: 13px;
    color: #555;
    border-bottom: 1px solid #ffd6fb;
    flex-shrink: 0;
}
#cart-total-header,
#qb-total {
    font-weight: 700;
    color: #dd2663;
}

/* -- QUICK BUY: PRODUTOS -- */
#qb-products {
    flex: 1;
    overflow-y: auto;
    padding: 8px 16px;
}
.qb-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f2f2f2;
}
.qb-thumb-wrap {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #eee;
}
.qb-thumb-wrap img {
    width: 38px !important;
    height: 38px !important;
    object-fit: cover;
    display: block;
}
.qb-info {
    flex: 1;
    min-width: 0;
}
a.qb-name {
    display: block;
    font-size: 13px !important;
    font-weight: 500;
    color: #222;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}
a.qb-name:hover { color: #dd2663; text-decoration: underline; }
.qb-prices { margin-top: 3px; font-size: 13px; display:flex; gap:5px; align-items:center; }
.qb-price { color: #222; font-weight: 600; }
.qb-price-old { color: #aaa; text-decoration: line-through; font-size: 11px; }
.qb-price-sale { color: #e63946; font-weight: 700; }

/* -- CONTROLE DE QUANTIDADE (compartilhado) -- */
.qb-qty-wrap {
    display: flex;
    align-items: center;
    border: 1.5px solid #e0e0e0;
    border-radius: 30px;
    overflow: hidden;
    flex-shrink: 0;
    background: #fff;
}
.qb-qty-btn {
    width: 32px;
    height: 34px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: #888;
    transition: color .15s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.qb-qty-btn:hover { color: #dd2663; }
.qb-qty-wrap input,
.qb-qty-wrap span.qty-display {
    width: 36px;
    height: 34px;
    border: none;
    border-left: 1.5px solid #e0e0e0;
    border-right: 1.5px solid #e0e0e0;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    outline: none;
    color: #222;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    -moz-appearance: textfield;
}
.qb-qty-wrap input::-webkit-outer-spin-button,
.qb-qty-wrap input::-webkit-inner-spin-button { -webkit-appearance: none; }

/* -- FOOTER COMPARTILHADO -- */
.qb-drawer-footer,
#cart-drawer-footer {
    padding: 16px;
    border-top: 1px solid #eee;
    flex-shrink: 0;
}

/* -- QUICK BUY: BOTÃO ADD -- */
#qb-add {
    width: 100%;
    height: 46px;
    background: #dd2663;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background .2s;
}
#qb-add:hover { background: #b81b4f; }

/* -- CART: ITENS -- */
#cart-drawer-items {
    flex: 1;
    overflow-y: auto;
    padding: 8px 16px;
}
.cart-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f2f2f2;
}
.cart-item-thumb {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #eee;
}
.cart-item-thumb img {
    width: 56px !important;
    height: 56px !important;
    object-fit: cover;
    display: block;
}
.cart-item-info {
    flex: 1;
    min-width: 0;
}
.cart-item-name {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #222;
    line-height: 1.3;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cart-item-prices { font-size: 13px; display:flex; gap:5px; align-items:center; }
.cart-item-price-old { color: #aaa; text-decoration: line-through; font-size: 11px; }
.cart-item-price { color: #222; font-weight: 700; }
.cart-item-price-sale { color: #e63946; font-weight: 700; }
.cart-item-controls {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    flex-shrink: 0;
}
.cart-item-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: #ccc;
    font-size: 16px;
    line-height: 1;
    padding: 0;
    transition: color .15s;
}
.cart-item-remove:hover { color: #e63946; }

/* -- CART: TOTAL + BOTÕES -- */
#cart-total-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 14px;
    color: #222;
}
#cart-total-footer { color: #dd2663; }

#cart-checkout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 46px;
    background: #dd2663;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    margin-bottom: 8px;
    transition: background .2s;
}
#cart-checkout-btn:hover { background: #b81b4f; color: #fff; }

#cart-continue-btn {
    width: 100%;
    height: 42px;
    background: transparent;
    border: 1.5px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #666;
    transition: border-color .2s, color .2s;
}
#cart-continue-btn:hover { border-color: #dd2663; color: #dd2663; }

/* -- QUICK BUY: BOTÃO FLUTUANTE -- */
#qb-open {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: #dd2663;
    color: #fff;
    border: none;
    padding: 12px 18px;
    border-radius: 8px;
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(184,27,79,.4);
}
#qb-open:hover { background: #b81b4f; }

/* -- CART VAZIO -- */
#cart-empty-msg {
    text-align: center;
    padding: 40px 20px;
    color: #aaa;
    font-size: 14px;
}

/* -- CUPOM -- */
.qb-coupon-section { margin-bottom: 12px; }
.qb-coupon-input-row { display: flex; gap: 8px; }
.qb-coupon-input-row input {
    flex: 1; height: 38px; border: 1.5px solid #e0e0e0; border-radius: 6px;
    padding: 0 12px; font-size: 13px; outline: none; color: #333;
}
.qb-coupon-input-row input:focus { border-color: #dd2663; }
.qb-coupon-input-row button {
    height: 38px; padding: 0 16px; background: #555; color: #fff; border: none;
    border-radius: 6px; font-size: 13px; font-weight: 600; cursor: pointer;
    transition: background .2s; white-space: nowrap;
}
.qb-coupon-input-row button:hover { background: #333; }
.qb-coupon-msg { font-size: 12px; margin-top: 6px; padding: 6px 10px; border-radius: 4px; }
.qb-coupon-msg.success { background: #d4edda; color: #155724; }
.qb-coupon-msg.error { background: #f8d7da; color: #721c24; }
.qb-coupon-applied { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; }
.qb-coupon-tag {
    display: inline-flex; align-items: center; gap: 4px; background: #f0faf0;
    border: 1px solid #c3e6cb; border-radius: 20px; padding: 4px 10px;
    font-size: 12px; color: #155724; font-weight: 500;
}
.qb-coupon-tag .remove-coupon {
    background: none; border: none; color: #721c24; cursor: pointer;
    font-size: 14px; line-height: 1; padding: 0; margin-left: 2px;
}
.qb-coupon-tag .remove-coupon:hover { color: #e63946; }

/* -- FRETE GRÁTIS SEÇÃO -- */
.frete-gratis-section {
    padding: 10px 20px;
    flex-shrink: 0;
    border-bottom: 1px solid #f2f2f2;
}
.frete-gratis-estado-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.frete-gratis-estado-row label {
    font-size: 12px;
    color: #555;
    white-space: nowrap;
    font-weight: 500;
}
.frete-estado-select {
    flex: 1;
    height: 38px;
    border: 1.5px solid #e0e0e0;
    border-radius: 6px;
    font-size: 12px;
    padding: 0 8px;
    background: #fff;
    color: #333;
    outline: none;
    cursor: pointer;
}
.frete-gratis-section {
    overflow: visible;
}
.frete-estado-select:focus { border-color: #dd2663; }
.frete-gratis-section .nice-select .list {
    max-height: 200px;
    overflow-y: auto;
}

/* -- BARRA FRETE GRÁTIS -- */
.frete-gratis-bar {
    margin-top: 8px;
}
.frete-gratis-progress {
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 6px;
}
.frete-gratis-fill {
    height: 100%;
    background: #28a745;
    border-radius: 3px;
    transition: width 0.4s ease;
    width: 0%;
}
.frete-gratis-msg {
    font-size: 12px;
    color: #555;
    display: block;
}
.frete-gratis-msg.achieved {
    color: #28a745;
    font-weight: 600;
}

/* ============================================================
   BREAKPOINTS
   ============================================================ */

/* Notebook — 1366px */
@media (max-width: 1366px) {
    #qb-open {
        font-size: 13px;
    }
    #qb-open svg:first-child {
        width: 15px;
        height: 15px;
    }
}

/* Notebook pequeno — 1024px */
@media (max-width: 1024px) {

}

/* Tablet — 768px */
@media (max-width: 768px) {
    #qb-open {
        font-size: 12px;
    }
    #qb-open svg:first-child {
        width: 12px;
        height: 12px;
    }
}

/* Mobile — 480px */
@media (max-width: 480px) {

}

/* Trava de cliques durante o AJAX */
.qb-is-loading {
    pointer-events: none !important;
    opacity: 0.5 !important;
    transition: opacity 0.2s ease;
}