/**
 * Cartão de crédito (Asaas) — mesmo visual do formulário do Mercado Pago.
 * Os IDs repetidos (:is(#tgcc-form,#tgsc-form):is(#tgcc-form,#tgsc-form):is(#tgcc-form,#tgsc-form)) vencem as regras genéricas de
 * inputs do tema/templates (#tg-app … #payment … !important).
 */
:is(#tgcc-form,#tgsc-form) {
    --cc-primary: #009ee3;
    --cc-primary-soft: rgba(0, 158, 227, .12);
    --cc-error: #d92d3a;
    --cc-text: #1f2329;
    --cc-muted: #6b7280;
    --cc-border: #d9dde3;
    --cc-surface: #fff;
    --cc-card: #fff;
    --cc-alt: #f6f8fa;
    --cc-h: 48px;
    font-family: inherit;
    font-size: 15px;
    line-height: 1.45;
    color: var(--cc-text);
    margin: 0;
}
body.tg-sx-dark :is(#tgcc-form,#tgsc-form),
body.mp3ds-is-dark :is(#tgcc-form,#tgsc-form) {
    --cc-primary: #3aa8ff;
    --cc-primary-soft: rgba(58, 168, 255, .18);
    --cc-error: #ff5c7a;
    --cc-text: #e9ebef;
    --cc-muted: #9aa1ac;
    --cc-border: #30353e;
    --cc-surface: #1f232a;
    --cc-card: #181b21;
    --cc-alt: #262a32;
}
:is(#tgcc-form,#tgsc-form) *, :is(#tgcc-form,#tgsc-form) *::before, :is(#tgcc-form,#tgsc-form) *::after { box-sizing: border-box; }

/* Aviso de sandbox */
:is(#tgcc-form,#tgsc-form) .tgcc-sandbox {
    display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline;
    margin: 0 0 14px; padding: 10px 14px; border-radius: 8px;
    background: #fff6e5; border: 1px solid #f5c26b; color: #7a4b00; font-size: 13px;
}
:is(#tgcc-form,#tgsc-form) .tgcc-sandbox strong {
    text-transform: uppercase; letter-spacing: .04em; font-size: 11px;
    background: #f59e0b; color: #fff; border-radius: 4px; padding: 2px 6px;
}
body.tg-sx-dark :is(#tgcc-form,#tgsc-form) .tgcc-sandbox { background: rgba(245, 158, 11, .12); border-color: rgba(245, 158, 11, .45); color: #fcd58a; }

/* Container */
:is(#tgcc-form,#tgsc-form):is(#tgcc-form,#tgsc-form):is(#tgcc-form,#tgsc-form) .tgcc-card {
    background: var(--cc-card) !important;
    border: 1px solid var(--cc-border) !important;
    border-radius: 14px;
    padding: 18px 18px 6px;
    color: var(--cc-text) !important;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}
body.tg-sx-dark :is(#tgcc-form,#tgsc-form):is(#tgcc-form,#tgsc-form):is(#tgcc-form,#tgsc-form) .tgcc-card { box-shadow: none; }

:is(#tgcc-form,#tgsc-form) .tgcc-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 16px; }
:is(#tgcc-form,#tgsc-form):is(#tgcc-form,#tgsc-form):is(#tgcc-form,#tgsc-form) .tgcc-title { font-weight: 600; font-size: 15px; color: var(--cc-text) !important; }
:is(#tgcc-form,#tgsc-form) .tgcc-brands { display: flex; flex-wrap: wrap; gap: 6px; list-style: none !important; margin: 0 !important; padding: 0 !important; }
:is(#tgcc-form,#tgsc-form) .tgcc-brands li { margin: 0 !important; padding: 0 !important; line-height: 0; border-radius: 4px; list-style: none !important; transition: opacity .18s, transform .18s, box-shadow .18s; }
:is(#tgcc-form,#tgsc-form) .tgcc-brands li::before { display: none !important; }
:is(#tgcc-form,#tgsc-form) .tgcc-brands img {
    display: block; width: 39px !important; height: 25px !important; max-width: none !important; max-height: none !important;
    margin: 0 !important; padding: 0 !important; border: 0 !important; border-radius: 4px; float: none !important;
    box-shadow: 0 0 0 1px rgba(16, 24, 40, .08) !important;
}
body.tg-sx-dark :is(#tgcc-form,#tgsc-form) .tgcc-brands img { box-shadow: 0 0 0 1px rgba(255, 255, 255, .08) !important; }
:is(#tgcc-form,#tgsc-form) .tgcc-brands.has-active li { opacity: .35; }
:is(#tgcc-form,#tgsc-form) .tgcc-brands.has-active li.is-active { opacity: 1; transform: translateY(-1px); box-shadow: 0 0 0 2px var(--cc-primary); }

/* Campos */
:is(#tgcc-form,#tgsc-form) .tgcc-field { margin: 0 0 14px; position: relative; min-width: 0; }
:is(#tgcc-form,#tgsc-form) .tgcc-row { display: flex; gap: 12px; align-items: flex-end; }  /* rótulo que quebra em 2 linhas não desalinha os campos */
:is(#tgcc-form,#tgsc-form) .tgcc-row > .tgcc-field { flex: 1 1 0; }
:is(#tgcc-form,#tgsc-form):is(#tgcc-form,#tgsc-form):is(#tgcc-form,#tgsc-form) .tgcc-field label {
    display: flex; align-items: center; gap: 6px; min-height: 17px;
    margin: 0 0 6px !important; padding: 0 !important;
    font-weight: 600 !important; font-size: 13px !important; line-height: 1.3 !important;
    color: var(--cc-text) !important; opacity: 1 !important;
}
:is(#tgcc-form,#tgsc-form) .tgcc-hint {
    display: inline-flex; align-items: center; justify-content: center; flex: 0 0 16px;
    width: 16px; height: 16px; margin-left: auto; border-radius: 50%;
    background: var(--cc-alt); border: 1px solid var(--cc-border); color: var(--cc-muted);
    font-size: 10px; font-weight: 700; cursor: help;
}
:is(#tgcc-form,#tgsc-form) .tgcc-wrap { position: relative; }

:is(#tgcc-form,#tgsc-form):is(#tgcc-form,#tgsc-form):is(#tgcc-form,#tgsc-form) .tgcc-input {
    display: block; width: 100% !important; height: var(--cc-h) !important; min-height: 0 !important;
    margin: 0 !important; padding: 0 14px !important;
    border: 1px solid var(--cc-border) !important; border-radius: 8px !important;
    background-color: var(--cc-surface) !important; color: var(--cc-text) !important;
    font-family: inherit !important; font-size: 16px !important; /* 16px: sem zoom no iOS */
    line-height: normal !important; box-shadow: none !important; outline: none !important;
    transition: border-color .18s, box-shadow .18s;
    color-scheme: light;
    touch-action: manipulation;
}
body.tg-sx-dark :is(#tgcc-form,#tgsc-form):is(#tgcc-form,#tgsc-form):is(#tgcc-form,#tgsc-form) .tgcc-input { color-scheme: dark; }
:is(#tgcc-form,#tgsc-form):is(#tgcc-form,#tgsc-form):is(#tgcc-form,#tgsc-form) #tgcc-number { padding-right: 62px !important; letter-spacing: .3px; }
:is(#tgcc-form,#tgsc-form):is(#tgcc-form,#tgsc-form):is(#tgcc-form,#tgsc-form) .tgcc-input::placeholder { color: #9aa1ab !important; opacity: 1; text-transform: none; }
body.tg-sx-dark :is(#tgcc-form,#tgsc-form):is(#tgcc-form,#tgsc-form):is(#tgcc-form,#tgsc-form) .tgcc-input::placeholder { color: #7d8490 !important; }
:is(#tgcc-form,#tgsc-form):is(#tgcc-form,#tgsc-form):is(#tgcc-form,#tgsc-form) .tgcc-upper { text-transform: uppercase; }
:is(#tgcc-form,#tgsc-form):is(#tgcc-form,#tgsc-form):is(#tgcc-form,#tgsc-form) .tgcc-input:focus { border-color: var(--cc-primary) !important; box-shadow: 0 0 0 3px var(--cc-primary-soft) !important; }
:is(#tgcc-form,#tgsc-form):is(#tgcc-form,#tgsc-form):is(#tgcc-form,#tgsc-form) .tgcc-input.is-bad { border-color: var(--cc-error) !important; box-shadow: 0 0 0 3px rgba(217, 45, 58, .1) !important; }
:is(#tgcc-form,#tgsc-form):is(#tgcc-form,#tgsc-form):is(#tgcc-form,#tgsc-form) .tgcc-input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 40px var(--cc-surface) inset !important;
    -webkit-text-fill-color: var(--cc-text) !important;
}
:is(#tgcc-form,#tgsc-form):is(#tgcc-form,#tgsc-form):is(#tgcc-form,#tgsc-form) .tgcc-select {
    padding-right: 36px !important; cursor: pointer; text-overflow: ellipsis;
    -webkit-appearance: none !important; -moz-appearance: none !important; appearance: none !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%236b7280' stroke-width='1.6' d='M2.5 4.5 6 8l3.5-3.5'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important; background-position: right 14px center !important; background-size: 12px 12px !important;
}
body.tg-sx-dark :is(#tgcc-form,#tgsc-form):is(#tgcc-form,#tgsc-form):is(#tgcc-form,#tgsc-form) .tgcc-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%23c9ced6' stroke-width='1.6' d='M2.5 4.5 6 8l3.5-3.5'/%3E%3C/svg%3E") !important;
}
body.tg-sx-dark :is(#tgcc-form,#tgsc-form) .tgcc-select option { background: #1f232a; color: #e9ebef; }

/* Bandeira dentro do campo do número */
:is(#tgcc-form,#tgsc-form) .tgcc-brand-ico {
    position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
    width: 40px; height: 26px; pointer-events: none;
    background: no-repeat center / contain;
}

/* Erros e rodapé */
:is(#tgcc-form,#tgsc-form) .tgcc-err {
    margin: 0 0 14px; padding: 10px 14px; border-radius: 8px; font-size: 13.5px;
    background: #fdeff0; border: 1px solid rgba(217, 45, 58, .35); border-left: 4px solid var(--cc-error); color: #8f1621;
}
body.tg-sx-dark :is(#tgcc-form,#tgsc-form) .tgcc-err { background: rgba(255, 92, 122, .1); border-color: rgba(255, 92, 122, .4); border-left-color: var(--cc-error); color: #ffb3c1; }
:is(#tgcc-form,#tgsc-form) .tgcc-err[hidden] { display: none !important; }
:is(#tgcc-form,#tgsc-form):is(#tgcc-form,#tgsc-form):is(#tgcc-form,#tgsc-form) .tgcc-secure {
    display: flex; align-items: center; gap: 6px; margin: -2px 0 14px !important; padding: 0 !important;
    font-size: 12px !important; line-height: 1.4; color: var(--cc-muted) !important;
}
:is(#tgcc-form,#tgsc-form) .tgcc-secure svg { flex-shrink: 0; color: var(--cc-primary); }

@media (max-width: 380px) {
    :is(#tgcc-form,#tgsc-form):is(#tgcc-form,#tgsc-form):is(#tgcc-form,#tgsc-form) .tgcc-card { padding: 14px 12px 4px; }
    :is(#tgcc-form,#tgsc-form) .tgcc-row { gap: 10px; }
}

/* WooCommerce pinta .payment_box com fundo cinza e seta: o cartão já é a caixa */
#payment .payment_box.payment_method_tg_card { padding: 0 !important; background: transparent !important; box-shadow: none !important; }
#payment .payment_box.payment_method_tg_card::before { display: none !important; }

/* Aviso de 3D Secure (mesmo do formulário do Mercado Pago) */
:is(#tgcc-form,#tgsc-form) .tgcc-3ds {
    display: flex; gap: 10px; align-items: flex-start; margin: 4px 0 14px; padding: 12px 14px; border-radius: 8px;
    background: #eef8fd; border: 1px solid #cdebf8; color: #0b4f6c; font-size: 13px; line-height: 1.45;
}
:is(#tgcc-form,#tgsc-form) .tgcc-3ds svg { flex-shrink: 0; margin-top: 1px; color: var(--cc-primary); }
:is(#tgcc-form,#tgsc-form) .tgcc-3ds strong { display: block; margin-bottom: 2px; font-size: 13px; color: #073b52; }
:is(#tgcc-form,#tgsc-form) .tgcc-3ds span { display: block; }
body.tg-sx-dark :is(#tgcc-form,#tgsc-form) .tgcc-3ds, body.mp3ds-is-dark :is(#tgcc-form,#tgsc-form) .tgcc-3ds { background: rgba(58, 168, 255, .08); border-color: rgba(58, 168, 255, .28); color: #b9dcf7; }
body.tg-sx-dark :is(#tgcc-form,#tgsc-form) .tgcc-3ds strong, body.mp3ds-is-dark :is(#tgcc-form,#tgsc-form) .tgcc-3ds strong { color: #e3f2fd; }

/* Cartão Stripe (Payment Element) — mesmo visual do cartão Asaas/Mercado Pago */
#tgsc-form .tgsc-element { min-height: 118px; margin: 0 0 14px; }
#tgsc-form .tgsc-loading { padding: 40px 0; text-align: center; font-size: 13px; color: var(--cc-muted); }
#payment .payment_box.payment_method_tg_stripe_card { padding: 0 !important; background: transparent !important; box-shadow: none !important; }
#payment .payment_box.payment_method_tg_stripe_card::before { display: none !important; }
