/* CoreDigify popup banner — self-contained, design-matched (Dreiliņu Stādi ref).
   Colours are driven by CSS vars set from admin config (JS). */
.cdpop-overlay {
    position: fixed;
    inset: 0;
    background: rgba(20, 22, 16, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    padding: 16px;
    opacity: 0;
    transition: opacity .25s ease;
}
.cdpop-overlay.cdpop-show { opacity: 1; }

.cdpop-modal {
    --cdpop-primary: #6b8e23;
    --cdpop-primary-dark: #5a7a1f;
    --cdpop-cream: #f7f4ec;
    --cdpop-ink: #3a3d2e;
    --cdpop-accent: #ef5f79;
    --cdpop-tint: #edf1df;
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 960px;
    max-height: 94vh;
    background: var(--cdpop-cream);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .45);
    transform: translateY(12px) scale(.98);
    transition: transform .28s cubic-bezier(.2,.8,.2,1);
    font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--cdpop-ink);
}
.cdpop-overlay.cdpop-show .cdpop-modal { transform: none; }

.cdpop-cols { display: flex; flex: 1 1 auto; min-height: 0; }

.cdpop-media {
    position: relative;
    flex: 0 0 42%;
    background-size: cover;
    background-position: center;
    min-height: 300px;
    overflow: hidden;
}
.cdpop-body {
    flex: 1 1 58%;
    padding: 40px 44px 20px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    /* Decorations (heart, backdrop leaves) may overhang — never show a
       horizontal scrollbar for them. */
    overflow-x: hidden;
    /* Faint line-art leaves, bottom-right (decorative). */
    background-image: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 160' fill='none' stroke='rgba(107,142,35,0.14)' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M30 150C48 106 78 70 132 40'/%3E%3Cpath d='M64 98c-16 4-29 0-37-12 13-8 28-5 37 4'/%3E%3Cpath d='M84 70c-5-16 0-30 12-38 8 13 5 28-4 36'/%3E%3Cpath d='M108 52c-3-13 1-24 12-30 6 10 4 21-4 29'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right -28px bottom -20px;
    background-size: 190px;
    transition: opacity .22s ease;
}
.cdpop-body.cdpop-fading { opacity: 0; }

.cdpop-close {
    position: absolute;
    top: 14px;
    right: 16px;
    width: 40px;
    height: 40px;
    border: 0;
    background: transparent;
    font-size: 28px;
    font-weight: 300;
    line-height: 1;
    color: var(--cdpop-ink);
    cursor: pointer;
    border-radius: 50%;
    transition: background .15s;
    z-index: 2;
}
.cdpop-close:hover { background: rgba(0,0,0,.06); }

/* ---- Heading block: sprig + serif heading + heart + brush underline ---- */
.cdpop-headwrap { position: relative; text-align: center; padding: 2px 26px 0; }
.cdpop-sprig {
    position: absolute;
    top: -16px;
    left: 5%;
    color: var(--cdpop-primary);
    transform: rotate(-12deg);
}
.cdpop-heading {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 34px;
    line-height: 1.18;
    font-weight: 700;
    color: var(--cdpop-primary-dark);
    margin: 0;
}
.cdpop-hline { display: block; }
.cdpop-hline-last { position: relative; display: inline-block; color: var(--cdpop-primary); }
.cdpop-heart {
    position: absolute;
    right: -46px;
    top: -8px;
    color: var(--cdpop-accent);
    transform: rotate(10deg);
}
.cdpop-brush {
    display: block;
    width: 72%;
    height: 12px;
    margin: 6px auto 0;
    color: var(--cdpop-accent);
}

/* ---- Divider with leaf ---- */
.cdpop-divider {
    display: flex; align-items: center; gap: 12px;
    color: var(--cdpop-primary); margin: 16px 0 12px;
}
.cdpop-divider::before, .cdpop-divider::after {
    content: ""; flex: 1; height: 1px; background: #cfc9b4;
}

.cdpop-sub { text-align: center; font-size: 16.5px; margin: 0 0 16px; }
.cdpop-sub strong { color: var(--cdpop-primary-dark); }

/* ---- Coupon "ticket": green, inner dashed border, edge notches, leaves ---- */
.cdpop-coupon {
    position: relative;
    width: 100%;
    background: var(--cdpop-primary);
    border-radius: 8px;
    text-align: center;
    padding: 30px 20px;
    margin: 2px 0 22px;
    overflow: hidden;
}
.cdpop-coupon::before {
    content: "";
    position: absolute;
    inset: 8px;
    border: 2px dashed rgba(255,255,255,.85);
    border-radius: 4px;
    pointer-events: none;
}
.cdpop-notch {
    position: absolute;
    top: 50%;
    width: 24px;
    height: 24px;
    margin-top: -12px;
    background: var(--cdpop-cream);
    border-radius: 50%;
    z-index: 1;
}
.cdpop-notch-l { left: -12px; }
.cdpop-notch-r { right: -12px; }
.cdpop-coupon-leaves {
    position: absolute;
    right: -6px;
    bottom: -14px;
    width: 110px;
    height: 110px;
    pointer-events: none;
}
.cdpop-coupon-label {
    position: relative;
    color: #fff;
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 700;
    font-size: 62px;
    line-height: 1;
    letter-spacing: 1px;
}

/* ---- Form ---- */
.cdpop-field {
    display: flex; align-items: center; gap: 12px;
    background: #fff;
    border: 1px solid #d8d3c2;
    border-radius: 10px;
    padding: 0 16px;
    margin-bottom: 14px;
}
.cdpop-field svg { flex: 0 0 auto; color: var(--cdpop-primary-dark); }
.cdpop-field input {
    flex: 1; border: 0; outline: 0; background: transparent;
    padding: 16px 0; font-size: 15.5px; color: var(--cdpop-ink);
}
.cdpop-field input::placeholder { color: #9a9d8c; }

.cdpop-btn {
    position: relative;
    width: 100%;
    border: 0;
    background: var(--cdpop-primary);
    color: #fff;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: .8px;
    text-transform: uppercase;
    padding: 17px 48px;
    border-radius: 10px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s, transform .05s;
}
.cdpop-btn svg { position: absolute; right: 20px; top: 50%; margin-top: -10px; }
.cdpop-btn:hover { background: var(--cdpop-primary-dark); }
.cdpop-btn:active { transform: translateY(1px); }
.cdpop-btn[disabled] { opacity: .6; cursor: default; }

.cdpop-consent {
    display: flex; align-items: flex-start; gap: 9px;
    font-size: 14px; margin: 14px 2px 2px; color: #4b4e40;
    cursor: pointer;
}
.cdpop-consent input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--cdpop-primary); }
.cdpop-consent strong { color: var(--cdpop-primary-dark); }

/* ---- Feature icons row ---- */
.cdpop-features {
    display: flex; gap: 22px; margin: 20px 0 6px;
    justify-content: center; flex-wrap: wrap;
}
.cdpop-feature {
    display: flex; align-items: center; gap: 10px;
    font-size: 12.5px; line-height: 1.3; color: #43462f;
    flex: 1; min-width: 130px; max-width: 190px;
}
.cdpop-feature svg { color: var(--cdpop-primary-dark); flex: 0 0 auto; }

.cdpop-msg { text-align: center; font-size: 15px; margin: 10px 0 0; min-height: 18px; }
.cdpop-msg.cdpop-ok { color: var(--cdpop-primary-dark); font-weight: 600; }
.cdpop-msg.cdpop-err { color: #c0392b; }

/* ---- Privacy bar: full modal width, under photo + body ---- */
.cdpop-privacy {
    flex: 0 0 auto;
    padding: 15px 30px;
    background: #e9ecdd;
    display: flex; align-items: center; justify-content: center; gap: 12px;
    font-size: 13px; color: #4b5540;
    max-height: 120px;
    overflow: hidden;
    transition: max-height .25s ease, padding .25s ease, opacity .25s ease;
}
.cdpop-privacy svg { color: var(--cdpop-primary-dark); flex: 0 0 auto; }

/* ---- Thank-you view (post submit) ---- */
.cdpop-ty { text-align: center; display: flex; flex-direction: column; align-items: center; }
.cdpop-ty-check {
    display: flex; align-items: center; gap: 22px;
    color: var(--cdpop-primary-dark); margin: 4px 0 6px;
}
.cdpop-ty-sprig { color: var(--cdpop-primary); transform: rotate(-14deg); }
.cdpop-flip { transform: scaleX(-1) rotate(-14deg); display: inline-flex; }
.cdpop-ty-heading {
    display: flex; align-items: center; gap: 16px; justify-content: center;
    font-size: 44px; margin: 2px 0 8px;
}
.cdpop-emph { color: var(--cdpop-primary-dark); display: inline-flex; }
.cdpop-emph.cdpop-flip { transform: scaleX(-1); }
.cdpop-ty-sub { font-weight: 700; font-size: 19px; margin: 0 0 12px; color: var(--cdpop-ink); }
.cdpop-ty-text { max-width: 340px; }
.cdpop-code-row { display: flex; align-items: center; gap: 20px; margin: 6px 0 16px; }
.cdpop-code {
    background: var(--cdpop-tint);
    border: 2px dashed var(--cdpop-primary);
    border-radius: 12px;
    color: var(--cdpop-primary-dark);
    font-weight: 800;
    font-size: 38px;
    letter-spacing: 2px;
    padding: 18px 38px;
}
.cdpop-copy {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    border: 0; background: transparent; cursor: pointer;
    color: var(--cdpop-primary-dark); font-size: 11.5px; font-weight: 700;
    letter-spacing: .5px;
}
.cdpop-copy:hover { color: var(--cdpop-primary); }
.cdpop-note {
    display: flex; align-items: center; gap: 12px; justify-content: center;
    background: var(--cdpop-tint); border-radius: 10px; padding: 14px 22px;
    font-size: 14.5px; color: var(--cdpop-ink); margin: 2px 0 6px;
    width: 100%; max-width: 460px;
}
.cdpop-note svg { color: var(--cdpop-primary-dark); flex: 0 0 auto; }
.cdpop-note strong { color: var(--cdpop-primary-dark); }
.cdpop-hr { width: 100%; height: 1px; background: #cfc9b4; margin: 16px 0 4px; }

/* TY mode: circled close, curved photo edge, no privacy bar. */
.cdpop-ty-mode .cdpop-close {
    border: 1.5px solid #c9ccba;
    background: #fff;
    font-size: 22px;
}
.cdpop-ty-mode .cdpop-close:hover { background: rgba(0,0,0,.04); }
.cdpop-ty-mode .cdpop-privacy { max-height: 0; padding-top: 0; padding-bottom: 0; opacity: 0; }
.cdpop-ty-mode .cdpop-body { justify-content: center; }
.cdpop-ty-mode .cdpop-media::after {
    content: "";
    position: absolute;
    top: -14%;
    bottom: -14%;
    right: -78px;
    width: 140px;
    background: var(--cdpop-cream);
    border-radius: 50%;
}

@media (max-width: 720px) {
    .cdpop-media { display: none; }
    .cdpop-body { flex-basis: 100%; padding: 34px 22px 16px; background-size: 150px; }
    .cdpop-heading { font-size: 26px; }
    .cdpop-heart { right: -38px; top: -10px; }
    .cdpop-heart svg { width: 28px; height: 28px; }
    .cdpop-sprig { left: -4px; }
    .cdpop-coupon-label { font-size: 48px; }
    .cdpop-coupon { padding: 24px 16px; }
    .cdpop-ty-heading { font-size: 34px; }
    .cdpop-code { font-size: 28px; padding: 14px 24px; letter-spacing: 1px; }
    .cdpop-privacy { padding: 13px 18px; font-size: 12px; }
}
