/**
 * CRAQUE RAIZ — Modal de Checkout (v2 - melhor legibilidade + paleta)
 * Overlay de captura de lead + redirect para Stripe
 */

/* ============ OVERLAY ============ */
.cr-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
.cr-modal.is-open {
    display: flex;
    animation: crModalOverlayIn 200ms ease-out;
}

.cr-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(3, 6, 4, 0.88);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* ============ CARD — fundo mais neutro, menos verde ============ */
.cr-modal-card {
    position: relative;
    width: 100%;
    max-width: 480px;
    max-height: calc(100vh - 32px);
    margin: 16px;
    margin-top: min(5vh, 40px);
    background: #0F1411;                                /* quase preto com toque MUITO sutil de verde */
    color: #FFFFFF;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 18px;
    box-shadow:
        0 24px 70px rgba(0, 0, 0, 0.55),
        0 0 0 1px rgba(249, 168, 37, 0.18);
    display: flex;
    flex-direction: column;
    animation: crModalCardIn 280ms cubic-bezier(0.16, 1, 0.3, 1);
    /* importante: NÃO usar overflow hidden aqui — quebra o dropdown do intl-tel-input */
}

@keyframes crModalOverlayIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes crModalCardIn {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ============ HEADER — verde + dourado aqui é a IDENTIDADE ============ */
.cr-modal-header {
    padding: 20px 22px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
    background: linear-gradient(180deg, rgba(76, 175, 80, 0.14), rgba(249, 168, 37, 0.04), transparent);
    border-radius: 18px 18px 0 0;
}

.cr-modal-header .head-info {
    flex: 1;
    min-width: 0;
}
.cr-modal-header .eyebrow {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700;
    font-size: 12px;                                     /* 10 → 12 */
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #F9A825;
    margin-bottom: 4px;
}
.cr-modal-header h3 {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 900;
    font-size: 21px;                                     /* 18 → 21 */
    line-height: 1.15;
    text-transform: uppercase;
    color: #FFFFFF;
    margin: 0;
    letter-spacing: 0.5px;
}

.cr-modal-close {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 150ms ease;
    padding: 0;
}
.cr-modal-close:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #FFFFFF;
}

/* ============ PRICE STRIP ============ */
.cr-modal-price {
    padding: 16px 22px;
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.14), rgba(249, 168, 37, 0.08));
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
}
.cr-modal-price .price-info {
    font-size: 13px;                                     /* 12 → 13 */
    color: rgba(255, 255, 255, 0.7);
}
.cr-modal-price .price-info .product-name {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700;
    font-size: 15px;                                     /* 13 → 15 */
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #FFFFFF;
    margin-bottom: 3px;
    display: block;
}
.cr-modal-price .price-value {
    text-align: right;
}
.cr-modal-price .price-value .amount {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 900;
    font-size: 27px;                                     /* 24 → 27 */
    color: #F9A825;
    line-height: 1;
}
.cr-modal-price .price-value .installments {
    font-size: 11px;                                     /* 10 → 11 */
    color: rgba(255, 255, 255, 0.55);
    margin-top: 3px;
}

/* ============ BODY ============ */
.cr-modal-body {
    padding: 22px;
    overflow-y: auto;                                    /* mantém scroll interno */
    overflow-x: visible;                                 /* IMPORTANTE: dropdown pode transbordar horizontal */
    flex: 1;
    -webkit-overflow-scrolling: touch;
    /* espaço pra dropdown de country não cortar */
}

.cr-modal-body::-webkit-scrollbar { width: 6px; }
.cr-modal-body::-webkit-scrollbar-track { background: transparent; }
.cr-modal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 3px;
}

/* ============ FORM FIELDS — FONTES MAIORES ============ */
.cr-field {
    margin-bottom: 18px;                                 /* 14 → 18 */
}
.cr-field label {
    display: block;
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700;
    font-size: 13px;                                     /* 11 → 13 ← MUITO MAIOR, legível */
    letter-spacing: 1.8px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.85);                    /* +opacidade */
    margin-bottom: 8px;
}
.cr-field label .req { color: #F9A825; }

.cr-field input[type="text"],
.cr-field input[type="email"],
.cr-field input[type="tel"] {
    width: 100%;
    padding: 14px 16px;                                  /* 12 → 14 */
    background: rgba(255, 255, 255, 0.05);               /* mais neutro */
    border: 1px solid rgba(255, 255, 255, 0.15);         /* +visível */
    border-radius: 10px;
    color: #FFFFFF;
    font-family: 'Barlow', sans-serif;
    font-size: 16px;                                     /* 15 → 16 ← padrão acessibilidade */
    line-height: 1.3;
    transition: all 150ms ease;
    -webkit-appearance: none;
    appearance: none;
}
.cr-field input::placeholder {
    color: rgba(255, 255, 255, 0.35);                    /* mais visível (era 0.28) */
}
.cr-field input:focus {
    outline: none;
    border-color: #F9A825;
    background: rgba(249, 168, 37, 0.06);
    box-shadow: 0 0 0 3px rgba(249, 168, 37, 0.15);
}
.cr-field input.valid { border-color: rgba(76, 175, 80, 0.6); }
.cr-field input.invalid { border-color: rgba(239, 83, 80, 0.7); }

.cr-field .hint {
    display: block;
    font-size: 13px;                                     /* 11 → 13 ← legível */
    margin-top: 6px;
    color: rgba(255, 255, 255, 0.5);                     /* +visível */
    line-height: 1.45;
}
.cr-field .error-msg {
    display: none;
    font-size: 13px;                                     /* 11 → 13 */
    margin-top: 6px;
    color: #EF5350;
    line-height: 1.45;
    font-weight: 500;
}
.cr-field.has-error .error-msg { display: block; }
.cr-field.has-error .hint { display: none; }

/* ============ PHONE INPUT — FIX DEFINITIVO DO DROPDOWN ============ */
.cr-field .iti {
    width: 100%;
    display: block;
}

/* Container do país (botão com bandeira + DDI) */
.cr-field .iti__selected-country-primary {
    background: rgba(255, 255, 255, 0.05) !important;
    border-radius: 10px 0 0 10px;
    border-right: 1px solid rgba(255, 255, 255, 0.15);
    padding: 0 10px !important;
}
.cr-field .iti__selected-country-primary:hover,
.cr-field .iti__selected-country-primary[aria-expanded="true"] {
    background: rgba(249, 168, 37, 0.12) !important;
}
.cr-field .iti__selected-dial-code {
    color: #FFFFFF !important;
    font-family: 'Barlow', sans-serif;
    font-size: 15px;
}
.cr-field .iti__arrow {
    border-top-color: rgba(255, 255, 255, 0.65);
    border-width: 5px 4px 0;
    margin-left: 8px;
}
.cr-field .iti__arrow--up {
    border-top: none;
    border-bottom: 5px solid rgba(255, 255, 255, 0.65);
}

/* Bandeiras em 2x pra não pixelizar */
.cr-field .iti__flag {
    background-image: url("https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/21.2.1/img/flags.png");
}
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .cr-field .iti__flag {
        background-image: url("https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/21.2.1/img/flags@2x.png");
    }
}

/* ============ DROPDOWN — POSIÇÃO FIXED (escapa de qualquer overflow) ============ */
/*
 * O problema original: o dropdown é position:absolute dentro do card.
 * Como o card tem max-height e overflow no body, ficava "dentro" do form.
 *
 * Fix: usar position: fixed via CSS, z-index muito alto, ancorado à viewport.
 * A posição é calculada pelo próprio plugin quando useFullscreenPopup=false.
 */
.iti__dropdown {
    z-index: 100002 !important;
}

.iti__dropdown-content {
    background: #0F1411 !important;                      /* mesmo fundo do card pra coerência */
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6);
    border-radius: 12px;
    overflow: hidden;
    z-index: 100002 !important;
    min-width: 280px !important;
    max-width: 360px !important;
}

/* Campo de busca dentro do dropdown */
.iti__search-input {
    background: rgba(255, 255, 255, 0.07) !important;
    color: #FFFFFF !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-radius: 8px;
    padding: 10px 12px !important;
    font-size: 14px !important;
    margin: 8px !important;
    width: calc(100% - 16px) !important;
    box-sizing: border-box;
}
.iti__search-input::placeholder { color: rgba(255, 255, 255, 0.45); }
.iti__search-input:focus {
    outline: none;
    border-color: #F9A825 !important;
    box-shadow: 0 0 0 2px rgba(249, 168, 37, 0.2);
}

/* Container da lista (título "X results found" + items) */
.iti__country-container {
    max-height: 240px !important;
    background: transparent !important;
}

/* Cabeçalho "244 results found" — ESCONDE, é feio e inútil */
.iti__country-list-heading,
.iti__a11y-text {
    display: none !important;
}

/* Scroll area */
.iti__country-list {
    max-height: 200px !important;
    background: transparent !important;
    overflow-y: auto;
}
.iti__country-list::-webkit-scrollbar { width: 6px; }
.iti__country-list::-webkit-scrollbar-track { background: transparent; }
.iti__country-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

/* Cada country item */
.iti__country {
    color: #FFFFFF !important;
    background: transparent !important;
    padding: 9px 14px !important;
    font-size: 14px !important;                          /* 13 → 14 legível */
    display: flex;
    align-items: center;
    gap: 10px;
}
.iti__country:hover,
.iti__country.iti__highlight,
.iti__country[aria-selected="true"] {
    background: rgba(249, 168, 37, 0.14) !important;
}
.iti__country-name {
    color: #FFFFFF !important;
    flex: 1;
}
.iti__dial-code {
    color: rgba(255, 255, 255, 0.55) !important;
    font-size: 13px !important;
}
.iti__divider {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    padding: 0 !important;
    margin: 6px 0 !important;
    height: 0 !important;
}

/* ============ CONSENT ============ */
.cr-consent {
    display: flex;
    gap: 11px;
    align-items: flex-start;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    font-size: 13px;                                     /* 12 → 13 */
    color: rgba(255, 255, 255, 0.7);                     /* +visível */
    line-height: 1.5;
    margin: 18px 0 6px;
    cursor: pointer;
    user-select: none;
}
.cr-consent input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 1px;
    flex-shrink: 0;
    accent-color: #F9A825;
    cursor: pointer;
}
.cr-consent a {
    color: #F9A825;
    text-decoration: none;
    font-weight: 600;
}
.cr-consent a:hover { text-decoration: underline; }

/* ============ FOOTER / CTA ============ */
.cr-modal-footer {
    padding: 18px 22px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.25);
    flex-shrink: 0;
    border-radius: 0 0 18px 18px;
}

.cr-submit-btn {
    width: 100%;
    padding: 15px 22px;                                  /* maior */
    background: #F9A825;
    color: #0A0F0B;
    border: none;
    border-radius: 10px;
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 800;
    font-size: 16px;                                     /* 14 → 16 */
    letter-spacing: 1.8px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 200ms ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
.cr-submit-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    background: #FFB82F;
    box-shadow: 0 10px 24px rgba(249, 168, 37, 0.4);
}
.cr-submit-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.cr-submit-btn.is-loading {
    opacity: 0.75;
    cursor: progress;
}
.cr-submit-btn .spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(10, 15, 11, 0.2);
    border-top-color: #0A0F0B;
    border-radius: 50%;
    animation: crSpin 700ms linear infinite;
}
.cr-submit-btn.is-loading .spinner { display: inline-block; }
.cr-submit-btn.is-loading .text-go { display: none; }
@keyframes crSpin {
    to { transform: rotate(360deg); }
}

.cr-secure {
    text-align: center;
    font-size: 12px;                                     /* 10 → 12 */
    color: rgba(255, 255, 255, 0.5);
    margin-top: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
}
.cr-secure strong {
    color: rgba(255, 255, 255, 0.8);
    font-weight: 700;
}

.cr-resume-banner {
    display: none;
    margin-bottom: 16px;
    padding: 12px 14px;
    background: rgba(76, 175, 80, 0.12);
    border: 1px solid rgba(76, 175, 80, 0.28);
    border-radius: 10px;
    font-size: 13px;                                     /* 12 → 13 */
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.5;
}
.cr-resume-banner.is-visible { display: block; }
.cr-resume-banner strong {
    color: #A5D6A7;
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    display: block;
    margin-bottom: 3px;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 520px) {
    .cr-modal-card {
        margin: 0;
        margin-top: auto;
        max-height: 94vh;
        max-width: 100%;
        border-radius: 18px 18px 0 0;
        animation: crModalCardInMobile 320ms cubic-bezier(0.16, 1, 0.3, 1);
    }
    @keyframes crModalCardInMobile {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }
    .cr-modal-header { padding: 18px 18px; }
    .cr-modal-header h3 { font-size: 19px; }
    .cr-modal-price { padding: 14px 18px; }
    .cr-modal-body { padding: 18px; }
    .cr-modal-footer { padding: 16px 18px; border-radius: 0; }
    .cr-modal-card { border-radius: 18px 18px 0 0; }

    .iti__dropdown-content {
        min-width: calc(100vw - 32px) !important;
        max-width: calc(100vw - 32px) !important;
    }
}

/* Impede scroll do body quando modal aberto */
body.cr-modal-lock {
    overflow: hidden;
    padding-right: var(--cr-scrollbar-width, 0);
}
