/* =========================================================
   ROSEWOOD — Quotation Cart System
   ========================================================= */

/* ---- Floating Cart Button ---- */
#quote-fab {
    position: fixed;
    bottom: 84px;
    inset-inline-end: 28px;
    z-index: 600;
    width: 54px; height: 54px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 6px 20px rgba(200,134,10,0.45);
    transition: all 0.3s ease;
}
#quote-fab:hover { background: var(--primary-dark); transform: translateY(-2px); }
#quote-fab.has-items { animation: fabPulse 2.5s infinite; }

#quote-fab-badge {
    position: absolute;
    top: -6px;
    inset-inline-start: -6px;
    width: 20px; height: 20px;
    background: #e04545;
    color: #fff;
    border-radius: 50%;
    font-size: 0.68rem;
    font-weight: 700;
    display: none;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg);
}
#quote-fab-badge.show { display: flex; }

/* ---- Drawer ---- */
#quote-drawer {
    position: fixed;
    top: 0;
    inset-inline-end: -480px;
    width: 460px;
    max-width: 100vw;
    height: 100vh;
    background: #0f0d0b;
    border-inline-start: 1px solid var(--border);
    z-index: 1100;
    display: flex;
    flex-direction: column;
    transition: inset-inline-end 0.35s cubic-bezier(0.4,0,0.2,1);
    box-shadow: -8px 0 40px rgba(0,0,0,0.6);
}
#quote-drawer.open { inset-inline-end: 0; }

.drawer-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 1099;
    opacity: 0; pointer-events: none;
    transition: opacity 0.3s ease;
}
.drawer-overlay.show { opacity: 1; pointer-events: all; }

.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.drawer-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
}
.drawer-title i { color: var(--primary); }
.drawer-close {
    width: 34px; height: 34px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.9rem;
    transition: all 0.2s;
}
.drawer-close:hover { background: rgba(255,255,255,0.1); color: var(--text); }

/* Items area */
.drawer-items {
    flex: 1;
    overflow-y: auto;
    padding: 16px 22px;
}
.drawer-items::-webkit-scrollbar { width: 4px; }
.drawer-items::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 2px; }

.cart-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 10px;
    position: relative;
    transition: border-color 0.2s;
}
.cart-item:hover { border-color: var(--border-light); }

.cart-item-img {
    width: 56px; height: 56px;
    object-fit: contain;
    border-radius: 7px;
    border: 1px solid var(--border);
    flex-shrink: 0;
    background: var(--bg-card);
    padding: 3px;
}

.cart-item-body { flex: 1; min-width: 0; }

.cart-item-name {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cart-item-meta {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

/* ---- Attribute pills in cart drawer ---- */
.cart-item-attrs {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 7px;
}
.cart-attr-pill {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: rgba(200,134,10,0.07);
    border: 1px solid rgba(200,134,10,0.2);
    border-radius: 20px;
    padding: 2px 9px;
    font-size: 0.68rem;
    line-height: 1.5;
}
.cart-attr-type-label {
    color: var(--text-muted);
    font-weight: 600;
}
.cart-attr-val-label {
    color: var(--primary-light, #e8a92a);
    font-weight: 700;
}

.cart-item-qty {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.qty-btn {
    width: 26px; height: 26px;
    background: rgba(200,134,10,0.1);
    border: 1px solid rgba(200,134,10,0.25);
    border-radius: 5px;
    color: var(--primary);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
    line-height: 1;
    flex-shrink: 0;
}
.qty-btn:hover { background: var(--primary); color: #fff; }

/* Keyboard-editable qty input */
.qty-input {
    width: 52px;
    height: 26px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(200,134,10,0.3);
    border-radius: 5px;
    color: var(--text, #eee);
    font-size: 0.88rem;
    font-weight: 700;
    text-align: center;
    padding: 0 4px;
    outline: none;
    transition: border-color 0.2s;
    -moz-appearance: textfield;
}
.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty-input:focus { border-color: var(--primary); }
.qty-input.qty-below-min {
    border-color: #e04545 !important;
    background: rgba(224,69,69,0.08);
    color: #f77;
    animation: shakeInput 0.35s ease;
}
@keyframes shakeInput {
    0%,100% { transform: translateX(0); }
    25%      { transform: translateX(-4px); }
    75%      { transform: translateX(4px); }
}
.qty-min-error {
    font-size: 0.71rem;
    color: #f77;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.qty-unit {
    font-size: 0.72rem;
    color: var(--text-muted, #8a8070);
}
.qty-min-hint {
    font-size: 0.68rem;
    color: rgba(200,134,10,0.7);
    background: rgba(200,134,10,0.08);
    border: 1px solid rgba(200,134,10,0.15);
    border-radius: 30px;
    padding: 1px 7px;
}

/* ---- Item notes ---- */
.cart-item-note-wrap {
    margin-top: 6px;
}
.btn-toggle-note {
    background: none;
    border: 1px dashed rgba(200,134,10,0.25);
    border-radius: 6px;
    color: rgba(200,134,10,0.7);
    font-size: 0.72rem;
    padding: 4px 10px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.btn-toggle-note:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(200,134,10,0.06);
}
.cart-note-input {
    width: 100%;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(200,134,10,0.2);
    border-radius: 6px;
    color: var(--text, #eee);
    font-size: 0.78rem;
    padding: 7px 10px;
    resize: vertical;
    min-height: 54px;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}
.cart-note-input:focus { border-color: var(--primary); }
.cart-note-input.hidden { display: none; }

.cart-item-remove {
    position: absolute;
    top: 8px;
    inset-inline-end: 8px;
    width: 22px; height: 22px;
    background: rgba(224,69,69,0.08);
    border: none;
    border-radius: 4px;
    color: #f77;
    font-size: 0.7rem;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}
.cart-item:hover .cart-item-remove { opacity: 1; }

.cart-custom-badge {
    display: inline-block;
    background: rgba(200,134,10,0.12);
    color: var(--primary);
    border: 1px solid rgba(200,134,10,0.2);
    padding: 1px 8px;
    border-radius: 30px;
    font-size: 0.65rem;
    font-weight: 700;
    margin-bottom: 4px;
}

/* Empty state */
.drawer-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    gap: 12px;
    padding: 40px;
    text-align: center;
}
.drawer-empty i { font-size: 2.5rem; color: var(--border-light); }
.drawer-empty p { font-size: 0.9rem; line-height: 1.6; }

/* Footer */
.drawer-footer {
    padding: 16px 22px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.btn-add-custom {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    border-radius: 8px;
    border: 1px dashed rgba(200,134,10,0.4);
    background: rgba(200,134,10,0.05);
    color: var(--primary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-add-custom:hover { border-color: var(--primary); background: rgba(200,134,10,0.1); }
.btn-send-quote {
    padding: 13px;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    font-size: 0.92rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.2s;
    font-family: inherit;
}
.btn-send-quote:hover { background: var(--primary-dark); }
.btn-send-quote:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---- Modal Overlay ---- */
.rw-modal-bg {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 1200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.rw-modal-bg.show { display: flex; }

.rw-modal {
    background: #0f0d0b;
    border: 1px solid var(--border);
    border-radius: 14px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.7);
}
.rw-modal::-webkit-scrollbar { width: 4px; }
.rw-modal::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 2px; }

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px 14px;
    border-bottom: 1px solid var(--border);
}
.modal-head-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    display: flex; align-items: center; gap: 9px;
}
.modal-head-title i { color: var(--primary); }
.modal-body { padding: 22px; }

/* ---- Form styles inside modal ---- */
.q-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 6px;
    letter-spacing: 0.3px;
}
.q-input {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 7px;
    padding: 10px 14px;
    color: var(--text);
    font-size: 0.88rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}
.q-input:focus { border-color: var(--primary); }
textarea.q-input { min-height: 80px; resize: vertical; }
.q-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.q-group { margin-bottom: 14px; }
.q-required { color: #e04545; }
.q-invalid { border-color: #e04545 !important; }
.q-error-msg { color: #f77; font-size: 0.72rem; margin-top: 4px; display: none; }
.q-error-msg.show { display: block; }

/* Image upload */
.q-file-upload {
    width: 100%;
    background: var(--bg-card);
    border: 1px dashed var(--border-light);
    border-radius: 7px;
    padding: 14px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-muted);
    font-size: 0.82rem;
}
.q-file-upload:hover { border-color: var(--primary); color: var(--primary); }
.q-file-upload input[type=file] { display: none; }
.q-upload-preview { width: 80px; height: 80px; object-fit: cover; border-radius: 7px; border: 1px solid var(--border); margin: 10px auto 0; display: none; }
.q-upload-preview.show { display: block; }

/* ---- "Add to quote" button on product cards ---- */
.btn-add-to-quote {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: var(--radius);
    background: rgba(200,134,10,0.12);
    border: 1px solid rgba(200,134,10,0.3);
    color: var(--primary-light);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s;
    font-family: inherit;
    width: 100%;
}
.btn-add-to-quote:hover,
.btn-add-to-quote.added {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* ---- Country select flag ---- */
.q-flag { font-size: 1rem; margin-left: 4px; }

/* ---- Success overlay ---- */
.quote-success-overlay {
    text-align: center;
    padding: 36px 24px;
    display: none;
}
.quote-success-overlay.show { display: block; }
.quote-success-icon {
    width: 72px; height: 72px;
    background: rgba(45,158,94,0.12);
    border: 2px solid #2d9e5e;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 20px;
    font-size: 1.8rem;
    color: #5dcf95;
}

@keyframes fabPulse {
    0%,100% { box-shadow: 0 6px 20px rgba(200,134,10,0.45); }
    50%      { box-shadow: 0 6px 32px rgba(200,134,10,0.7); }
}

@media (max-width: 480px) {
    #quote-drawer { width: 100vw; }
    .q-row { grid-template-columns: 1fr; }
}
