/**
 * CGML Back In Stock Companion v3.2
 *
 * Matches the CG-PDP editorial aesthetic:
 *   Warm cream background, dark forest green accents,
 *   DM Serif Display + Outfit font stack.
 */


/* ══════════════════════════════════════════════
 *  1. Hidden State
 * ══════════════════════════════════════════════ */

.cgml-bis-hidden {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}


/* ══════════════════════════════════════════════
 *  2. BIS Card Container
 * ══════════════════════════════════════════════ */

.cgml-bis-card {
    margin: 0.9rem 0;
    padding: 1.1rem 1.25rem;
    background: rgba(45, 90, 61, 0.035);
    border: 1px solid rgba(45, 90, 61, 0.12);
    border-radius: 10px;
    animation: cgmlBisFade 0.3s ease-out;
}

@keyframes cgmlBisFade {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}


/* ══════════════════════════════════════════════
 *  3. Heading & Subtext
 * ══════════════════════════════════════════════ */

.cgml-bis-heading {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 0.25rem;
    font-family: 'DM Serif Display', 'Playfair Display', Georgia, serif;
    font-size: 0.95rem;
    font-weight: 400;
    color: #1a1a1a;
    line-height: 1.35;
}

.cgml-bis-icon {
    flex-shrink: 0;
    stroke: #2d5a3d;
}

.cgml-bis-subtext {
    margin: 0 0 0.75rem;
    color: #777;
    font-family: 'Outfit', -apple-system, sans-serif;
    font-size: 0.8rem;
    line-height: 1.5;
}

.cgml-bis-subtext strong {
    color: #555;
    font-weight: 600;
}


/* ══════════════════════════════════════════════
 *  4. Form
 * ══════════════════════════════════════════════ */

.cgml-bis-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.cgml-bis-row {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}

.cgml-bis-row--loggedin {
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}


/* ══════════════════════════════════════════════
 *  5. Email Input
 * ══════════════════════════════════════════════ */

.cgml-bis-email {
    flex: 1;
    min-width: 0;
    padding: 0.65rem 0.85rem;
    background: #fff;
    border: 1px solid #d4d0c8;
    border-radius: 8px;
    color: #1a1a1a;
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 0.86rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none;
}

.cgml-bis-email::placeholder {
    color: #aaa;
}

.cgml-bis-email:focus {
    border-color: #2d5a3d;
    box-shadow: 0 0 0 3px rgba(45, 90, 61, 0.08);
}


/* ══════════════════════════════════════════════
 *  6. Logged-In Email Display
 * ══════════════════════════════════════════════ */

.cgml-bis-email-display {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #777;
    font-family: 'Outfit', -apple-system, sans-serif;
    font-size: 0.82rem;
}

.cgml-bis-icon-mail {
    flex-shrink: 0;
    stroke: #999;
}


/* ══════════════════════════════════════════════
 *  7. Submit Button
 *  Matches the PDP's ATC button: dark green, rounded pill.
 * ══════════════════════════════════════════════ */

.cgml-bis-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0.68rem 1.5rem;
    white-space: nowrap;
    background: #2d5a3d;
    color: #fff;
    border: none;
    border-radius: 50px;
    font-family: 'Outfit', -apple-system, sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    -webkit-appearance: none;
    line-height: 1.4;
    text-decoration: none;
}

.cgml-bis-btn:hover {
    background: #245132;
    color: #fff;
    text-decoration: none;
}

.cgml-bis-btn:active {
    transform: scale(0.97);
}

.cgml-bis-btn:disabled {
    opacity: 0.5;
    cursor: wait;
    transform: none;
}


/* ══════════════════════════════════════════════
 *  8. Opt-In
 * ══════════════════════════════════════════════ */

.cgml-bis-optin {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    cursor: pointer;
    color: #888;
    font-family: 'Outfit', -apple-system, sans-serif;
    font-size: 0.72rem;
    line-height: 1.45;
}

.cgml-bis-optin input[type="checkbox"] {
    margin-top: 1px;
    accent-color: #2d5a3d;
    flex-shrink: 0;
}


/* ══════════════════════════════════════════════
 *  9. Login Prompt
 * ══════════════════════════════════════════════ */

.cgml-bis-login-prompt {
    margin: 0;
    color: #555;
    font-family: 'Outfit', -apple-system, sans-serif;
    font-size: 0.86rem;
    line-height: 1.55;
}

.cgml-bis-login-prompt a {
    color: #2d5a3d;
    font-weight: 600;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

.cgml-bis-login-prompt a:hover {
    color: #1e3f2b;
}


/* ══════════════════════════════════════════════
 *  10. Confirmed / Subscribed
 * ══════════════════════════════════════════════ */

.cgml-bis-confirmed {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.cgml-bis-confirmed__icon {
    flex-shrink: 0;
    stroke: #2d5a3d;
    margin-top: 1px;
}

.cgml-bis-confirmed__title {
    margin: 0 0 2px;
    font-family: 'DM Serif Display', 'Playfair Display', Georgia, serif;
    font-size: 0.92rem;
    font-weight: 400;
    color: #2d5a3d;
}

.cgml-bis-confirmed__sub {
    margin: 0;
    color: #888;
    font-family: 'Outfit', -apple-system, sans-serif;
    font-size: 0.8rem;
    line-height: 1.45;
}

.cgml-bis-confirmed__sub strong {
    color: #666;
    font-weight: 600;
}


/* ══════════════════════════════════════════════
 *  11. Spinner
 * ══════════════════════════════════════════════ */

.cgml-bis-spin {
    display: inline-block;
    width: 13px;
    height: 13px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: cgmlBisSpin 0.55s linear infinite;
    vertical-align: middle;
}

@keyframes cgmlBisSpin {
    to { transform: rotate(360deg); }
}


/* ══════════════════════════════════════════════
 *  11b. Error Message
 * ══════════════════════════════════════════════ */

.cgml-bis-error {
    margin: 0.4rem 0 0;
    padding: 0;
    color: #c0392b;
    font-family: 'Outfit', -apple-system, sans-serif;
    font-size: 0.78rem;
    line-height: 1.4;
}


/* ══════════════════════════════════════════════
 *  11c. Inline Icon (in buttons)
 * ══════════════════════════════════════════════ */

.cgml-bis-icon-inline {
    display: inline-block;
    vertical-align: -2px;
    flex-shrink: 0;
    margin-right: 4px;
}

.cgml-bis-btn .cgml-bis-icon-inline {
    stroke: #fff;
}


/* ══════════════════════════════════════════════
 *  12. "Browse Similar" CTA
 * ══════════════════════════════════════════════ */

.cgml-bis-similar {
    margin-top: 0.7rem;
    padding-top: 0.65rem;
    border-top: 1px solid rgba(45, 90, 61, 0.08);
    text-align: center;
}

.cgml-bis-similar--confirmed {
    margin-top: 0.85rem;
}

.cgml-bis-similar__or {
    display: block;
    margin-bottom: 0.35rem;
    color: #aaa;
    font-family: 'Outfit', -apple-system, sans-serif;
    font-size: 0.75rem;
    font-style: italic;
    text-transform: lowercase;
}

.cgml-bis-similar__link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0.45rem 1rem;
    background: transparent;
    border: 1.5px solid #2d5a3d;
    border-radius: 50px;
    color: #2d5a3d;
    font-family: 'Outfit', -apple-system, sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s, color 0.2s, transform 0.1s;
    cursor: pointer;
}

.cgml-bis-similar__link:hover {
    background: #2d5a3d;
    color: #fff;
}

.cgml-bis-similar__link:hover .cgml-bis-icon-inline {
    stroke: #fff;
}

.cgml-bis-similar__link .cgml-bis-icon-inline {
    stroke: #2d5a3d;
    transition: stroke 0.2s;
}

.cgml-bis-similar__link:active {
    transform: scale(0.97);
}


/* ══════════════════════════════════════════════
 *  13. Sticky Bar "Notify Me" State
 * ══════════════════════════════════════════════ */

.cgml-bis-sticky-notify {
    background: #2d5a3d !important;
    color: #fff !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
}

.cgml-bis-sticky-notify .cgml-bis-icon-inline {
    stroke: #fff;
}


/* ══════════════════════════════════════════════
 *  14. Pulse Animation (sticky → card scroll)
 * ══════════════════════════════════════════════ */

.cgml-bis-pulse {
    animation: cgmlBisPulse 0.6s ease-out 2;
}

@keyframes cgmlBisPulse {
    0%   { box-shadow: 0 0 0 0 rgba(45, 90, 61, 0.35); }
    70%  { box-shadow: 0 0 0 10px rgba(45, 90, 61, 0); }
    100% { box-shadow: 0 0 0 0 rgba(45, 90, 61, 0); }
}


/* ══════════════════════════════════════════════
 *  15. Cross-Sells Highlight (on scroll)
 * ══════════════════════════════════════════════ */

.cgml-bis-highlight {
    animation: cgmlBisHighlight 1.5s ease-out;
}

@keyframes cgmlBisHighlight {
    0%   { outline: 3px solid rgba(45, 90, 61, 0.4); outline-offset: 8px; }
    100% { outline: 3px solid rgba(45, 90, 61, 0); outline-offset: 16px; }
}


/* ══════════════════════════════════════════════
 *  16. v3.2 — Location Prompt Card
 *
 *  Shown when no location is selected. Uses a slightly
 *  warmer background to differentiate from the OOS card
 *  and gently nudge the user toward selecting a store.
 * ══════════════════════════════════════════════ */

.cgml-bis-location-prompt {
    background: rgba(45, 90, 61, 0.025);
    border-color: rgba(45, 90, 61, 0.10);
    text-align: center;
}

.cgml-bis-location-prompt .cgml-bis-heading {
    justify-content: center;
}

.cgml-bis-location-prompt .cgml-bis-subtext {
    text-align: center;
}

.cgml-bis-location-prompt .cgml-bis-btn {
    margin: 0 auto 0;
    text-decoration: none;
}

.cgml-bis-location-prompt .cgml-bis-btn .cgml-bis-icon-inline {
    stroke: #fff;
}

.cgml-bis-choose-location:focus {
    outline: 2px solid #2d5a3d;
    outline-offset: 2px;
}


/* ══════════════════════════════════════════════
 *  17. Responsive
 * ══════════════════════════════════════════════ */

@media (max-width: 768px) {
    .cgml-bis-card {
        padding: 0.95rem 1rem;
    }

    .cgml-bis-heading {
        font-size: 0.88rem;
    }

    .cgml-bis-subtext {
        font-size: 0.78rem;
    }

    .cgml-bis-row {
        flex-direction: column;
    }

    .cgml-bis-row--loggedin {
        flex-direction: row;
    }

    .cgml-bis-btn {
        width: 100%;
        padding: 0.72rem 1.25rem;
    }

    .cgml-bis-email {
        font-size: 16px; /* prevent iOS zoom */
    }

    .cgml-bis-similar__link {
        font-size: 0.78rem;
        padding: 0.4rem 0.85rem;
    }

    .cgml-bis-location-prompt .cgml-bis-btn {
        width: auto;
        min-width: 70%;
    }
}

@media (max-width: 480px) {
    .cgml-bis-row--loggedin {
        flex-direction: column;
        align-items: flex-start;
    }

    .cgml-bis-btn {
        width: 100%;
    }

    .cgml-bis-location-prompt .cgml-bis-btn {
        width: 100%;
    }
}
