/* ===== Overlay ===== */
#bolsasOverlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(26, 44, 82, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 20px;
}

#bolsasOverlay.is-active {
    display: flex;
}

/* ===== Popup Container ===== */
.bolsas-popup {
    position: relative;
    width: 100%;
    max-width: 880px;
    max-height: calc(100vh - 50px);
    background: #ffffff;
    border-radius: 28px;
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    animation: popupFadeIn 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes popupFadeIn {
    0% {
        opacity: 0;
        transform: scale(0.92) translateY(30px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Faixa decorativa superior */
.bolsas-popup::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 6px;
    background: linear-gradient(90deg, #0d1788, #0f72e9, #0e1d8e);
    z-index: 2;
}

/* ===== Botão Fechar ===== */
.bolsas-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #253b70;
    transition: all 0.3s ease;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.bolsas-close:hover {
    background: #e6c24c;
    color: #fff;
    transform: rotate(90deg);
}

/* ===== Layout Split ===== */
.bolsas-content-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    min-height: 480px;
    max-height: calc(100vh - 40px); /* NOVO — mesmo valor do popup */
    overflow-y: auto; /* NOVO */
    overflow-x: hidden; /* NOVO */
    overscroll-behavior: contain; /* NOVO — evita "vazar" o scroll pro body */
}

/* ===== Lado Imagem ===== */
.bolsas-image-side {
    position: relative;
    overflow: hidden;
    background: linear-gradient(45deg, #0d1788, #0f72e9, #0e1d8e);
    min-height: 320px;
}

.bolsas-image-side img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    transition: transform 0.6s ease;
}

.bolsas-popup:hover .bolsas-image-side img {
    transform: scale(1.04);
}

/* Badge sobre a imagem */
.bolsas-image-badge {
    position: absolute;
    top: 24px;
    left: 24px;
    background: rgba(230, 194, 76, 0.92);
    color: #253b70;
    font-family: "M PLUS Rounded 1c", sans-serif;
    font-weight: 900;
    font-size: 12px;
    padding: 8px 18px;
    border-radius: 50px;
    letter-spacing: 1px;
    text-transform: uppercase;
    backdrop-filter: blur(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* ===== Lado Formulário ===== */
.bolsas-form-side {
    padding: 40px 36px 36px 32px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: #ffffff;
}

.bolsas-form-side .bolsas-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #253b70, #1a2c52);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    box-shadow: 0 8px 24px rgba(37, 59, 112, 0.25);
}

.bolsas-form-side .bolsas-icon i {
    font-size: 28px;
    color: #e6c24c;
}

.bolsas-form-side .bolsas-badge {
    display: inline-block;
    font-family: "M PLUS Rounded 1c", sans-serif;
    font-weight: 900;
    font-size: 12px;
    letter-spacing: 1.5px;
    color: #e6c24c;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.bolsas-form-side h2 {
    font-family: "M PLUS Rounded 1c", sans-serif;
    font-weight: 900;
    font-size: 24px;
    line-height: 32px;
    color: #253b70;
    margin-bottom: 8px;
}

.bolsas-form-side h2 span {
    color: #e6c24c;
}

.bolsas-form-side .bolsas-text {
    font-size: 14px;
    line-height: 22px;
    color: #615e5d;
    margin-bottom: 22px;
}

/* ===== Segmentos ===== */
.bolsas-segmentos {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.segmento-btn {
    flex: 1;
    padding: 12px 10px;
    border: 2px solid #eeede6;
    background: #faf9f6;
    border-radius: 14px;
    font-family: "M PLUS Rounded 1c", sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.segmento-btn strong {
    display: block;
    font-size: 14px;
    color: #253b70;
}

.segmento-btn small {
    display: block;
    font-size: 11px;
    color: #888;
    margin-top: 2px;
}

.segmento-btn.active,
.segmento-btn:hover {
    border-color: #e6c24c;
    background: #fffcf0;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(230, 194, 76, 0.15);
}

.segmento-btn.active strong {
    color: #e6c24c;
}

/* ===== Formulário ===== */
.bolsas-form .bolsas-group {
    position: relative;
    margin-bottom: 14px;
}

.bolsas-form .bolsas-group i {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: #e6c24c;
    font-size: 16px;
    pointer-events: none;
}

.bolsas-form input {
    width: 100%;
    height: 54px;
    border: 2px solid #eeede6;
    background: #f8f7f4;
    border-radius: 14px;
    padding: 10px 18px 10px 46px;
    font-size: 15px;
    font-family: "Open Sans", sans-serif;
    color: #253b70;
    transition: all 0.3s ease;
}

.bolsas-form input::placeholder {
    color: #a7a49f;
}

.bolsas-form input:focus {
    border-color: #e6c24c;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(230, 194, 76, 0.12);
    outline: none;
}

.bolsas-form input.bolsas-invalid {
    border-color: #e8546f;
    animation: bolsas-shake 0.4s ease;
}

@keyframes bolsas-shake {
    0%,
    100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-6px);
    }
    75% {
        transform: translateX(6px);
    }
}

.bolsas-form .bolsas-submit {
    position: relative;
    display: block;
    width: 100%;
    margin-top: 18px;
    padding: 16px 20px;
    border: none;
    border-radius: 14px;
    background: #e6c24c;
    color: #fff;
    font-family: "M PLUS Rounded 1c", sans-serif;
    font-weight: 900;
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    overflow: hidden;
    z-index: 1;
    transition: transform 0.25s ease;
}

.bolsas-form .bolsas-submit::before {
    content: "";
    position: absolute;
    inset: 0;
    background: #253b70;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s ease;
    z-index: -1;
}

.bolsas-form .bolsas-submit:hover::before {
    transform: scaleX(1);
}

.bolsas-form .bolsas-submit:active {
    transform: scale(0.97);
}

.bolsas-form .bolsas-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.bolsas-disclaimer {
    margin-top: 14px;
    font-size: 12px;
    color: #a7a49f;
    line-height: 16px;
    text-align: center;
}

/* ===== Sucesso ===== */
.bolsas-success {
    display: none;
    padding: 10px 0 4px;
    text-align: center;
}

.bolsas-success.is-active {
    display: block;
}

.bolsas-success .bolsas-success-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: #e9f8ee;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bolsas-success .bolsas-success-icon i {
    font-size: 32px;
    color: #3fb673;
}

.bolsas-success h3 {
    font-family: "M PLUS Rounded 1c", sans-serif;
    font-weight: 900;
    font-size: 20px;
    color: #253b70;
    margin-bottom: 6px;
}

.bolsas-success p {
    font-size: 14px;
    color: #615e5d;
    line-height: 22px;
}

/* ===== RESPONSIVO ===== */
@media (max-width: 820px) {
    .bolsas-content-split {
        grid-template-columns: 1fr;
        min-height: auto;
        max-height: calc(100vh - 40px);
    }

    .bolsas-image-side {
        min-height: 240px;
        order: -1;
        /* Imagem vem primeiro no mobile */
    }

    .bolsas-image-side img {
        min-height: 240px;
    }

    .bolsas-form-side {
        padding: 28px 24px 32px;
    }

    .bolsas-form-side h2 {
        font-size: 22px;
        line-height: 30px;
    }

    .bolsas-segmentos {
        gap: 8px;
    }

    .segmento-btn {
        padding: 10px 8px;
    }

    .segmento-btn strong {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    #bolsasOverlay {
        padding: 12px;
    }

    .bolsas-popup {
        border-radius: 20px;
        max-height: calc(100vh - 24px); /* NOVO — bate com padding:12px do overlay */
    }

    .bolsas-content-split {
        max-height: calc(100vh - 24px); /* NOVO */
    }

    .bolsas-image-side {
        min-height: 180px;
    }

    .bolsas-image-side img {
        min-height: 180px;
    }

    .bolsas-form-side {
        padding: 20px 18px 24px;
    }

    .bolsas-form-side h2 {
        font-size: 19px;
        line-height: 26px;
    }

    .bolsas-form-side .bolsas-icon {
        width: 52px;
        height: 52px;
    }

    .bolsas-form-side .bolsas-icon i {
        font-size: 22px;
    }

    .bolsas-form input {
        height: 48px;
        font-size: 14px;
        padding: 8px 14px 8px 40px;
    }

    .bolsas-form .bolsas-submit {
        padding: 14px 16px;
        font-size: 14px;
    }

    .bolsas-close {
        top: 12px;
        right: 12px;
        width: 34px;
        height: 34px;
        font-size: 15px;
    }

    .bolsas-image-badge {
        top: 14px;
        left: 14px;
        font-size: 10px;
        padding: 5px 14px;
    }

    .bolsas-segmentos {
        flex-direction: row;
        gap: 6px;
    }

    .segmento-btn {
        padding: 8px 6px;
    }

    .segmento-btn strong {
        font-size: 12px;
    }

    .segmento-btn small {
        font-size: 10px;
    }
}