/**
 * Touch quick add - the + bag button and its size sheet.
 *
 * Ships with the plugin rather than living in Customizer > Additional CSS,
 * because it is component CSS that only makes sense alongside quick-add.js.
 */

/* ------------------------------------------------------------------
   1. The desktop hover overlay is meaningless without a mouse.
      iOS Safari happily fires :hover on the first tap, which would turn
      a tap-to-open-product into tap-to-reveal-then-tap-again.
   ------------------------------------------------------------------ */
@media (hover: none), (pointer: coarse) {
    .quick-size-overlay {
        display: none;
    }
}

/* ------------------------------------------------------------------
   2. The + bag button, bottom-right of the product image.
      Touch devices only - on desktop the hover overlay does this job.
   ------------------------------------------------------------------ */
.nuego-qa-btn {
    display: none;
}

@media (hover: none), (pointer: coarse) {

    .nuego-qa-btn {
        position: absolute;
        right: 8px;
        bottom: 8px;
        z-index: 11;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        margin: 0;
        padding: 0;
        border: 0;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.92);
        -webkit-backdrop-filter: blur(4px);
        backdrop-filter: blur(4px);
        box-shadow: 0 1px 5px rgba(0, 0, 0, 0.18);
        color: #141414;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        transition: transform 0.15s ease;
    }

    /* Push the tap target out to 52px without making the button look big. */
    .nuego-qa-btn::before {
        content: "";
        position: absolute;
        inset: -6px;
    }

    .nuego-qa-btn:active {
        transform: scale(0.9);
    }

    .nuego-qa-btn svg {
        display: block;
        width: 19px;
        height: 19px;
    }
}

/* ------------------------------------------------------------------
   3. The size sheet
   ------------------------------------------------------------------ */
.nuego-sheet-backdrop {
    position: fixed;
    inset: 0;
    z-index: 99998;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.nuego-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
    max-height: 82vh;
    overflow-y: auto;
    padding: 8px 16px calc(20px + env(safe-area-inset-bottom, 0px));
    border-radius: 16px 16px 0 0;
    background: #fff;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.18);
    transform: translateY(100%);
    transition: transform 0.28s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.nuego-sheet[hidden],
.nuego-sheet-backdrop[hidden] {
    display: none;
}

body.nuego-sheet-open {
    overflow: hidden;
}

body.nuego-sheet-open .nuego-sheet {
    transform: translateY(0);
}

body.nuego-sheet-open .nuego-sheet-backdrop {
    opacity: 1;
    pointer-events: auto;
}

.nuego-sheet__grabber {
    width: 36px;
    height: 4px;
    margin: 6px auto 14px;
    border-radius: 2px;
    background: #ddd;
}

.nuego-sheet__head {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 16px;
}

.nuego-sheet__thumb {
    flex: 0 0 auto;
    width: 56px;
    height: 76px;
    object-fit: cover;
    border-radius: 6px;
    background: #f4f4f4;
}

.nuego-sheet__title {
    margin: 0 0 2px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
}

.nuego-sheet__colour {
    font-size: 12px;
    color: #666;
}

.nuego-sheet__price {
    margin-top: 4px;
    font-size: 14px;
}

.nuego-sheet__price .price {
    font-size: inherit;
}

.nuego-sheet__label {
    margin-bottom: 8px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #666;
}

.nuego-sheet__sizes {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nuego-sheet__size {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 48px;
    padding: 0 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
    color: #141414;
    font-size: 14px;
    text-align: left;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.nuego-sheet__size:active {
    background: #fafafa;
}

.nuego-sheet__size[disabled] {
    border-color: #eee;
    color: #bbb;
    cursor: default;
}

.nuego-sheet__size.is-busy,
.nuego-sheet__size.is-done {
    border-color: #141414;
}

.nuego-sheet__stock {
    font-size: 11px;
    color: #999;
}

.nuego-sheet__error {
    margin-top: 12px;
    font-size: 12px;
    color: #e32c2b;
}

.nuego-sheet__error[hidden] {
    display: none;
}

/* Only ever needed where the + button is shown. */
@media (hover: hover) and (pointer: fine) {
    .nuego-sheet,
    .nuego-sheet-backdrop {
        display: none;
    }
}

/* ------------------------------------------------------------------
   4. "Complete the Look" item count, right of the heading
   ------------------------------------------------------------------ */
/* Elementor ships `.elementor-element:where(.e-con-full, .elementor-widget)
   { justify-content: var(--justify-content) }`. :where() contributes nothing to
   specificity, so that rule ties with a bare `.nuego-ctl-heading` and wins on
   order. Qualifying with .elementor-widget puts us ahead of it. */
.nuego-ctl-heading,
.elementor-widget.nuego-ctl-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
}

.nuego-ctl-count {
    flex: 0 0 auto;
    font-size: 12px;
    color: #666;
    white-space: nowrap;
}
