/* BookBound Product Add-Ons — Frontend (single product selector)
   Brand primary: #0504aa. 8pt spacing. Desktop + mobile. */

/* Hide the default WooCommerce add-to-cart form on add-on parent pages
   (our selector replaces it). Our form is .bb-rfq-form, not form.cart. */
.single-product form.cart:not(.bb-rfq-form),
.single-product .woocommerce-variation-add-to-cart { display: none !important; }

/* Remove the default WooCommerce single-product chrome on booklist pages:
   the (empty) product gallery, breadcrumb, price label and SKU/category meta.
   The selector's branded band already carries the school name + context.
   These rules only load on add-on parent pages (CSS is enqueued by the
   selector itself), so other products are unaffected. */
.single-product div.product .woocommerce-product-gallery,
.single-product div.product .images,
.single-product .woocommerce-breadcrumb,
.single-product div.product .product_meta,
.single-product div.product .summary .price { display: none !important; }

/* Make the summary span the full width once the gallery is gone. */
.single-product div.product { display: block !important; }
.single-product div.product .summary.entry-summary {
    width: 100% !important;
    max-width: none !important;
    float: none !important;
    margin: 0 !important;
}

.bb-rfq {
    --bb-primary: #0504aa;
    --bb-primary-dark: #03036f;
    --bb-ink: #1a1a2e;
    --bb-muted: #6b6b80;
    --bb-line: #e6e6ef;
    --bb-bg-soft: #f5f5fb;
    --bb-radius: 14px;
    --bb-shadow: 0 1px 2px rgba(5,4,170,.04), 0 8px 24px rgba(5,4,170,.06);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--bb-ink);
    max-width: 880px;
    margin: 0 auto;
}

/* ── School header band ─────────────────────────────────────────── */
.bb-rfq-schoolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 24px 28px;
    background: linear-gradient(135deg, var(--bb-primary) 0%, var(--bb-primary-dark) 100%);
    border-radius: var(--bb-radius);
    color: #fff;
    margin-bottom: 24px;
}

.bb-rfq-schoolbar-main {
    display: flex;
    align-items: center;
    gap: 18px;
    min-width: 0;
}

.bb-rfq-school-logo {
    flex: 0 0 auto;
    width: 64px;
    height: 64px;
    border-radius: 12px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 6px;
}
.bb-rfq-school-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.bb-rfq-school-meta { display: flex; flex-direction: column; min-width: 0; }
.bb-rfq-eyebrow {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 700;
    opacity: .8;
}
.bb-rfq-school-name {
    font-size: clamp(20px, 3vw, 28px);
    font-weight: 800;
    line-height: 1.15;
    margin: 2px 0;
}
.bb-rfq-school-sub { font-size: 13px; opacity: .8; }

.bb-rfq-supplied {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}
.bb-rfq-supplied-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: .7;
}
.bb-rfq-supplied img {
    height: 32px;
    width: auto;
    background: #fff;
    padding: 4px 8px;
    border-radius: 6px;
}

/* ── Instruction ────────────────────────────────────────────────── */
.bb-rfq-instruction {
    font-size: 15px;
    color: var(--bb-muted);
    margin: 0 0 20px;
}

/* ── Groups ─────────────────────────────────────────────────────── */
.bb-rfq-group {
    background: #fff;
    border: 1px solid var(--bb-line);
    border-radius: var(--bb-radius);
    box-shadow: var(--bb-shadow);
    margin-bottom: 20px;
    overflow: hidden;
}

.bb-rfq-group-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 20px;
    background: var(--bb-bg-soft);
    border-bottom: 1px solid var(--bb-line);
}
.bb-rfq-group-title {
    margin: 0;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--bb-primary);
}
.bb-rfq-group-count {
    font-size: 12px;
    color: var(--bb-muted);
    background: #fff;
    border: 1px solid var(--bb-line);
    padding: 3px 10px;
    border-radius: 999px;
}

/* ── Item rows ──────────────────────────────────────────────────── */
.bb-rfq-item {
    display: grid;
    grid-template-columns: 56px 1fr auto auto;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--bb-line);
    transition: background .15s ease;
}

/* Book cover thumbnail */
.bb-rfq-item-thumb {
    width: 56px;
    height: 72px;
    flex: 0 0 auto;
    border: 1px solid var(--bb-line);
    border-radius: 6px;
    overflow: hidden;
    background: var(--bb-bg-soft);
    display: flex;
    align-items: center;
    justify-content: center;
}
.bb-rfq-item-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.bb-rfq-item:last-child { border-bottom: none; }
.bb-rfq-item.is-selected { background: #f7f7ff; }
.bb-rfq-item.is-oos { opacity: .55; }

.bb-rfq-item-info { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.bb-rfq-item-name { font-size: 15px; font-weight: 600; line-height: 1.35; }
.bb-rfq-item-tags { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.bb-rfq-isbn {
    font-size: 12px;
    color: var(--bb-muted);
    font-variant-numeric: tabular-nums;
    background: var(--bb-bg-soft);
    border: 1px solid var(--bb-line);
    padding: 2px 8px;
    border-radius: 6px;
}
.bb-rfq-isbn-key { font-weight: 700; color: var(--bb-ink); letter-spacing: .5px; }

.bb-rfq-oos {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: #b32d2e;
}

.bb-rfq-item-price {
    font-size: 15px;
    font-weight: 700;
    color: var(--bb-ink);
    white-space: nowrap;
    text-align: right;
    min-width: 80px;
}

/* ── Quantity stepper ───────────────────────────────────────────── */
.bb-rfq-qty {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--bb-line);
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
}
.bb-rfq-qty-btn {
    width: 38px;
    height: 40px;
    border: none;
    background: var(--bb-bg-soft);
    color: var(--bb-primary);
    font-size: 20px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: background .12s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}
.bb-rfq-qty-btn:hover:not(:disabled) { background: #e9e9fb; }
.bb-rfq-qty-btn:disabled { cursor: not-allowed; opacity: .5; }
.bb-rfq-qty-input {
    width: 48px;
    height: 40px;
    border: none;
    border-left: 1px solid var(--bb-line);
    border-right: 1px solid var(--bb-line);
    text-align: center;
    font-size: 15px;
    font-weight: 700;
    -moz-appearance: textfield;
    background: #fff;
    color: var(--bb-ink);
}
.bb-rfq-qty-input::-webkit-outer-spin-button,
.bb-rfq-qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.bb-rfq-qty-input:focus { outline: 2px solid var(--bb-primary); outline-offset: -2px; }

/* ── Action bar ─────────────────────────────────────────────────── */
.bb-rfq-actionbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 24px;
    background: #fff;
    border: 1px solid var(--bb-line);
    border-radius: var(--bb-radius);
    box-shadow: var(--bb-shadow);
    margin-top: 24px;
    position: sticky;
    bottom: 16px;
    z-index: 20;
}
.bb-rfq-summary { display: flex; flex-direction: column; }
.bb-rfq-summary-count { font-size: 13px; color: var(--bb-muted); }
.bb-rfq-summary-total { font-size: 22px; font-weight: 800; color: var(--bb-primary); }

.bb-rfq-cta {
    background: var(--bb-primary);
    color: #fff !important;
    border: none;
    border-radius: 10px;
    padding: 14px 28px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: transform .08s ease, background .15s ease, box-shadow .15s ease;
    box-shadow: 0 6px 16px rgba(5,4,170,.25);
}
.bb-rfq-cta:hover { background: var(--bb-primary-dark); transform: translateY(-1px); }
.bb-rfq-cta:active { transform: translateY(0); }

.bb-rfq-validation {
    margin: 12px 0 0;
    color: #b32d2e;
    font-weight: 600;
    text-align: center;
}

/* ── Mobile ─────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .bb-rfq-schoolbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
        padding: 20px;
    }
    .bb-rfq-supplied { flex-direction: row; align-items: center; }

    .bb-rfq-item {
        grid-template-columns: 48px 1fr auto;
        grid-template-areas:
            "thumb info  price"
            "qty   qty   qty";
        gap: 10px 12px;
    }
    .bb-rfq-item-thumb { grid-area: thumb; width: 48px; height: 62px; }
    .bb-rfq-item-info  { grid-area: info; }
    .bb-rfq-item-price { grid-area: price; }
    .bb-rfq-qty { grid-area: qty; width: 100%; justify-content: space-between; }
    .bb-rfq-qty-input { flex: 1; width: auto; }
    .bb-rfq-qty-btn { width: 25%; }

    .bb-rfq-actionbar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        position: sticky;
        bottom: 0;
        border-radius: var(--bb-radius) var(--bb-radius) 0 0;
    }
    .bb-rfq-summary { flex-direction: row; align-items: baseline; justify-content: space-between; }
    .bb-rfq-cta { width: 100%; }
}

/* ── Single-page: contact details, warning, errors, confirmation ─────────── */
.bb-rfq-details {
    border: 1px solid var(--bb-line);
    border-radius: var(--bb-radius);
    background: #fff;
    box-shadow: var(--bb-shadow);
    padding: 20px 22px;
    margin-top: 24px;
}
.bb-rfq-details legend {
    font-size: 15px;
    font-weight: 800;
    color: var(--bb-ink);
    padding: 0 8px;
}
.bb-rfq-field-row { display: flex; gap: 16px; }
.bb-rfq-field-row .bb-rfq-field { flex: 1; }
.bb-rfq-field { margin: 0 0 14px; display: flex; flex-direction: column; }
.bb-rfq-field label { font-size: 13px; font-weight: 600; color: var(--bb-ink); margin-bottom: 5px; }
.bb-rfq-field .req { color: #b32d2e; }
.bb-rfq-field input,
.bb-rfq-field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--bb-line);
    border-radius: 8px;
    font-size: 15px;
    background: #fff;
    color: var(--bb-ink);
}
.bb-rfq-field input:focus,
.bb-rfq-field textarea:focus { outline: 2px solid var(--bb-primary); outline-offset: -1px; border-color: var(--bb-primary); }
.bb-rfq-hint { font-size: 12px; color: var(--bb-muted); margin-top: 4px; }
.bb-rfq-field-coupon { max-width: 260px; }

.bb-rfq-warning {
    color: #c00;
    font-weight: 700;
    font-size: 13px;
    text-align: center;
    margin: 18px 0 0;
}

.bb-rfq-errors {
    background: #fdecea;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
}
.bb-rfq-errors p { margin: 0; color: #b32d2e; font-weight: 600; }

.bb-rfq-confirm {
    text-align: center;
    background: #fff;
    border: 1px solid var(--bb-line);
    border-radius: var(--bb-radius);
    box-shadow: var(--bb-shadow);
    padding: 48px 28px;
    max-width: 560px;
    margin: 24px auto;
}
.bb-rfq-confirm-icon {
    width: 64px; height: 64px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: var(--bb-primary);
    color: #fff;
    font-size: 34px;
    line-height: 64px;
}
.bb-rfq-confirm h3 { font-size: 22px; font-weight: 800; color: var(--bb-ink); margin: 0 0 8px; }
.bb-rfq-confirm p { color: var(--bb-muted); font-size: 15px; margin: 0 0 20px; }
.bb-rfq-confirm .bb-rfq-cta { display: inline-block; text-decoration: none; }

@media (max-width: 600px) {
    .bb-rfq-field-row { flex-direction: column; gap: 0; }
}

/* ── Bottom-of-page quote summary table ─────────────────────────────────── */
.bb-rfq-quote-summary {
    margin-top: 24px;
    background: #fff;
    border: 1px solid var(--bb-line);
    border-radius: var(--bb-radius);
    box-shadow: var(--bb-shadow);
    padding: 20px 22px;
}
.bb-rfq-quote-summary-title {
    margin: 0 0 12px;
    font-size: 16px;
    font-weight: 800;
    color: var(--bb-ink);
}
.bb-rfq-summary-empty { margin: 0; color: var(--bb-muted); font-size: 14px; }
.bb-rfq-summary-tbl { width: 100%; border-collapse: collapse; }
.bb-rfq-summary-tbl th,
.bb-rfq-summary-tbl td {
    padding: 10px 8px;
    text-align: left;
    border-bottom: 1px solid var(--bb-line);
    font-size: 14px;
    vertical-align: top;
}
.bb-rfq-summary-tbl thead th {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--bb-muted);
    border-bottom: 2px solid var(--bb-line);
}
.bb-rfq-summary-tbl .num { text-align: right; white-space: nowrap; }
.bb-rfq-summary-tbl .bb-sum-item { font-weight: 600; color: var(--bb-ink); }
.bb-rfq-summary-tbl .bb-sum-isbn { display: block; font-size: 12px; font-weight: 400; color: var(--bb-muted); margin-top: 2px; }
/* Group heading inside the summary — mirrors how the quote itself is grouped, so a
   title set for two grades reads clearly under each. */
.bb-rfq-summary-tbl .bb-sum-group td {
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--bb-primary);
    background: var(--bb-tint, #f5f6ff);
    padding-top: 10px;
    padding-bottom: 10px;
}
.bb-rfq-summary-tbl tfoot td { border-bottom: none; border-top: 2px solid var(--bb-line); padding-top: 12px; font-size: 15px; }
.bb-rfq-summary-tbl tfoot .bb-rfq-summary-grand { color: var(--bb-primary); }

@media (max-width: 600px) {
    .bb-rfq-summary-tbl th:nth-child(3),
    .bb-rfq-summary-tbl td:nth-child(3) { display: none; } /* hide unit price on small screens */
}

/* ── School accounts: Save List button + saved notice ───────────────────── */
.bb-rfq-save {
    background: #fff;
    color: var(--bb-primary) !important;
    border: 2px solid var(--bb-primary);
    border-radius: 10px;
    padding: 12px 22px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    margin-right: 10px;
    transition: background .12s ease;
}
.bb-rfq-save:hover { background: #eef0ff; }
.bb-rfq-saved {
    background: #e9f8ee;
    border: 1px solid #b6e6c6;
    color: #1c7a3f;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
    font-weight: 600;
}
@media (max-width: 600px) {
    .bb-rfq-save { margin-right: 0; width: 100%; }
}

/* Two-line role instruction */
.bb-rfq-instruction p { margin: 0 0 6px; }
.bb-rfq-instruction p:last-child { margin-bottom: 0; }

/* ── Voucher apply (AJAX) ────────────────────────────────────────────────── */
.bb-rfq-field-coupon { max-width: 400px; }
.bb-rfq-coupon-row { display: flex; gap: 8px; }
.bb-rfq-coupon-row input { flex: 1; }
.bb-rfq-coupon-apply {
    flex: 0 0 auto;
    background: var(--bb-primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0 20px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background .12s ease;
}
.bb-rfq-coupon-apply:hover:not(:disabled) { background: var(--bb-primary-dark); }
.bb-rfq-coupon-apply:disabled { opacity: .6; cursor: default; }
.bb-rfq-coupon-msg { display: block; margin-top: 6px; font-size: 13px; font-weight: 600; }
.bb-rfq-coupon-msg.bb-ok { color: #1c7a3f; }
.bb-rfq-coupon-msg.bb-err { color: #b32d2e; }
.bb-rfq-summary-tbl tfoot .bb-sum-disc td { color: #b32d2e; }
