/* ============================================================
   Popup "Cadou de bun venit" (views/layouts/_signup_offer.php,
   web/js/signup-offer.js). Dupa mockup-ul docs/mockups/signup/index.html.

   Toate clasele au prefixul so- si stau sub #signupOffer, ca stilurile
   site-ului (input, button, label din webshopStyles74 / style.css) sa
   nu se amestece. Culorile de brand vin din tokeni (web/css/tokens.css),
   cu valorile fantastic ca rezerva.

   Fontul Manrope e gazduit local (web/fonts/, aceleasi fisiere ca tema
   tehnomarket) si se foloseste doar in acest popup.
   ============================================================ */

@font-face {
    font-family: "Manrope SO";
    font-style: normal;
    font-weight: 200 800;
    font-display: swap;
    src: url("../fonts/manrope-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Manrope SO";
    font-style: normal;
    font-weight: 200 800;
    font-display: swap;
    src: url("../fonts/manrope-latin-ext.woff2") format("woff2");
    unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: "Manrope SO";
    font-style: normal;
    font-weight: 200 800;
    font-display: swap;
    src: url("../fonts/manrope-cyrillic.woff2") format("woff2");
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

#signupOffer {
    --so-brand: var(--c-brand, #1e50c8);
    --so-brand-deep: var(--c-brand-deep, #122a66);
    --so-ink: #182744;
    --so-muted: #586579;
    --so-line: #dce2ec;
    --so-paper: #fff;
    --so-wash: #f2f5fa;
    --so-tint: #eff4ff;

    padding: 0;
    border: 0;
    border-radius: 20px;
    background: var(--so-paper);
    color: var(--so-ink);
    width: calc(100% - 24px);
    max-width: 460px;
    max-height: calc(100dvh - 24px);
    overflow: auto;
    overscroll-behavior: contain;
    box-shadow: 0 28px 100px rgba(7, 27, 70, .25);
    margin: auto;
    font: 14px/1.5 "Manrope SO", Manrope, Arial, sans-serif;
    z-index: 10050;
}
#signupOffer::backdrop {
    background: rgba(22, 39, 68, .56);
    backdrop-filter: blur(5px);
}
#signupOffer *, #signupOffer *::before, #signupOffer *::after { box-sizing: border-box; }
#signupOffer button, #signupOffer input { font: inherit; }
#signupOffer button { cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
#signupOffer a { color: var(--so-brand); text-underline-offset: 2px; }
#signupOffer button:focus-visible, #signupOffer a:focus-visible, #signupOffer input:focus-visible, #signupOffer summary:focus-visible {
    outline: 3px solid #7199f1;
    outline-offset: 3px;
}
#signupOffer h1, #signupOffer h2, #signupOffer p { margin: 0; font-family: inherit; }

body.so-open { overflow: hidden; }

.so-shell { position: relative; }

.so-close {
    position: absolute;
    z-index: 2;
    right: 10px;
    top: 10px;
    width: 44px;
    height: 44px;
    border: 1px solid rgba(255, 255, 255, .65);
    border-radius: 50%;
    background: rgba(255, 255, 255, .93);
    color: var(--so-ink);
    display: grid;
    place-items: center;
    padding: 0;
}
.so-close svg { width: 20px; height: 20px; }

/* ---------- imaginea ---------- */
.so-visual {
    position: relative;
    height: 132px;
    overflow: hidden;
    background: #d3e0e6;
}
.so-visual img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 50% 54%;
    display: block;
}
.so-visual::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(0deg, rgba(12, 34, 59, .4), transparent 80%);
    pointer-events: none;
}
.so-visual-copy, .so-mobile-offer { display: none; }

/* ---------- continutul ---------- */
.so-content { padding: 22px 24px 18px; }
.so-brand { display: block; width: 145px; height: auto; margin: 0 0 18px; }
.so-welcome { display: none; }
.so-intro h1 {
    font-size: 26px;
    line-height: 1.18;
    letter-spacing: -1px;
    font-weight: 800;
    margin: 0 0 10px;
    max-width: 340px;
    color: var(--so-ink);
}
.so-intro p { color: var(--so-muted); font-size: 14px; line-height: 1.6; }
.so-intro p b { color: var(--so-ink); }

.so-offer {
    display: flex;
    align-items: center;
    gap: 13px;
    background: var(--so-tint);
    border-radius: 12px;
    padding: 12px 16px;
    margin: 18px 0;
}
.so-offer-number { display: flex; flex-direction: column; flex-shrink: 0; color: var(--so-brand); line-height: 1; }
.so-offer-number small { font-size: 11px; font-weight: 700; margin-bottom: 4px; }
.so-offer-number strong { font-size: 37px; letter-spacing: -2px; font-weight: 800; }
.so-offer-copy { font-size: 13px; line-height: 1.5; color: var(--so-brand-deep); }
.so-offer-copy b { display: block; font-size: 14px; }

/* ---------- formularul ---------- */
.so-fields { display: grid; gap: 12px; }
.so-fields label { font-size: 12px; font-weight: 700; display: block; margin-bottom: 5px; color: var(--so-ink); }
#signupOffer .so-fields input {
    width: 100%;
    height: 48px;
    border: 1px solid var(--so-line);
    border-radius: 9px;
    background: #fff;
    padding: 0 13px;
    color: var(--so-ink);
    font-size: 16px;
    margin: 0;
    box-shadow: none;
}
#signupOffer .so-fields input::placeholder { color: #8791a1; font-size: 14px; }
#signupOffer .so-fields input:focus { border-color: var(--so-brand); outline: none; }

.so-phone-wrap {
    display: flex;
    align-items: center;
    border: 1px solid var(--so-line);
    border-radius: 9px;
    background: #fff;
    overflow: hidden;
}
.so-phone-prefix {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0 12px;
    height: 48px;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 600;
    border-right: 1px solid var(--so-line);
    color: var(--so-muted);
}
.so-flag {
    width: 18px;
    height: 12px;
    border-radius: 2px;
    background: linear-gradient(90deg, #0046ae 0 33.4%, #ffd200 33.4% 66.7%, #cc092f 66.7%);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08);
}
#signupOffer .so-phone-wrap input { border: 0; min-width: 0; flex: 1; }
.so-phone-wrap:focus-within { border-color: var(--so-brand); }

.so-password-wrap { position: relative; }
#signupOffer .so-password-wrap input { padding-right: 50px; }
.so-eye {
    position: absolute;
    right: 2px;
    top: 2px;
    width: 44px;
    height: 44px;
    border: 0;
    background: transparent;
    color: var(--so-muted);
    display: grid;
    place-items: center;
    padding: 0;
}
.so-eye svg { width: 20px; height: 20px; }
.so-eye[aria-pressed="true"] { color: var(--so-brand); }

.so-form-note { font-size: 12px; line-height: 1.6; color: var(--so-muted); margin: 13px 0 0; }

.so-consent {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin: 15px 0 0;
    font-size: 12px;
    line-height: 1.5;
    font-weight: 400;
    color: var(--so-muted);
    cursor: pointer;
}
#signupOffer .so-consent input {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    margin: 2px 0;
    accent-color: var(--so-brand);
}

.so-error {
    margin: 12px 0 0;
    padding: 10px 12px;
    border-radius: 9px;
    background: #fff1f1;
    color: #b42318;
    font-size: 13px;
    line-height: 1.5;
}
.so-error[hidden] { display: none; }
.so-error a { color: inherit; font-weight: 700; }
#signupOffer .so-fields input.is-invalid, .so-phone-wrap.is-invalid { border-color: #e03b3b; }

.so-primary {
    border: 0;
    background: var(--so-brand);
    color: #fff;
    min-height: 50px;
    border-radius: 10px;
    font-weight: 800;
    padding: 12px 20px;
    transition: background .15s;
}
.so-primary:hover { background: var(--so-brand-deep); color: #fff; }
.so-primary:disabled { opacity: .7; cursor: default; }
.so-submit { width: 100%; margin-top: 18px; }

.so-terms { font-size: 11px; line-height: 1.6; color: var(--so-muted); margin: 11px 0 0; }
.so-terms summary { cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.so-terms p { margin: 8px 0 0; }

.so-later {
    display: block;
    border: 0;
    background: transparent;
    color: var(--so-muted);
    font-weight: 600;
    margin: 5px auto 0;
    min-height: 44px;
    padding: 8px 18px;
}
.so-later:hover { color: var(--so-brand); }

/* ---------- succes ---------- */
.so-success { text-align: center; padding: 34px 0; }
.so-success[hidden] { display: none; }
.so-check {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--so-tint);
    color: var(--so-brand);
    font-size: 32px;
}
.so-success h2 { font-size: 26px; line-height: 1.2; font-weight: 800; margin-bottom: 10px; }
.so-success p { color: var(--so-muted); margin-bottom: 22px; }

/* ---------- desktop: imaginea in stinga ---------- */
@media (min-width: 760px) {
    #signupOffer { max-width: 900px; width: calc(100% - 64px); border-radius: 24px; }
    .so-shell { display: grid; grid-template-columns: 44% 56%; }
    .so-visual { height: auto; min-height: 100%; }
    .so-visual img { position: absolute; inset: 0; object-position: 48% 50%; }
    .so-visual::after { background: linear-gradient(0deg, rgba(11, 36, 56, .85), transparent 64%); }
    .so-visual-copy {
        display: block;
        position: absolute;
        bottom: 38px;
        left: 32px;
        right: 32px;
        color: #fff;
        z-index: 1;
    }
    .so-visual-copy h2 { font-size: 32px; line-height: 1.2; letter-spacing: -1px; margin: 0 0 14px; font-weight: 700; color: #fff; }
    .so-visual-copy p { margin: 0; max-width: 260px; color: #edf3f7; font-size: 14px; line-height: 1.7; }
    .so-content { padding: 35px 44px 22px; }
    .so-brand { width: 156px; margin-bottom: 26px; }
    .so-intro h1 { font-size: 32px; }
    .so-offer { margin: 20px 0; }
    .so-close { right: 12px; top: 12px; background: var(--so-wash); border: 0; }
    .so-fields { gap: 14px; }
}

/* ---------- mobil: imaginea sus, insigna cu procentul ---------- */
@media (max-width: 759px) {
    #signupOffer { width: calc(100% - 20px); max-width: 460px; border-radius: 16px; background: #fafbfd; }
    .so-shell { padding-top: 34px; }
    .so-close { top: 0; right: 0; background: transparent; border: 0; border-radius: 12px; }
    .so-close svg { width: 24px; height: 24px; }
    .so-close:focus-visible { outline-offset: -5px; }
    .so-visual { margin: 0 22px; height: auto; aspect-ratio: 1.65; overflow: visible; border-radius: 12px; background: transparent; }
    .so-visual img { border-radius: 12px; object-position: 50% 61%; }
    .so-visual::after { display: none; }
    .so-mobile-offer {
        display: block;
        position: absolute;
        bottom: -8px;
        left: 0;
        z-index: 1;
        background: var(--so-brand);
        color: #fff;
        border-radius: 9px;
        padding: 8px 14px 10px;
        box-shadow: 0 10px 22px rgba(30, 80, 200, .17);
    }
    .so-mobile-offer div { line-height: 1; display: flex; gap: 7px; align-items: baseline; }
    .so-mobile-offer small { font-size: 12px; }
    .so-mobile-offer strong { font-size: 32px; letter-spacing: -1px; }
    .so-mobile-offer span { display: block; font-size: 11px; font-weight: 700; margin-top: 6px; letter-spacing: .5px; }
    .so-content { padding: 26px 22px 12px; }
    .so-brand, .so-offer { display: none; }
    .so-welcome {
        display: block;
        font-size: 10px;
        font-weight: 800;
        color: var(--so-brand);
        letter-spacing: .7px;
        margin: 0 0 12px;
        text-transform: uppercase;
    }
    .so-intro h1 { font-size: 27px; line-height: 1.25; letter-spacing: -.6px; margin-bottom: 12px; max-width: 100%; }
    .so-intro p { font-size: 13px; line-height: 1.65; }
    .so-fields { gap: 10px; margin-top: 20px; }
    .so-fields label { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
    #signupOffer .so-fields input { height: 48px; background: #fff; }
    #signupOffer .so-fields input::placeholder { font-size: 14px; color: #6d7685; }
    .so-consent { margin-top: 13px; font-size: 11px; line-height: 1.5; }
    .so-submit { margin-top: 13px; min-height: 50px; font-size: 14px; }
    .so-terms { margin-top: 10px; font-size: 10px; }
    .so-later { font-size: 11px; min-height: 36px; margin-top: 0; }
    .so-success { padding: 20px 0; }
}
@media (max-width: 359px) {
    .so-visual { margin: 0 18px; }
    .so-content { padding-left: 18px; padding-right: 18px; }
    .so-intro h1 { font-size: 24px; }
    .so-phone-prefix { padding: 0 9px; }
    .so-submit { padding-left: 8px; padding-right: 8px; }
}
@media (max-height: 740px) and (max-width: 759px) {
    .so-content { padding-top: 16px; }
    .so-fields { gap: 9px; }
}
@media (prefers-reduced-motion: no-preference) {
    #signupOffer[open] { animation: so-reveal .2s ease-out; }
    @keyframes so-reveal { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
}
