/* ============================================================================
   SiteHQ Stock Alerts — frontend stylesheet
   ============================================================================
   Scoped to the .shq-sa-* class prefix so we don't fight the theme.
   Brand: #5C068C purple / #fedd00 yellow, leaf-shape corner on primary CTAs.

   The OUT OF STOCK badge and NOTIFY ME button are CSS re-creations of the
   designer's SVG artwork (~/Downloads OUT OF STOCK BUTTON_RED.svg + NOTIFY ME
   BUTTON_GREY/PURPLE.svg): red #ed0000 pill w/ white uppercase text; grey
   #ededee button w/ purple bell + text, inverting to purple/white on hover.
   ============================================================================ */

:root {
    --shq-sa-primary:       #5C068C;
    --shq-sa-primary-hover: #4A0570;
    --shq-sa-primary-soft:  #f3e6fa;
    --shq-sa-warning:       #fedd00;
    --shq-sa-danger:        #ed0000;
    --shq-sa-success:       #2ca87f;
    --shq-sa-grey:          #ededee;
    --shq-sa-border:        #d8d8d8;
    --shq-sa-bg-soft:       #f7f7f7;
    --shq-sa-text:          #1f1f1f;
    --shq-sa-muted:         #666666;
}

.shq-sa-hidden { display: none !important; }

/* ============================================================================
   Product page — badge + notify button row
   ============================================================================ */
.shq-sa-root {
    margin: 10px 0 14px;
}
.shq-sa-root[hidden] { display: none !important; }

.shq-sa-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}
.shq-sa-row[hidden] { display: none !important; }

/* Variable products: the notify row renders above the title (same slot as
   simple products), so the buy controls for an out-of-stock variation must go
   — otherwise the page shows a live qty + Add to cart for something that can't
   be bought. `shq-sa-variation-oos` is set on form.variations_form by
   assets/js/stock-alerts.js on found_variation and cleared on reset_data.
   Save to List is deliberately left alone: out-of-stock items can still be
   saved, and it's the only control simple products keep. */
.variations_form.shq-sa-variation-oos .woocommerce-variation-add-to-cart > .quantity,
.variations_form.shq-sa-variation-oos .single_add_to_cart_button {
    display: none !important;
}

/* OUT OF STOCK badge — from OUT OF STOCK BUTTON_RED.svg:
   #ed0000 rounded rect (rx 11.59 at 107 tall ≈ 11%), white bold uppercase. */
.shq-sa-oos-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    background: var(--shq-sa-danger);
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    line-height: 1;
    border-radius: 5px;
    white-space: nowrap;
}

/* NOTIFY ME button — from NOTIFY ME BUTTON_GREY/PURPLE.svg:
   resting grey #ededee w/ purple bell + label; hover solid purple w/ white. */
.shq-sa-notify-btn {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 9px 18px;
    background: var(--shq-sa-grey);
    color: var(--shq-sa-primary);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    line-height: 1;
    border: 0;
    border-radius: 5px;
    cursor: pointer;
    transition: background 150ms ease-in, color 150ms ease-in;
    white-space: nowrap;
}
.shq-sa-notify-btn:hover:not(:disabled),
.shq-sa-notify-btn:focus-visible {
    background: var(--shq-sa-primary);
    color: #ffffff;
}
.shq-sa-notify-btn:disabled {
    cursor: wait;
    opacity: 0.6;
}
.shq-sa-bell {
    width: 20px;
    height: 22px;
    flex: 0 0 auto;
}

.shq-sa-detail {
    margin: 8px 0 0;
    font-size: 13px;
    color: var(--shq-sa-muted);
}

/* Subscribed state — concise inline confirmation + cancel link */
.shq-sa-subscribed {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 14px;
    background: var(--shq-sa-primary-soft);
    border-radius: 5px;
    font-size: 14px;
    color: var(--shq-sa-text);
}
.shq-sa-subscribed[hidden] { display: none !important; }
.shq-sa-subscribed__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: var(--shq-sa-success);
    color: #ffffff;
    border-radius: 50%;
    font-size: 12px;
    flex: 0 0 auto;
}
.shq-sa-subscribed__text { font-weight: 600; }
.shq-sa-cancel-link {
    background: transparent;
    border: 0;
    padding: 0;
    color: var(--shq-sa-primary);
    font-size: 13px;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}
.shq-sa-cancel-link:hover { color: var(--shq-sa-primary-hover); }
.shq-sa-cancel-link:disabled { opacity: 0.5; cursor: wait; }

/* ============================================================================
   Guest modal
   ============================================================================ */
.shq-sa-modal {
    position: fixed;
    inset: 0;
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.shq-sa-modal[hidden] { display: none !important; }
body.shq-sa-modal-open { overflow: hidden; }

.shq-sa-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
}
.shq-sa-modal__dialog {
    position: relative;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow: auto;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.3);
    padding: 30px 28px;
}
.shq-sa-modal__close {
    position: absolute;
    top: 10px;
    right: 14px;
    background: transparent;
    border: 0;
    font-size: 26px;
    line-height: 1;
    color: var(--shq-sa-muted);
    cursor: pointer;
}
.shq-sa-modal__close:hover { color: var(--shq-sa-text); }

.shq-sa-modal__view[hidden] { display: none !important; }

.shq-sa-modal__heading {
    margin: 0 0 14px;
    font-size: 28px;
    line-height: 1.1;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--shq-sa-primary);
}
.shq-sa-modal__heading--success { font-size: 24px; }
.shq-sa-modal__heading-line { display: block; white-space: nowrap; }
.shq-sa-modal__heading-link {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.shq-sa-modal__heading-link:hover { opacity: 0.85; }

.shq-sa-modal__lead {
    font-size: 15px;
    line-height: 1.45;
    color: #1a1a1a;
    margin: 0 0 18px;
}

.shq-sa-modal__product {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 0 0 16px;
    padding: 12px 14px;
    background: var(--shq-sa-bg-soft);
    border-left: 3px solid var(--shq-sa-warning);
    border-radius: 0 5px 5px 0;
}
.shq-sa-modal__product-name { font-weight: 700; }
.shq-sa-modal__product-branch { font-size: 13px; color: var(--shq-sa-muted); }
.shq-sa-modal__product-branch:not(:empty)::before { content: 'Branch: '; }

.shq-sa-modal__input {
    width: 100%;
    padding: 11px 14px;
    font-size: 15px;
    border: 1px solid var(--shq-sa-border);
    border-radius: 5px;
    margin: 0 0 14px;
}
.shq-sa-modal__input:focus {
    outline: none;
    border-color: var(--shq-sa-primary);
    box-shadow: 0 0 0 2px var(--shq-sa-primary-soft);
}

.shq-sa-modal__consent {
    margin: 0 0 14px;
    font-size: 12px;
    line-height: 1.4;
    color: var(--shq-sa-muted);
}

.shq-sa-modal__recaptcha-note {
    margin: 12px 0 0;
    font-size: 11px;
    line-height: 1.4;
    color: var(--shq-sa-muted);
}
.shq-sa-modal__recaptcha-note a {
    color: var(--shq-sa-muted);
    text-decoration: underline;
}

.shq-sa-modal__forgot {
    margin: -4px 0 12px;
    font-size: 12px;
}
.shq-sa-modal__forgot a {
    color: var(--shq-sa-primary);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.shq-sa-modal__forgot a:hover { color: var(--shq-sa-primary-hover); }

.shq-sa-modal__error {
    margin: 0 0 12px;
    font-size: 13px;
    color: var(--shq-sa-danger);
}
.shq-sa-modal__error[hidden] { display: none !important; }

.shq-sa-modal__cta-row {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}
.shq-sa-modal__cta-row--centred { justify-content: center; }

.shq-sa-modal__success-check {
    width: 52px;
    height: 52px;
    margin: 0 auto 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--shq-sa-success);
    color: #ffffff;
    border-radius: 50%;
    font-size: 26px;
}
.shq-sa-modal__view[data-shq-sa-view="success"] { text-align: center; }

/* Honeypot — visually removed, still in the a11y tree note: aria-hidden set */
.shq-sa-hp {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0);
    white-space: nowrap; border: 0;
}

/* Shared buttons (modal + account) — same family as shopping-lists */
.shq-sa-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: transparent;
    color: var(--shq-sa-text);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: background 150ms ease-in, color 150ms ease-in, border-color 150ms ease-in;
    line-height: 1.2;
    text-decoration: none;
}
.shq-sa-btn:disabled { cursor: not-allowed; opacity: 0.5; }
.shq-sa-btn--primary {
    background: var(--shq-sa-primary);
    color: #ffffff;
    border-color: var(--shq-sa-primary);
    border-bottom-right-radius: 24px 24px; /* leaf-shape corner */
}
.shq-sa-btn--primary:hover:not(:disabled) {
    background: var(--shq-sa-primary-hover);
    border-color: var(--shq-sa-primary-hover);
    color: #ffffff;
}
.shq-sa-btn--ghost {
    color: var(--shq-sa-muted);
}
.shq-sa-btn--ghost:hover:not(:disabled) {
    color: var(--shq-sa-primary);
    background: var(--shq-sa-bg-soft);
}

/* ============================================================================
   My Account — Stock Alerts tab
   ============================================================================ */
.shq-sa-account__intro {
    margin: 0 0 20px;
    color: var(--shq-sa-muted);
    font-size: 14px;
}
.shq-sa-account-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 30px;
}
.shq-sa-account-table th {
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--shq-sa-muted);
    padding: 8px 10px;
    border-bottom: 2px solid var(--shq-sa-border);
}
.shq-sa-account-table td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--shq-sa-border);
    vertical-align: middle;
    font-size: 14px;
}
.shq-sa-account-table__product {
    display: flex;
    align-items: center;
    gap: 12px;
}
.shq-sa-account-table__thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--shq-sa-border);
    flex: 0 0 auto;
}
.shq-sa-account-table__name {
    font-weight: 600;
    color: var(--shq-sa-text);
    text-decoration: none;
}
.shq-sa-account-table__name:hover { color: var(--shq-sa-primary); }
.shq-sa-account-table__meta {
    display: block;
    font-size: 12px;
    color: var(--shq-sa-muted);
    margin-top: 2px;
}
.shq-sa-account__section-title {
    margin: 26px 0 10px;
    font-size: 17px;
    font-weight: 700;
    color: var(--shq-sa-primary);
}
.shq-sa-account__muted-row td { color: var(--shq-sa-muted); }
.shq-sa-account__empty {
    padding: 26px;
    text-align: center;
    background: var(--shq-sa-bg-soft);
    border-radius: 8px;
    color: var(--shq-sa-muted);
}

/* Status badges (account + reused visually by admin) */
.shq-sa-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.shq-sa-badge--pending  { background: #fff6cc; color: #7a6400; }
.shq-sa-badge--notified { background: #e2f6ee; color: #17734f; }
.shq-sa-badge--cancelled { background: #f1f1f1; color: #777777; }

/* ============================================================================
   Mobile
   ============================================================================ */
@media (max-width: 600px) {
    .shq-sa-modal { padding: 0; align-items: flex-end; }
    .shq-sa-modal__dialog {
        max-width: 100%;
        border-radius: 12px 12px 0 0;
        padding: 24px 20px;
    }
    .shq-sa-modal__heading { font-size: 22px; }
    .shq-sa-modal__heading-line { white-space: normal; }
    .shq-sa-row { align-items: stretch; }
    .shq-sa-notify-btn { white-space: normal; text-align: left; }
    .shq-sa-account-table__thumb { width: 40px; height: 40px; }
}
