/*
 * Receiteria Popup — Frontend Styles
 * Inherits design tokens from the Receiteria theme.
 */

/* ------------------------------------------------------------------ */
/* Tokens                                                               */
/* ------------------------------------------------------------------ */
:root {
    --rp-font:           'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
    --rp-primary:        var(--cor-primaria,        #F53E28);
    --rp-primary-hover:  var(--cor-primaria-hover,  #e03520);
    --rp-text:           var(--cor-texto-principal,  #53240C);
    --rp-text-sub:       var(--cor-texto-secundario, #703416);
    --rp-text-muted:     var(--cor-texto-claro,      #947160);
    --rp-bg:             var(--cor-fundo-bege-claro, #FBF7F1);
    --rp-border:         var(--cor-cinza,            #E2D7C6);
    --rp-radius:         16px;
    --rp-radius-sm:      8px;
    --rp-shadow:         0 24px 64px rgba(83, 36, 12, 0.22);
    --rp-overlay:        rgba(83, 36, 12, 0.55);
    --rp-transition:     0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --rp-dialog-w:       860px;
    --rp-img-w:          400px;
}

/* ------------------------------------------------------------------ */
/* Overlay                                                              */
/* ------------------------------------------------------------------ */
.rp-popup {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    font-family: var(--rp-font);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--rp-transition);
}

.rp-popup.rp-popup--open {
    opacity: 1;
    pointer-events: all;
}

.rp-popup__overlay {
    position: absolute;
    inset: 0;
    background: var(--rp-overlay);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    cursor: pointer;
}

/* ------------------------------------------------------------------ */
/* Dialog                                                               */
/* ------------------------------------------------------------------ */
.rp-popup__dialog {
    position: relative;
    z-index: 1;
    background: var(--rp-bg);
    border-radius: var(--rp-radius);
    box-shadow: var(--rp-shadow);
    width: 100%;
    max-width: 520px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    overflow-x: hidden;
    transform: translateY(20px) scale(0.97);
    transition: transform var(--rp-transition);
    overscroll-behavior: contain;
}

.rp-popup--open .rp-popup__dialog {
    transform: translateY(0) scale(1);
}

/* Split layout (with image) */
.rp-popup__dialog--split {
    display: flex;
    flex-direction: row;
    max-width: var(--rp-dialog-w);
    overflow: hidden; /* image needs hard clip */
    overflow-y: visible;
    max-height: calc(100vh - 32px);
}

/* ------------------------------------------------------------------ */
/* Image panel                                                          */
/* ------------------------------------------------------------------ */
.rp-popup__image {
    flex: 0 0 var(--rp-img-w);
    width: var(--rp-img-w);
    min-height: 420px;
    overflow: hidden;
    border-radius: var(--rp-radius) 0 0 var(--rp-radius);
}

.rp-popup__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

/* ------------------------------------------------------------------ */
/* Body panel                                                           */
/* ------------------------------------------------------------------ */
.rp-popup__body {
    flex: 1 1 auto;
    padding: 32px 28px;
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow-y: auto;
    max-height: calc(100vh - 32px);
}

/* ------------------------------------------------------------------ */
/* Close button                                                         */
/* ------------------------------------------------------------------ */
.rp-popup__close {
    position: absolute;
    top: 12px;
    right: 14px;
    z-index: 2;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(83, 36, 12, 0.08);
    border: none;
    border-radius: 50%;
    color: var(--rp-text);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: background var(--rp-transition), color var(--rp-transition);
    padding: 0;
}

.rp-popup__close:hover {
    background: var(--rp-primary);
    color: #fff;
}

/* ------------------------------------------------------------------ */
/* Typography                                                           */
/* ------------------------------------------------------------------ */
.rp-popup__headline {
    font-family: var(--rp-font);
    font-size: 20px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--rp-text);
    margin: 0 0 8px;
    padding: 0;
}

.rp-popup__sub {
    font-size: 14px;
    font-weight: 400;
    line-height: 1.5;
    color: var(--rp-text-sub);
    margin: 0 0 14px;
}

/* ------------------------------------------------------------------ */
/* Form                                                                 */
/* ------------------------------------------------------------------ */
.rp-popup__form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 4px;
}

.rp-popup__field-wrap {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.rp-popup__input {
    width: 100%;
    padding: 12px 14px;
    font-family: var(--rp-font);
    font-size: 14px;
    color: var(--rp-text);
    background: #fff;
    border: 1.5px solid var(--rp-border);
    border-radius: var(--rp-radius-sm);
    outline: none;
    transition: border-color var(--rp-transition), box-shadow var(--rp-transition);
    box-sizing: border-box;
}

.rp-popup__input:focus {
    border-color: var(--rp-primary);
    box-shadow: 0 0 0 3px rgba(245, 62, 40, 0.12);
}

.rp-popup__input.rp-input--error {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.10);
}

.rp-popup__field-error {
    font-size: 12px;
    color: #dc2626;
    display: none;
}
.rp-popup__field-error:not(:empty) { display: block; }

.rp-popup__field-suggestion {
    font-size: 12px;
    color: var(--rp-text-muted);
    display: none;
}
.rp-popup__field-suggestion:not(:empty) { display: block; }

.rp-popup__field-suggestion a,
.rp-popup__field-suggestion button {
    color: var(--rp-primary);
    text-decoration: underline;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-size: inherit;
    font-family: inherit;
}

/* ------------------------------------------------------------------ */
/* Consent                                                              */
/* ------------------------------------------------------------------ */
.rp-popup__consent {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    cursor: pointer;
    margin-top: 20px;
}
@media (min-width: 721px) {
    .rp-popup__consent { margin-top: 40px; }
}

.rp-popup__consent-check {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    margin-top: 2px;
    accent-color: var(--rp-primary);
    cursor: pointer;
}

.rp-popup__consent-text {
    font-size: 12px;
    line-height: 1.5;
    color: var(--rp-text-muted);
}

/* ------------------------------------------------------------------ */
/* Push opt-in                                                          */
/* ------------------------------------------------------------------ */
.rp-popup__push-label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    cursor: pointer;
    margin-top: -8px;
}

.rp-popup__push-check {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    margin-top: 2px;
    accent-color: var(--rp-primary);
    cursor: pointer;
}

.rp-popup__push-text {
    font-size: 12px;
    line-height: 1.5;
    color: var(--rp-text-muted);
}

/* ------------------------------------------------------------------ */
/* CTA Button                                                           */
/* ------------------------------------------------------------------ */
.rp-popup__btn {
    display: block;
    width: 100%;
    padding: 13px 20px;
    background: var(--rp-primary);
    color: #fff;
    font-family: var(--rp-font);
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    border: none;
    border-radius: var(--rp-radius-sm);
    cursor: pointer;
    transition: background var(--rp-transition), transform var(--rp-transition);
    text-decoration: none;
    margin-top: 4px;
}

.rp-popup__btn:hover {
    background: var(--rp-primary-hover);
    transform: translateY(-1px);
}

.rp-popup__btn:active {
    transform: translateY(0);
}

.rp-popup__btn:disabled,
.rp-popup__btn[aria-busy="true"] {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}

.rp-popup__btn--link {
    display: inline-block;
    width: auto;
    text-decoration: none;
}

/* ------------------------------------------------------------------ */
/* Feedback                                                             */
/* ------------------------------------------------------------------ */
.rp-popup__feedback {
    font-size: 13px;
    line-height: 1.5;
    min-height: 20px;
    text-align: center;
}

.rp-popup__feedback.rp-feedback--success {
    color: #15803d;
    font-weight: 600;
}

.rp-popup__feedback.rp-feedback--error {
    color: #dc2626;
}

/* ------------------------------------------------------------------ */
/* Honeypot                                                             */
/* ------------------------------------------------------------------ */
.rp-hp-wrap {
    position: absolute;
    left: -9999px;
    top: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
}

/* ------------------------------------------------------------------ */
/* Accessibility: focus-visible ring                                    */
/* ------------------------------------------------------------------ */
.rp-popup__btn:focus-visible,
.rp-popup__input:focus-visible,
.rp-popup__close:focus-visible {
    outline: 3px solid var(--rp-primary);
    outline-offset: 2px;
}

/* ------------------------------------------------------------------ */
/* Mobile                                                               */
/* ------------------------------------------------------------------ */
@media (max-width: 720px) {
    .rp-popup {
        padding: 0 15px 0;
        align-items: flex-end;
    }

    .rp-popup__dialog,
    .rp-popup__dialog--split {
        max-width: 100%;
        width: 100%;
        max-height: 88vh;
        border-radius: var(--rp-radius) var(--rp-radius) 0 0;
        flex-direction: column;
        overflow-y: auto;
    }

    .rp-popup--open .rp-popup__dialog {
        transform: translateY(0) scale(1);
    }

    .rp-popup__dialog {
        transform: translateY(100%);
    }

    .rp-popup--open .rp-popup__dialog {
        transform: translateY(0);
    }

    .rp-popup__image {
        flex: none;
        width: 100%;
        min-height: 160px;
        max-height: 35vh;
        border-radius: var(--rp-radius) var(--rp-radius) 0 0;
        overflow: hidden;
    }

    .rp-popup__image img {
        height: 100%;
        max-height: 35vh;
    }

    .rp-popup__body {
        padding: 20px 18px 24px;
        max-height: none;
        overflow-y: visible;
    }

    .rp-popup__headline {
        font-size: 17px;
        line-height: 1.3;
    }

    .rp-popup__sub {
        font-size: 13px;
        margin: 0 0 12px;
    }
}

@media (max-width: 480px) {
    .rp-popup__image {
        min-height: 130px;
        max-height: 30vh;
    }

    .rp-popup__image img {
        max-height: 30vh;
    }
}

/* ------------------------------------------------------------------ */
/* Proof & Reassurance                                                  */
/* ------------------------------------------------------------------ */
.rp-popup__proof {
    font-size: 11px;
    font-weight: 700;
    color: var(--rp-primary);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin: 0 0 8px;
    line-height: 1.3;
}

.rp-popup__reassurance {
    font-size: 11px;
    color: var(--rp-text-muted);
    text-align: center;
    margin: 10px 0 0;
    letter-spacing: 0.01em;
    line-height: 1.5;
}

/* ------------------------------------------------------------------ */
/* Image banner variant (two-step top strip, no split layout)          */
/* ------------------------------------------------------------------ */
.rp-popup__image--banner {
    flex: none;
    width: 100%;
    min-height: 180px;
    max-height: 240px;
    border-radius: var(--rp-radius) var(--rp-radius) 0 0;
    overflow: hidden;
}

.rp-popup__image--banner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

/* ------------------------------------------------------------------ */
/* Model A — Two-step micro-commitment                                  */
/* ------------------------------------------------------------------ */
.rp-popup__step {
    display: flex;
    flex-direction: column;
}

.rp-step--hidden {
    display: none !important;
}

.rp-popup__step-question {
    font-family: var(--rp-font);
    font-size: 22px;
    font-weight: 700;
    line-height: 1.25;
    color: var(--rp-text);
    text-align: center;
    margin: 0 0 10px;
    padding: 0;
}

.rp-popup__step-sub {
    font-size: 14px;
    line-height: 1.55;
    color: var(--rp-text-sub);
    text-align: center;
    margin: 0 0 24px;
}

.rp-popup__step-btns {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rp-popup__btn--ghost {
    display: block;
    width: 100%;
    padding: 11px 20px;
    background: transparent;
    color: var(--rp-text-muted);
    font-family: var(--rp-font);
    font-size: 14px;
    font-weight: 400;
    text-align: center;
    border: none;
    border-radius: var(--rp-radius-sm);
    cursor: pointer;
    transition: color var(--rp-transition);
    text-decoration: underline;
    text-underline-offset: 2px;
    line-height: 1;
}

.rp-popup__btn--ghost:hover {
    color: var(--rp-text);
}

/* ------------------------------------------------------------------ */
/* Models B / C / D / E — Recipe list                                   */
/* ------------------------------------------------------------------ */
.rp-popup__recipe-list {
    list-style: none;
    margin: 0 0 14px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.rp-popup__recipe-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 8px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: var(--rp-radius-sm);
    border: 1px solid var(--rp-border);
}

.rp-popup__recipe-thumb {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 6px;
    object-fit: cover;
    display: block;
    background: var(--rp-border);
}

.rp-popup__recipe-no-thumb {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 6px;
    background: var(--rp-border);
}

.rp-popup__recipe-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--rp-text);
    line-height: 1.35;
}

/* ------------------------------------------------------------------ */
/* Mobile — new model adjustments                                       */
/* ------------------------------------------------------------------ */
@media (max-width: 720px) {
    .rp-popup__step-question {
        font-size: 19px;
    }

    .rp-popup__image--banner {
        min-height: 140px;
        max-height: 180px;
        border-radius: var(--rp-radius) var(--rp-radius) 0 0;
    }

    .rp-popup__recipe-list {
        gap: 5px;
    }

    .rp-popup__recipe-item {
        padding: 6px 7px;
        gap: 8px;
    }

    .rp-popup__recipe-thumb,
    .rp-popup__recipe-no-thumb {
        width: 32px;
        height: 32px;
    }
}
