/**
 * ==========================================================================
 * QUICK-SHOP MODAL v2 — Warm Analogous v3
 * ==========================================================================
 * All design tokens inherited from global.css (:root variables).
 * ==========================================================================
 */

/* Scroll lock — reinforced so Astra can't override */
body.hp-qs-locked {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    height: 100% !important;
}

/* Overlay — highest z-index, no competing layers */
.hp-qs-overlay { position: fixed; inset: 0; z-index: 999999; background: rgba(0,0,0,0.65); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; opacity: 0; visibility: hidden; transition: opacity 0.3s ease, visibility 0.3s ease; padding: 20px; isolation: isolate; }
.hp-qs-overlay.is-open { opacity: 1; visibility: visible; }

/* Modal */
.hp-qs { background: var(--color-card); border-radius: var(--radius-lg); width: 100%; max-width: 500px; max-height: 90vh; overflow-y: auto; position: relative; transform: translateY(20px) scale(0.96); transition: transform 0.3s ease; box-shadow: var(--shadow-modal); }
.hp-qs-overlay.is-open .hp-qs { transform: translateY(0) scale(1); }
.hp-qs::-webkit-scrollbar { width: 4px; }
.hp-qs::-webkit-scrollbar-track { background: transparent; }
.hp-qs::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 4px; }

/* Close — CSS-only X (no SVG dependency, Astra-proof) */
.hp-qs__close { position: absolute; top: var(--space-md); right: var(--space-md); z-index: 10; width: 36px; height: 36px; border-radius: 50%; border: none; background: rgba(255,255,255,0.9); backdrop-filter: blur(4px); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s; padding: 0; margin: 0; line-height: 1; appearance: none; -webkit-appearance: none; }
.hp-qs__close:hover { background: var(--color-text-primary); }
.hp-qs__close::before,
.hp-qs__close::after { content: ''; position: absolute; width: 16px; height: 2.5px; background: var(--sunset-mid); border-radius: 2px; transition: background 0.2s; }
.hp-qs__close::before { transform: rotate(45deg); }
.hp-qs__close::after { transform: rotate(-45deg); }
.hp-qs__close:hover::before,
.hp-qs__close:hover::after { background: #fff; }
.hp-qs__close svg { display: none; }

/* Image — capped height so modal doesn't vary wildly */
.hp-qs__image { width: 100%; aspect-ratio: 3/2; max-height: 240px; background: var(--color-bg); border-radius: var(--radius-lg) var(--radius-lg) 0 0; overflow: hidden; display: flex; align-items: center; justify-content: center; position: relative; }
.hp-qs__image img { width: 100%; height: 100%; object-fit: cover; }

/* Body */
.hp-qs__body { padding: 18px 28px var(--space-lg); font-family: var(--font-heading); }

/* Badges */
.hp-qs__badges { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: var(--space-sm); }
.hp-qs__badges .hp-bdg { font-size: 10px; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase; padding: var(--space-xs) 10px; border-radius: var(--radius-md); white-space: nowrap; line-height: 1.3; }
.hp-qs__badges .hp-bdg--tier { color: #fff; }
.hp-qs__badges .hp-bdg--thca { background: #F0E8DC; color: #8A7558; border: 1px solid #E6DCCB; }
.hp-qs__badges .hp-bdg--strain-indica { background: rgba(123,107,164,0.12); color: var(--tier-rapper); }
.hp-qs__badges .hp-bdg--strain-sativa { background: rgba(204,75,75,0.12); color: #CC4B4B; }
.hp-qs__badges .hp-bdg--strain-hybrid { background: rgba(93,154,107,0.12); color: var(--tier-exotic); }

/* Name */
.hp-qs__name { font-size: 20px; font-weight: 700; color: var(--green-dark); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: var(--space-xs); line-height: 1.2; }

/* Rating */
.hp-qs__rating { display: flex; align-items: center; gap: 6px; margin-bottom: var(--space-sm); }
.hp-qs__stars { color: var(--sunset-mid); font-size: 14px; letter-spacing: 1px; }
.hp-qs__revs { font-size: 12px; color: var(--color-text-muted); }
.hp-qs__verified { font-size: 11px; font-weight: 700; color: var(--color-success); letter-spacing: 0.3px; display: inline-flex; align-items: center; gap: 3px; }
.hp-qs__verified::before { content: '\2713'; font-size: 9px; }

/* Effects */
.hp-qs__effects { display: flex; flex-wrap: wrap; gap: var(--space-xs); margin-bottom: 12px; }
.hp-qs__effect { font-size: 11px; font-weight: 600; padding: var(--space-xs) 10px; border-radius: var(--radius-full); background: var(--color-bg); color: var(--color-text-primary); border: 1px solid var(--color-border); display: flex; align-items: center; gap: 3px; }
.hp-qs__effect-emoji { font-size: 12px; }

/* Price area */
.hp-qs__price-row { display: flex; align-items: baseline; gap: 6px; margin-bottom: 2px; }
.hp-qs__price-total { font-size: 26px; font-weight: 800; color: var(--green-dark); }
.hp-qs__price-compare { font-size: 14px; font-weight: 500; color: var(--color-text-muted); text-decoration: line-through; }
.hp-qs__price-per { font-size: 12px; color: var(--color-text-muted); }
.hp-qs__price-savings { display: inline-flex; font-size: 11px; font-weight: 700; color: var(--color-success); background: rgba(88,173,114,0.08); padding: 2px var(--space-sm); border-radius: var(--radius-full); margin-bottom: 12px; }

/* Size buttons — bigger for better tap targets */
.hp-qs__sizes-label { font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--color-text-secondary); margin-bottom: var(--space-sm); }
.hp-qs__sizes { display: flex; gap: 7px; margin-bottom: var(--space-md); }
.hp-qs__size-btn { font-size: 14px; font-weight: 600; padding: 10px var(--space-sm); border-radius: var(--radius-md); border: 1.5px solid var(--color-border); background: transparent; color: var(--color-text-primary); cursor: pointer; transition: all 0.2s; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; flex: 1; position: relative; font-family: inherit; }
.hp-qs__size-btn:hover { border-color: var(--sunset-mid) !important; background: rgba(236,169,110,0.08) !important; color: var(--color-text-primary) !important; }
.hp-qs__size-btn.is-selected { background: var(--gradient-sunset) !important; color: #fff !important; border-color: var(--sunset-mid) !important; }
.hp-qs__size-weight { font-size: 14px; font-weight: 700; line-height: 1.3; }
.hp-qs__size-price { font-size: 11px; font-weight: 500; opacity: 0.7; line-height: 1.3; }

/* Tags on size buttons */
.hp-qs__size-tag { position: absolute; top: -7px; right: -2px; font-size: 8px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; padding: 1px var(--space-xs); border-radius: 4px; background: var(--sunset-mid); color: #fff; white-space: nowrap; }
.hp-qs__size-tag--value { background: var(--color-success); }

/* Qty + ATC row */
.hp-qs__action-row { display: flex; gap: var(--space-sm); align-items: stretch; margin-bottom: 12px; }
.hp-qs__qty { display: flex; align-items: center; border: 1.5px solid var(--color-border); border-radius: var(--radius-full); overflow: hidden; flex-shrink: 0; }
.hp-qs__qty-btn { width: 38px; height: 42px; border: none; background: transparent; font-size: 16px; font-weight: 600; color: var(--color-text-primary); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background 0.2s; user-select: none; font-family: inherit; }
.hp-qs__qty-btn:hover { background: var(--color-bg); }
.hp-qs__qty-val { width: 28px; text-align: center; font-size: 14px; font-weight: 700; color: var(--color-text-primary); }

/* ATC button */
.hp-qs__atc { flex: 1; font-size: 13px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; padding: 14px 22px; border-radius: var(--radius-full); border: none; background: var(--gradient-sunset); color: #fff; cursor: pointer; transition: all 0.3s; display: flex; align-items: center; justify-content: center; gap: var(--space-sm); font-family: inherit; text-shadow: 0 1px 2px rgba(0,0,0,0.1); box-shadow: var(--shadow-button); }
.hp-qs__atc:hover { background: var(--gradient-sunset-hover); transform: translateY(-1px); box-shadow: var(--shadow-button-hover); }
.hp-qs__atc.is-loading { pointer-events: none; opacity: 0.7; }

/* Trust icons */
.hp-qs__trust { display: flex; justify-content: center; gap: 20px; padding: 10px 0; margin-bottom: var(--space-sm); border-top: 1px solid var(--color-border); flex-wrap: wrap; }
.hp-qs__trust-item { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }
.hp-qs__trust-icon { width: 14px; height: 14px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.hp-qs__trust-icon svg { width: 15px; height: 15px; stroke: var(--color-text-primary); stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.hp-qs__trust-icon svg path, .hp-qs__trust-icon svg circle, .hp-qs__trust-icon svg rect, .hp-qs__trust-icon svg polygon, .hp-qs__trust-icon svg polyline, .hp-qs__trust-icon svg line { fill: none !important; }
.hp-qs__trust-label { font-size: 11px; font-weight: 600; color: var(--color-text-secondary); letter-spacing: 0.2px; line-height: 1; white-space: nowrap; }

/* Shipping nudge */
.hp-qs__shipping { padding: var(--space-sm) 12px; background: var(--color-bg); border-radius: var(--radius-md); margin-bottom: 10px; }
.hp-qs__shipping-text { font-size: 12px; font-weight: 600; color: var(--color-text-primary); text-align: center; margin-bottom: var(--space-xs); }
.hp-qs__shipping-text strong { color: var(--sunset-text); }
.hp-qs__shipping-bar { width: 100%; height: 5px; border-radius: 2px; background: var(--color-border); overflow: hidden; }
.hp-qs__shipping-fill { height: 100%; border-radius: 2px; background: var(--gradient-sunset); transition: width 0.4s ease; }
.hp-qs__shipping--done .hp-qs__shipping-text { color: var(--color-success); }
.hp-qs__shipping--done .hp-qs__shipping-text strong { color: var(--color-success); }
.hp-qs__shipping--done .hp-qs__shipping-fill { background: var(--color-success); }

/* Full product link */
.hp-qs__full-link { display: block; text-align: center; font-size: 12px; font-weight: 600; color: var(--color-text-secondary); text-decoration: none; padding-top: 10px; border-top: 1px solid var(--color-border); transition: color 0.2s; }
.hp-qs__full-link:hover { color: var(--sunset-text); }

/* Success state */
.hp-qs__success { display: none; padding: 40px 28px; text-align: center; position: relative; overflow: hidden; }
.hp-qs__success.is-visible { display: block; }
#hp-confetti-canvas { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
.hp-qs__success-icon { width: 64px; height: 64px; margin: 0 auto 20px; background: none !important; background-color: transparent !important; border: none !important; border-radius: 50%; display: flex; align-items: center; justify-content: center; position: relative; z-index: 1; box-shadow: none !important; }
.hp-qs__success-icon svg { width: 32px; height: 32px; stroke: var(--color-success); stroke-width: 2.5; fill: none !important; background: none !important; }
.hp-qs__success-icon svg path, .hp-qs__success-icon svg polyline, .hp-qs__success-icon svg circle, .hp-qs__success-icon svg rect, .hp-qs__success-icon svg line, .hp-qs__success-icon svg polygon { fill: none !important; background: none !important; }
.hp-qs__success-title { font-size: 22px; font-weight: 700; color: var(--green-dark); margin-bottom: 6px; position: relative; z-index: 1; }
.hp-qs__success-detail { font-size: 15px; color: var(--color-text-secondary); margin-bottom: var(--space-sm); line-height: 1.5; position: relative; z-index: 1; }
.hp-qs__success-saved { font-size: 14px; font-weight: 700; color: var(--color-success); margin-bottom: var(--space-lg); position: relative; z-index: 1; }
.hp-qs__success-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; position: relative; z-index: 1; }
.hp-qs__success-btns .hp-btn { font-family: var(--font-heading); font-weight: 700; letter-spacing: 0.5px; border: none; border-radius: var(--radius-full); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; transition: all .3s ease; text-decoration: none; padding: 12px 28px; }
.hp-qs__success-btns .hp-btn--primary { background: var(--gradient-sunset); color: #fff; box-shadow: var(--shadow-button); }
.hp-qs__success-btns .hp-btn--primary:hover { background: var(--gradient-sunset-hover); box-shadow: var(--shadow-button-hover); }
.hp-qs__success-btns .hp-btn--outline { background: transparent; color: var(--color-text-primary); border: 1.5px solid var(--color-border); }
.hp-qs__success-btns .hp-btn--outline:hover { border-color: var(--sunset-mid); color: var(--sunset-text); }

/* Spinner */
.hp-qs__spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff; border-radius: 50%; animation: hp-spin 0.6s linear infinite; }
@keyframes hp-spin { to { transform: rotate(360deg); } }

/* Mobile bottom sheet */
@media (max-width: 540px) {
    .hp-qs-overlay { align-items: flex-end; padding: 0; }
    .hp-qs { max-width: 100%; border-radius: var(--radius-lg) var(--radius-lg) 0 0; max-height: 95vh; transform: translateY(100%); overflow-y: auto; }
    .hp-qs-overlay.is-open .hp-qs { transform: translateY(0); }

    /* Compact image */
    .hp-qs__image { aspect-ratio: 21/9; max-height: 140px; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }

    /* Compact body */
    .hp-qs__body { padding: 10px 16px 14px; }

    /* Smaller name */
    .hp-qs__name { font-size: 15px; margin-bottom: 2px; }

    /* Tighter badges */
    .hp-qs__badges { margin-bottom: 4px; gap: 4px; }
    .hp-qs__badges .hp-bdg { font-size: 9px; padding: 2px 7px; }

    /* Tighter rating */
    .hp-qs__rating { margin-bottom: 4px; gap: 4px; }
    .hp-qs__stars { font-size: 12px; }
    .hp-qs__revs { font-size: 10px; }
    .hp-qs__verified { font-size: 10px; }

    /* Compact effects */
    .hp-qs__effects { margin-bottom: 8px; gap: 3px; }
    .hp-qs__effect { font-size: 10px; padding: 2px 7px; }

    /* Compact price */
    .hp-qs__price-total { font-size: 22px; }
    .hp-qs__price-row { margin-bottom: 1px; }
    .hp-qs__price-savings { margin-bottom: 8px; font-size: 10px; }
    .hp-qs__price-per { font-size: 11px; }

    /* Sizes label + buttons — keep button size */
    .hp-qs__sizes-label { font-size: 10px; margin-bottom: 5px; }
    .hp-qs__sizes { margin-bottom: 10px; }
    .hp-qs__size-btn { padding: var(--space-sm) 6px; border-radius: var(--radius-md); }

    /* Compact action row */
    .hp-qs__action-row { margin-bottom: 8px; }
    .hp-qs__atc { padding: 11px 16px; font-size: 12px; }
    .hp-qs__qty-btn { width: 34px; height: 38px; font-size: 15px; }

    /* Trust icons — single row, no wrapping */
    .hp-qs__trust { flex-wrap: nowrap; gap: 8px; padding: 8px 0; margin-bottom: 4px; }
    .hp-qs__trust-icon { width: 11px; height: 11px; }
    .hp-qs__trust-icon svg { width: 11px; height: 11px; }
    .hp-qs__trust-label { font-size: 10px; letter-spacing: 0; }

    /* Compact shipping */
    .hp-qs__shipping { padding: 6px 10px; margin-bottom: 6px; }
    .hp-qs__shipping-text { font-size: 11px; margin-bottom: 3px; }
    .hp-qs__shipping-bar { height: 4px; }

    /* Compact full link */
    .hp-qs__full-link { font-size: 11px; padding-top: 8px; }
}
