@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=swap');

/*
 * Quick Order by Thekeyz — V1 visual restoration / V2 functional contract
 *
 * DESIGN SOURCE:
 *   V1 popup.css = visual reference
 *
 * FUNCTIONAL SOURCE:
 *   V2 popup.js = DOM/data contract
 *
 * Scope:
 *   Popup styles are isolated under #qobt-overlay.
 *   Product-page CTA is scoped to .qobt-product-page-button.
 */

/* -------------------------------------------------------------------------- */
/* 0. Local design tokens                                                     */
/* -------------------------------------------------------------------------- */
#qobt-overlay.qobt-overlay {
    --qobt-white: #ffffff;
    --qobt-black: #1a1a1a;
    --qobt-text: #1a1a1a;
    --qobt-label: #374151;
    --qobt-muted: #6b7280;
    --qobt-placeholder: #9ca3af;
    --qobt-line: #e5e7eb;
    --qobt-success: #10b981;
    --qobt-danger: #ef4444;
    --qobt-danger-soft: #fff5f5;
    --qobt-font: 'Poppins', sans-serif;
    --qobt-radius: 8px;
    --qobt-gap: 12px;
}

/* -------------------------------------------------------------------------- */
/* 1. Overlay / modal                                                         */
/* -------------------------------------------------------------------------- */
.qobt-hidden {
    display: none !important;
}

#qobt-overlay.qobt-overlay {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 20px;
    box-sizing: border-box;
    background-color: rgba(0, 0, 0, 0.65);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999999;
    opacity: 1;
    font-family: var(--qobt-font);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#qobt-overlay.qobt-overlay.qobt-hidden {
    display: none !important;
}

.qobt-modal {
    position: relative;
    width: 480px;
    max-width: 100%;
    max-height: 90vh;
    overflow: hidden;
    box-sizing: border-box;
    padding: 28px;
    background-color: var(--qobt-white);
    border-radius: var(--qobt-radius);
    color: var(--qobt-text);
    transform: translateY(0);
}

.qobt-modal-body {
    width: 100%;
    max-height: calc(90vh - 56px);
    /* V3.2: allow the qty badge (top:-6px above the thumbnail) and the
       stepper (right:-54px to align with ×) to overflow visibly.
       The badge must emerge fully from the thumbnail corner, and the
       stepper must extend right to align with the close button.
       Modal still has overflow:hidden which clips at modal bounds. */
    overflow: visible;
    box-sizing: border-box;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

/* -------------------------------------------------------------------------- */
/* 2. Close                                                                   */
/* -------------------------------------------------------------------------- */
.qobt-close {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 5;
    width: 30px;
    height: 30px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background-color: #f3f4f6;
    color: var(--qobt-black);
    font-family: Arial, sans-serif;
    font-size: 24px;
    font-weight: 700;
    line-height: 30px;
    text-align: center;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    appearance: none;
}

.qobt-close:hover {
    background-color: #f0f0f0;
    color: var(--qobt-black);
}

.qobt-close:focus {
    outline: 2px solid var(--qobt-black);
    outline-offset: 2px;
}

/* -------------------------------------------------------------------------- */
/* 3. Product summary                                                         */
/* -------------------------------------------------------------------------- */
.qobt-product {
    display: grid;
    grid-template-columns: 80px minmax(0, 1fr);
    column-gap: var(--qobt-gap);
    align-items: center;
    width: 100%;
    min-height: 80px;
    margin: 0;
    padding: 0 42px 0 0;
    box-sizing: border-box;
}

.qobt-product-thumbnail {
    position: relative;
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    /* no overflow:hidden — the qty badge must overflow above the thumbnail */
}

.qobt-product-image {
    display: block;
    width: 80px;
    height: 80px;
    margin: 0;
    padding: 0;
    object-fit: cover;
    border: 1px solid var(--qobt-line);
    border-radius: var(--qobt-radius);
    box-sizing: border-box;
}

.qobt-qty-badge {
    position: absolute;
    top: -6px;
    left: -6px;
    z-index: 2;
    width: 24px;
    height: 24px;
    padding: 0;
    border: 2px solid var(--qobt-white);
    border-radius: 50%;
    background-color: var(--qobt-muted);
    color: var(--qobt-white);
    font-family: var(--qobt-font);
    font-size: 12px;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.qobt-product-info {
    position: relative;
    min-width: 0;
    height: 80px;
    box-sizing: border-box;
}

/* meta is just a structural wrapper — its children are positioned
   absolutely within .qobt-product-info to match the V3.1 hierarchy:
   name at top, prices at median (40px), stepper at bottom-right. */
.qobt-product-meta {
    display: contents;
}

.qobt-product-name {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 24px;
    line-height: 24px;
    margin: 0;
    padding: 0;
    color: var(--qobt-black);
    font-family: var(--qobt-font);
    font-size: 16px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    /* name has top priority; never collides with × button */
}

.qobt-product-prices {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    min-width: 0;
    display: flex;
    align-items: baseline;
    gap: 7px;
    flex-wrap: nowrap;
    overflow: hidden;
    /* keep both prices on one line; let regular price shrink rather
       than overlap the current price on tight viewports */
}

.qobt-product-price {
    flex: 0 1 auto;
    min-width: 0;
    color: var(--qobt-black);
    font-family: var(--qobt-font);
    font-size: 18px;
    font-weight: 700;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.qobt-product-regular {
    flex: 0 1 auto;
    min-width: 0;
    color: var(--qobt-placeholder);
    font-family: var(--qobt-font);
    font-size: 11px;
    font-weight: 400;
    line-height: 1.15;
    text-decoration: line-through;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.qobt-product-regular:empty,
.qobt-product-regular[style*="display: none"] {
    display: none !important;
}

/* -------------------------------------------------------------------------- */
/* 4. Quantity stepper — V2 input, compact V1-style circles                  */
/* -------------------------------------------------------------------------- */
/* Layout: [−]  [1]  [+]
   − and + are small circles; 1 is the small central value.
   No big rectangular frame. Aligned to the right of the summary,
   with '+' right edge aligned to the × button (right: 16px of modal). */
.qobt-stepper {
    /* V3.4 micro polish — same V3.3 visual identity (28px-tall light
       gray pill, no border, no shadow, no gradient, no SaaS effect).
       Sits at the BOTTOM of .qobt-product-info (bottom:0 — NO
       vertical movement per V3.4 spec).
       V3.4: right:-50px moves the stepper horizontally so the +
       button center sits EXACTLY on the × close button vertical
       axis. Math: × center x = modal_right − 31px (from right:16
       + width:30 / 2). Product-info right = modal_right − 70px.
       So stepper right edge must be at modal_right − 20px → with
       flex-end, + right edge = stepper right edge → + center at
       modal_right − 31px = × center. Stepper right value:
       (modal_right − 70) − (modal_right − 20) = −50px.
       Once aligned, the + is LOCKED here and never moves again;
       any further widening happens only via .qobt-qty width
       (which pushes the − to the LEFT, not the +). */
    position: absolute;
    bottom: 0;
    right: -50px;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0;
    width: auto;
    height: 28px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 14px;
    background-color: #f3f4f6;
    box-sizing: border-box;
}

.qobt-step {
    /* Small BLACK circle with WHITE sign — V1 visual, V2 click semantics */
    width: 22px;
    height: 22px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background-color: var(--qobt-black);
    color: var(--qobt-white);
    font-family: var(--qobt-font);
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    appearance: none;
    box-shadow: none;
    box-sizing: border-box;
}

.qobt-step:hover:not(:disabled) {
    background-color: #333333;
    color: var(--qobt-white);
}

.qobt-step:focus {
    outline: none;
}

.qobt-step:focus-visible {
    outline: 2px solid var(--qobt-black);
    outline-offset: 2px;
}

.qobt-step:disabled {
    background-color: #9ca3af;
    color: var(--qobt-white);
    cursor: not-allowed;
}

.qobt-qty {
    /* Small central value — kept as a numeric input so V2 QuantityManager
       logic (data-qty, input/change/set) is unchanged. Centered within
       the 28px-tall gray pill, no visible "form field" appearance.
       V3.4: width stretched from 22px to 69px so the desktop pill
       total (22 + 69 + 22 = 113px ≈ 3cm at 96 DPI) reaches the PC
       target. The extra width pushes ONLY the − to the LEFT — the
       + stays locked at its locked position (right edge at
       modal_right − 20px, center at modal_right − 31px aligned
       with the × vertical axis) because .qobt-stepper uses
       display:inline-flex with justify-content:flex-end. All
       identity preserved: height 28px, transparent bg, no border,
       Poppins 700 14px, center-aligned text. */
    width: 69px;
    height: 28px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    outline: 0;
    background: transparent;
    color: var(--qobt-black);
    font-family: var(--qobt-font);
    font-size: 14px;
    font-weight: 700;
    line-height: 28px;
    text-align: center;
    box-sizing: border-box;
    -moz-appearance: textfield;
    appearance: textfield;
}

.qobt-qty::-webkit-outer-spin-button,
.qobt-qty::-webkit-inner-spin-button {
    margin: 0;
    -webkit-appearance: none;
}

/* -------------------------------------------------------------------------- */
/* 5. Divider / variations                                                    */
/* -------------------------------------------------------------------------- */
.qobt-divider {
    width: 100%;
    height: 0;
    margin: 16px 0;
    border-top: 1px solid var(--qobt-line);
    box-sizing: border-box;
}

.qobt-variations {
    width: 100%;
    margin: 14px 0 0;
    padding: 0;
    box-sizing: border-box;
}

.qobt-variations[hidden] {
    display: none !important;
}

.qobt-variations-list {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    width: 100%;
    margin: 0;
    padding: 2px 1px 4px;
    box-sizing: border-box;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.qobt-variations-list::-webkit-scrollbar {
    display: none;
}

.qobt-variation-chip {
    position: relative;
    flex: 0 0 auto;
    min-height: 34px;
    margin: 0;
    padding: 7px 12px 7px 28px;
    border: 1.5px solid var(--qobt-line);
    border-radius: var(--qobt-radius);
    background: var(--qobt-white);
    color: var(--qobt-label);
    font-family: var(--qobt-font);
    font-size: 12px;
    font-weight: 400;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
    appearance: none;
    box-shadow: none;
}

.qobt-variation-chip::before {
    content: '';
    position: absolute;
    left: 9px;
    top: 50%;
    width: 11px;
    height: 11px;
    margin-top: -6px;
    border: 1.5px solid #9ca3af;
    border-radius: 50%;
    background: var(--qobt-white);
    box-sizing: border-box;
}

.qobt-variation-chip:hover:not(.is-out-of-stock):not(.is-selected) {
    border-color: var(--qobt-black);
}

.qobt-variation-chip.is-selected {
    border-color: var(--qobt-black);
    background: var(--qobt-white);
    color: var(--qobt-black);
    font-weight: 700;
}

.qobt-variation-chip.is-selected::before {
    border-color: var(--qobt-black);
    background: var(--qobt-black);
    box-shadow: inset 0 0 0 3px var(--qobt-white);
}

.qobt-variation-chip.is-out-of-stock {
    border-color: #eeeeee;
    background: #f8f8f8;
    color: var(--qobt-placeholder);
    text-decoration: line-through;
    cursor: not-allowed;
}

.qobt-variation-chip:focus {
    outline: none;
}

.qobt-variation-chip:focus-visible {
    outline: 2px solid var(--qobt-black);
    outline-offset: 2px;
}

/* -------------------------------------------------------------------------- */
/* 6. Form                                                                    */
/* -------------------------------------------------------------------------- */
.qobt-form {
    width: 100%;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.qobt-row {
    display: flex;
    gap: 12px;
    width: 100%;
    margin: 0 0 16px;
    box-sizing: border-box;
}

.qobt-row-50 {
    grid-template-columns: none;
}

.qobt-field {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-width: 0;
    margin: 0 0 16px;
    padding: 0;
    box-sizing: border-box;
    position: relative;
}

.qobt-row .qobt-field {
    flex: 1 1 0;
    margin-bottom: 0;
}

.qobt-field-label {
    display: block;
    margin: 0 0 8px;
    padding: 0;
    color: var(--qobt-label);
    font-family: var(--qobt-font);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
}

/* Required-field red asterisk — purely visual, does not modify the
   dynamic label text injected via [data-label]. Targets the four
   required fields specified by V2 contract. */
.qobt-field-label[data-label="first_name"]::after,
.qobt-field-label[data-label="last_name"]::after,
.qobt-field-label[data-label="phone"]::after,
.qobt-field-label[data-label="city"]::after,
.qobt-checkbox-text::after {
    /* V3.3: visual indicator for the required availability checkbox.
       Mirrors the same red asterisk style as the four required text
       fields so the visual contract stays consistent. No DOM/JS
       change — purely a CSS pseudo-element on the existing span
       injected via [data-label="checkbox_text"]. */
    content: " *";
    color: var(--qobt-danger);
    font-weight: 700;
    margin-left: 1px;
}

.qobt-field input {
    display: block;
    width: 100%;
    height: auto;
    min-height: 43px;
    margin: 0;
    padding: 10px 12px;
    border: 1.5px solid var(--qobt-line);
    border-radius: var(--qobt-radius);
    outline: none;
    background: var(--qobt-white);
    color: var(--qobt-black);
    font-family: var(--qobt-font);
    font-size: 14px;
    font-weight: 400;
    line-height: 1.35;
    box-sizing: border-box;
    appearance: none;
    box-shadow: none;
}

.qobt-field input::placeholder {
    color: var(--qobt-placeholder);
    font-family: var(--qobt-font);
    font-size: 14px;
    font-weight: 400;
    opacity: 1;
}

.qobt-field input:hover {
    border-color: #d6d9df;
}

.qobt-field input:focus {
    border-color: var(--qobt-black);
    box-shadow: none;
}

.qobt-field.is-valid input {
    border-color: var(--qobt-success);
}

.qobt-field.is-invalid input {
    border-color: var(--qobt-danger);
    background: var(--qobt-danger-soft);
}

/* -------------------------------------------------------------------------- */
/* 7. Availability checkbox                                                    */
/* -------------------------------------------------------------------------- */
.qobt-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    width: 100%;
    margin: 0 0 16px;
    padding: 0;
    color: var(--qobt-black);
    font-family: var(--qobt-font);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.35;
    cursor: pointer;
    box-sizing: border-box;
}

.qobt-checkbox input {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    margin: 2px 0 0;
    padding: 0;
    accent-color: var(--qobt-black);
    cursor: pointer;
}

.qobt-checkbox-text {
    display: block;
    min-width: 0;
}

/* -------------------------------------------------------------------------- */
/* 8. Warning                                                                 */
/* -------------------------------------------------------------------------- */
.qobt-warning {
    width: 100%;
    margin: 0 0 16px;
    padding: 0;
    color: var(--qobt-danger);
    background: transparent !important;
    border: 0 !important;
    border-radius: 0;
    box-shadow: none;
    font-family: var(--qobt-font);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
    text-align: center;
    box-sizing: border-box;
}

/* display:none ONLY when the warning text is actually empty. */
.qobt-warning:empty {
    display: none;
}

/* -------------------------------------------------------------------------- */
/* 9. Confirmation CTA                                                        */
/* -------------------------------------------------------------------------- */
.qobt-submit {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 50px;
    margin: 0;
    padding: 14px 16px;
    border: 0;
    border-radius: var(--qobt-radius);
    background: var(--qobt-black);
    color: var(--qobt-white);
    font-family: var(--qobt-font);
    font-size: 16px;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    cursor: pointer;
    box-sizing: border-box;
    appearance: none;
    box-shadow: none;
}

.qobt-submit:hover:not(:disabled) {
    background: #333333;
    color: var(--qobt-white);
}

.qobt-submit:focus {
    outline: none;
}

.qobt-submit:focus-visible {
    outline: 2px solid var(--qobt-black);
    outline-offset: 2px;
}

.qobt-submit:disabled {
    background: #9ca3af;
    color: var(--qobt-white);
    cursor: progress;
}

.qobt-spinner {
    display: none;
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-top-color: var(--qobt-white);
    border-radius: 50%;
    box-sizing: border-box;
    animation: qobt-spin 700ms linear infinite;
}

.qobt-submit.is-loading .qobt-spinner {
    display: inline-block;
}

@keyframes qobt-spin {
    to { transform: rotate(360deg); }
}

/* -------------------------------------------------------------------------- */
/* 10. Product-page "Commander maintenant" CTA                               */
/* -------------------------------------------------------------------------- */
body .qobt-product-page-button {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    min-height: 46px !important;
    height: auto !important;
    margin: 10px 0 0 !important;
    padding: 12px 16px !important;
    box-sizing: border-box !important;
    border: 0 !important;
    border-radius: 8px !important;
    background: #1a1a1a !important;
    color: #ffffff !important;
    font-family: 'Poppins', sans-serif !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
    text-align: center !important;
    text-decoration: none !important;
    cursor: pointer !important;
    box-shadow: none !important;
    appearance: none !important;
}

body .qobt-product-page-button:hover,
body .qobt-product-page-button:focus {
    background: #333333 !important;
    color: #ffffff !important;
}

body .qobt-product-page-button:focus {
    outline: 2px solid #1a1a1a !important;
    outline-offset: 2px !important;
}

/* -------------------------------------------------------------------------- */
/* 11. Mobile                                                                 */
/* -------------------------------------------------------------------------- */
@media (max-width: 767px) {
    #qobt-overlay.qobt-overlay {
        padding: 20px;
    }

    .qobt-modal {
        width: 100%;
        max-width: 360px;
        max-height: 90vh;
        padding: 20px;
    }

    .qobt-modal-body {
        max-height: calc(90vh - 40px);
    }

    .qobt-product {
        grid-template-columns: 80px minmax(0, 1fr);
        column-gap: 12px;
        padding-right: 38px;
    }

    .qobt-product-info,
    .qobt-product-thumbnail,
    .qobt-product-image {
        height: 80px;
    }

    .qobt-product-thumbnail,
    .qobt-product-image {
        width: 80px;
    }

    .qobt-product-name {
        font-size: 15px;
    }

    .qobt-product-price {
        font-size: 17px;
    }

    .qobt-product-regular {
        font-size: 10px;
    }

    /* V3.4.1 mobile stepper — + still horizontally aligned with ×
       column (right:-38px puts + center at modal_right − 31px,
       unchanged from V3.4). NO vertical movement: bottom:0
       inherited from desktop base rule.
       V3.4.1: qty widened from 24px to 40px so the pill total
       (22 + 40 + 22 = 84px ≈ 2.2cm at 96 DPI) reaches the new
       mobile target. The +16px extra width pushes ONLY the − to
       the LEFT (flex-end anchors + to stepper right edge, which
       is fixed by right:-38px). Height / background / radius /
       circles / all identity unchanged. Desktop NOT touched
       (V3.4 PC stretch already validated). */
    .qobt-stepper {
        right: -38px;
    }

    .qobt-qty {
        width: 40px;
    }

    /* Mobile: enforce one-line layout for prices, never overlap.
       Regular price can shrink/truncate; current price stays readable. */
    .qobt-product-prices {
        flex-wrap: nowrap;
    }

    .qobt-product-price {
        flex-shrink: 0;
    }

    .qobt-product-regular {
        flex-shrink: 1;
        min-width: 0;
    }

    .qobt-field-label,
    .qobt-field input,
    .qobt-field input::placeholder {
        font-size: 13px;
    }

    .qobt-field input {
        min-height: 41px;
        padding: 9px 11px;
    }

    .qobt-checkbox {
        font-size: 13px;
    }

    .qobt-warning {
        font-size: 12px;
    }

    .qobt-submit {
        min-height: 46px;
        padding: 13px 14px;
        font-size: 15px;
    }
}

@media (max-width: 380px) {
    #qobt-overlay.qobt-overlay {
        padding: 12px;
    }

    .qobt-modal {
        max-width: 360px;
        padding: 18px;
    }

    .qobt-modal-body {
        max-height: calc(90vh - 36px);
    }

    .qobt-product {
        grid-template-columns: 80px minmax(0, 1fr);
        column-gap: 10px;
        padding-right: 36px;
    }

    .qobt-product-thumbnail,
    .qobt-product-image {
        width: 80px;
        height: 80px;
    }

    .qobt-product-info {
        width: auto;
        height: 80px;
    }

    .qobt-product-name {
        font-size: 14px;
    }

    .qobt-product-price {
        font-size: 16px;
    }

    .qobt-product-regular {
        font-size: 10px;
    }

    /* V3.1 stepper keeps its compact 24px circles on very small screens.
       No override here — the base stepper already fits within ~80px. */
}

/* -------------------------------------------------------------------------- */
/* 12. Reduced motion                                                         */
/* -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .qobt-spinner {
        animation: none;
    }
}

/* ---- Cart mode (popup opened from the validated cart) ---- */
/* Compiled product names stay on one line and end with an ellipsis instead of wrapping. */
.qobt-mode-cart .qobt-product-info { min-width: 0; }
.qobt-mode-cart .qobt-product-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* Frozen stepper: it only displays the article count. */
.qobt-mode-cart .qobt-stepper { opacity: .6; }
.qobt-mode-cart .qobt-qty,
.qobt-mode-cart .qobt-step { pointer-events: none; }
