/* ============================================================
   EDUCAR MENTES — Modal de Checkout
   Identidade visual Educar Mentes (nao do curso individual)
   Cores: --primary #764DF0 | --secondary #442490 | --dark #101435
   Font: Manrope (herdada do site principal)
   ============================================================ */

/* Overlay */
.em-checkout-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 12, 32, 0.9);
    backdrop-filter: blur(6px);
    z-index: 99999;
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;
}

.em-checkout-overlay.active {
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

/* Container principal */
.em-checkout {
    background: #101435;
    border: 1px solid rgba(118, 77, 240, 0.25);
    border-radius: 16px;
    width: 100%;
    max-width: 520px;
    margin: 40px auto;
    padding: 0;
    position: relative;
    font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(118, 77, 240, 0.08);
    animation: emCheckoutSlideIn 0.3s ease;
}

@keyframes emCheckoutSlideIn {
    from { opacity: 0; transform: translateY(30px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Header do modal */
.em-checkout-header {
    padding: 28px 32px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.em-checkout-header h3 {
    font-family: 'Manrope', sans-serif;
    font-size: 22px;
    font-weight: 800;
    color: #ffffff;
    margin: 0 0 4px 0;
    letter-spacing: -0.02em;
}

.em-checkout-header .em-checkout-desc {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.45);
    margin: 0;
}

.em-checkout-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.35);
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
}

.em-checkout-close:hover {
    color: #ffffff;
}

/* Preco */
.em-checkout-price {
    padding: 16px 32px;
    background: rgba(118, 77, 240, 0.06);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.em-checkout-price .price-original {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.4);
    text-decoration: line-through;
    display: none;
}

.em-checkout-price .price-discount-badge {
    display: none;
    font-size: 12px;
    color: #764DF0;
    background: rgba(118, 77, 240, 0.15);
    padding: 2px 10px;
    border-radius: 12px;
    margin-left: 10px;
    font-weight: 700;
}

.em-checkout-price .price-final {
    font-family: 'Manrope', sans-serif;
    font-size: 36px;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -0.02em;
}

.em-checkout-price .price-parcelas {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 2px;
}

/* Body do formulario */
.em-checkout-body {
    padding: 24px 32px 32px;
}

/* Secao cupom */
.em-cupom-section {
    display: none;
    margin-bottom: 20px;
    padding: 16px;
    background: rgba(118, 77, 240, 0.05);
    border: 1px solid rgba(118, 77, 240, 0.2);
    border-radius: 10px;
}

.em-cupom-section.active {
    display: block;
}

.em-cupom-section .cupom-label {
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #764DF0;
    margin-bottom: 8px;
    font-weight: 700;
}

.em-cupom-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.em-cupom-row input {
    flex: 1;
}

.em-cupom-status {
    font-size: 13px;
    margin-top: 4px;
    min-height: 18px;
}

.em-cupom-status.success { color: #27ae60; }
.em-cupom-status.error   { color: #e74c3c; }

/* Campos de formulario */
.em-form-group {
    margin-bottom: 16px;
}

.em-form-group label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.45);
    margin-bottom: 6px;
}

.em-form-group input,
.em-form-group select {
    width: 100%;
    padding: 13px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #ffffff;
    font-family: 'Manrope', sans-serif;
    font-size: 15px;
    font-weight: 500;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.em-form-group input::placeholder {
    color: rgba(255, 255, 255, 0.2);
}

.em-form-group input:focus,
.em-form-group select:focus {
    border-color: #764DF0;
    box-shadow: 0 0 0 3px rgba(118, 77, 240, 0.15);
}

/* Select de parcelamento */
.em-form-group select {
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23764DF0' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

/* As options sao renderizadas pelo SO — forcar fundo escuro onde suportado */
.em-form-group select option {
    background: #101435;
    color: #ffffff;
}

.em-form-group input.em-error {
    border-color: #e74c3c;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.12);
}

.em-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* Seletor de metodo de pagamento */
.em-metodo-selector {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.em-metodo-btn {
    flex: 1;
    padding: 14px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.02);
    color: rgba(255, 255, 255, 0.4);
    font-family: 'Manrope', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.em-metodo-btn:hover {
    border-color: rgba(118, 77, 240, 0.4);
    color: #ffffff;
}

.em-metodo-btn.active {
    border-color: #764DF0;
    background: rgba(118, 77, 240, 0.1);
    color: #764DF0;
}

.em-metodo-btn i {
    display: block;
    font-size: 22px;
    margin-bottom: 6px;
}

/* Secoes de cartao e pix */
.em-card-section,
.em-pix-section {
    display: none;
}

.em-card-section.active,
.em-pix-section.active {
    display: block;
}

/* QR Code Pix */
.em-pix-qrcode {
    text-align: center;
    padding: 20px;
}

.em-pix-qrcode img {
    width: 200px;
    height: 200px;
    border-radius: 8px;
    margin-bottom: 12px;
}

.em-pix-copy {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.em-pix-copy input {
    flex: 1;
    font-size: 12px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: #ffffff;
}

/* Resumo itemizado */
.em-resumo {
    margin: 4px 0 16px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
}

.em-resumo-linha {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 8px;
}

.em-resumo-linha span:last-child {
    color: rgba(255, 255, 255, 0.85);
    font-weight: 600;
}

.em-resumo-linha.em-resumo-desconto span:last-child {
    color: #6bd38a;
}

.em-resumo-linha.em-resumo-taxa span:last-child {
    color: rgba(255, 255, 255, 0.6);
    font-weight: 600;
}

.em-resumo-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 15px;
    color: #ffffff;
}

.em-resumo-total span:first-child {
    font-weight: 600;
    color: rgba(255, 255, 255, 0.75);
}

.em-resumo-total span:last-child {
    font-size: 20px;
    font-weight: 800;
    color: #764DF0;
}

/* Botao principal */
.em-checkout-submit {
    width: 100%;
    padding: 16px;
    background: #764DF0;
    color: #ffffff;
    border: none;
    border-radius: 10px;
    font-family: 'Manrope', sans-serif;
    font-size: 15px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    margin-top: 8px;
}

.em-checkout-submit:hover {
    background: #8a63f7;
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(118, 77, 240, 0.35);
}

.em-checkout-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.em-checkout-submit .em-spinner {
    display: none;
    width: 22px;
    height: 22px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: emSpin 0.7s linear infinite;
    margin: 0 auto;
}

@keyframes emSpin {
    to { transform: rotate(360deg); }
}

.em-checkout-submit.loading .em-btn-text { display: none; }
.em-checkout-submit.loading .em-spinner  { display: block; }

/* Seguranca */
.em-checkout-security {
    text-align: center;
    margin-top: 16px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.25);
}

.em-checkout-security i {
    margin-right: 4px;
}

/* Sucesso */
.em-checkout-success {
    display: none;
    text-align: center;
    padding: 48px 32px;
}

.em-checkout-success.active {
    display: block;
}

.em-checkout-success i {
    font-size: 60px;
    color: #764DF0;
    margin-bottom: 16px;
}

.em-checkout-success h3 {
    font-family: 'Manrope', sans-serif;
    font-size: 24px;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 12px;
}

.em-checkout-success p {
    color: rgba(255, 255, 255, 0.5);
    font-size: 15px;
    line-height: 1.6;
}

/* Erro global */
.em-checkout-error {
    display: none;
    background: rgba(231, 76, 60, 0.08);
    border: 1px solid rgba(231, 76, 60, 0.25);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 13px;
    color: #e74c3c;
}

.em-checkout-error.active {
    display: block;
}

/* Validar cupom btn */
.em-btn-validar {
    padding: 13px 20px;
    background: #764DF0;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-family: 'Manrope', sans-serif;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
}

.em-btn-validar:hover {
    background: #8a63f7;
}

.em-btn-validar:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Botao copiar Pix */
.em-btn-copiar {
    padding: 10px 16px;
    background: #764DF0;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-family: 'Manrope', sans-serif;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
}

.em-btn-copiar:hover {
    background: #8a63f7;
}

/* Responsivo */
@media (max-width: 560px) {
    .em-checkout {
        margin: 10px auto;
        border-radius: 12px;
    }

    .em-checkout-header,
    .em-checkout-body {
        padding-left: 20px;
        padding-right: 20px;
    }

    .em-checkout-price {
        padding-left: 20px;
        padding-right: 20px;
    }

    .em-form-row {
        grid-template-columns: 1fr;
    }

    .em-checkout-price .price-final {
        font-size: 28px;
    }
}
