/* ---- Registration form ----
   Hardened for embedding inside Elementor (which wraps shortcode output
   in a flex "elementor-widget-container" and applies its own global
   Typography Kit to bare <p>/<h*> tags) and the Blocksy theme (which
   applies its own site-wide form-control and button styling via plain
   element selectors like `input`, `button`). Rather than <p> wrappers
   with browser-default margins (previously at the mercy of Elementor's
   global paragraph spacing), every field is a dedicated .etf-field
   block we fully control; box-sizing and sizing-critical properties are
   set !important so the form looks the same regardless of where the
   shortcode is placed or which page builder/theme combination is
   active. */
.etf-registration-form,
.etf-registration-form *,
.etf-registration-form *::before,
.etf-registration-form *::after {
    box-sizing: border-box !important;
}
.etf-registration-form {
    max-width: 420px;
    width: 100% !important;
    margin: 1.5em 0;
    float: none !important;
    display: block !important;
}
/* Higher-specificity + !important so this reliably beats the
   display:block !important rule above once the form is submitted —
   jQuery's own .hide() only sets an inline style, which a stylesheet
   !important rule (the one above) would otherwise silently override,
   leaving the form visible above the ticket instead of being replaced
   by it. */
.etf-registration-form.etf-form-hidden {
    display: none !important;
}
.etf-field {
    margin: 0 0 1em;
    clear: both;
}
.etf-hp-field {
    position: absolute !important;
    left: -9999px !important;
    top: -9999px !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
}
.etf-registration-form label {
    display: block !important;
    font-weight: 600;
    margin: 0 0 .25em;
    float: none !important;
    width: auto !important;
}
.etf-registration-form input[type="text"],
.etf-registration-form input[type="email"],
.etf-registration-form input[type="tel"] {
    display: block;
    width: 100% !important;
    max-width: 100%;
    padding: .6em .75em;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #fff;
    line-height: normal;
    font-size: 1em;
    font-family: inherit;
    -webkit-appearance: none;
    appearance: none;
    box-shadow: none;
    float: none;
}
.etf-registration-form select {
    display: block;
    width: 100% !important;
    max-width: 100%;
    padding: .6em .75em;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #fff;
    line-height: normal;
    font-size: 1em;
    font-family: inherit;
    box-shadow: none;
    float: none;
}
.etf-registration-form fieldset {
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: .75em 1em 1em;
    margin: 0 0 1em;
    min-width: 0;
    float: none !important;
    width: auto;
}
.etf-registration-form legend {
    font-weight: 600;
    padding: 0 .4em;
    width: auto !important;
    border: none;
    float: none !important;
}
.etf-checkbox-label,
.etf-radio-label {
    display: block !important;
    font-weight: 400;
    margin: .4em 0;
    cursor: pointer;
    float: none !important;
    width: auto !important;
}
.etf-checkbox-label input,
.etf-radio-label input {
    display: inline-block !important;
    margin-right: .5em;
    width: auto !important;
    float: none !important;
}
.etf-radio-fieldset .etf-radio-label {
    display: inline-block !important;
    margin-right: 1.5em;
}
.etf-terms-field .etf-checkbox-label {
    font-size: .92em;
}
.etf-terms-field a {
    color: #1d4ed8;
    text-decoration: underline;
}
.etf-consent-field {
    background: #f9fafb;
    border-radius: 6px;
    padding: .8em .9em;
    margin: 0 0 .8em;
}
.etf-consent-field .etf-checkbox-label {
    font-size: .88em;
    line-height: 1.4;
}
.etf-consent-note {
    display: block;
    color: #6b7280;
    font-size: .9em;
    margin-top: .3em;
}
.etf-role-other {
    margin-top: .5em;
}

/* Deliberately NOT !important on background/color/border/etc — unlike
   the rest of this file's hardening, these ARE meant to be overridden,
   so the theme's own ".button" styling (Blocksy, or any other theme
   that styles this WordPress-standard class) shows through instead of
   a fixed plugin-brand color. Only structural properties that would
   otherwise break the layout (not just the look) stay forced. If the
   active theme doesn't style ".button" itself, these plain fallback
   values still give a reasonable default appearance. */
.etf-submit-btn {
    display: inline-block !important;
    width: auto;
    float: none !important;
    cursor: pointer;
    font-size: 1em;
    padding: .7em 1.5em;
    border-radius: 6px;
    background: #1d4ed8;
    color: #fff;
    border: none;
}
.etf-submit-btn:hover {
    background: #1e40af;
}
.etf-registration-form button:disabled {
    opacity: .6;
    cursor: default;
}
.etf-form-message {
    margin-top: .75em;
    font-weight: 600;
}
.etf-form-message.error { color: #b91c1c; }
.etf-form-message.success { color: #15803d; }

.etf-notice {
    padding: 1em;
    border-radius: 6px;
    background: #fef2f2;
    color: #991b1b;
    font-weight: 600;
}
.etf-notice-waitlist {
    background: #fffbeb;
    color: #92400e;
    margin-bottom: 1em;
}

/* ---- Registration form: layout "cartão" em duas colunas ----
   Só o formulário de inscrição (.etf-reg-form); os formulários de
   recuperar/cancelar bilhete continuam estreitos. Duas colunas a partir
   de 700px, uma coluna no telemóvel (campos a 16px para o iOS não fazer
   zoom ao focar, alvos de toque >= 44px, botão de largura total). */
.etf-registration-form.etf-reg-form {
    max-width: 820px;
    /* Sem margin auto: alinha à esquerda e respeita o alinhamento do
       contentor (Elementor/tema). Sem borda, sombra nem padding, para
       ficar alinhado com o resto do conteúdo da página. */
    margin: 1.5em 0 !important;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr);
    gap: 1.1em 1.5em;
    align-items: start;
}
.etf-registration-form.etf-reg-form.etf-form-hidden { display: none !important; }
.etf-reg-form > .etf-field,
.etf-reg-form > fieldset { margin: 0 !important; }
.etf-reg-form .etf-field > label:not(.etf-checkbox-label) {
    font-size: .92em;
    margin-bottom: .4em;
}
.etf-reg-form input[type="text"],
.etf-reg-form input[type="email"],
.etf-reg-form input[type="tel"],
.etf-reg-form select {
    min-height: 46px;
    font-size: 1rem;
    border-color: #d1d5db;
    transition: border-color .15s, box-shadow .15s;
}
.etf-reg-form input[type="text"]:focus,
.etf-reg-form input[type="email"]:focus,
.etf-reg-form input[type="tel"]:focus,
.etf-reg-form select:focus {
    outline: none;
    border-color: #1d4ed8;
    box-shadow: 0 0 0 3px rgba(29, 78, 216, .15);
}
.etf-reg-form fieldset {
    border-color: #e5e7eb;
    border-radius: 10px;
    padding: .6em 1em .9em;
    align-self: stretch;
}
.etf-reg-form legend { font-size: .92em; padding: 0 .4em; }
/* Caixa posicionada à esquerda e texto em fluxo normal (nada de flex:
   senão o link e a nota dos consentimentos viravam colunas soltas). */
.etf-reg-form .etf-checkbox-label,
.etf-reg-form .etf-radio-label {
    position: relative;
    display: block !important;
    font-weight: 400;
    min-height: 40px;
    padding: .55em 0 .55em 30px;
    margin: .1em 0;
    line-height: 1.45;
}
.etf-reg-form .etf-radio-fieldset .etf-radio-label {
    display: inline-block !important;
    margin-right: 1.5em;
}
.etf-reg-form .etf-checkbox-label input,
.etf-reg-form .etf-radio-label input {
    position: absolute;
    left: 0;
    top: .7em;
    margin: 0 !important;
    width: 18px !important;
    height: 18px;
}
.etf-reg-form .etf-consent-field { padding: .6em 1em; border: 1px solid #eef0f3; }
.etf-reg-form .etf-consent-field .etf-checkbox-label { padding-top: .45em; padding-bottom: .45em; }
.etf-reg-form .etf-consent-field .etf-consent-note { display: block; margin-top: .35em; }
.etf-reg-form .etf-form-message { margin: 0; }
.etf-reg-form .etf-form-message:empty { display: none; }

/* Campos do construtor: texto longo, data, listas de caixas */
.etf-reg-form textarea,
.etf-reg-form input[type="date"] {
    width: 100%;
    max-width: 100%;
    font-size: 1rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: .6em .8em;
    box-sizing: border-box;
}
.etf-reg-form textarea { min-height: 6em; resize: vertical; }
.etf-reg-form textarea:focus,
.etf-reg-form input[type="date"]:focus {
    outline: none;
    border-color: #1d4ed8;
    box-shadow: 0 0 0 3px rgba(29, 78, 216, .15);
}
.etf-reg-form .etf-day-full { color: #b91c1c; font-style: normal; font-size: .9em; }
.etf-reg-form .etf-checkbox-label.is-full { opacity: .6; }
.etf-reg-form .etf-field > .etf-consent-note { display: block; margin-top: .35em; }
.etf-form-intro { max-width: 820px; margin: 0 0 1em; }
.etf-reg-form > .etf-col-full,
.etf-reg-form > .etf-choice-fieldset { grid-column: 1 / -1; }

/* Largura total: agrupamento, termos, consentimentos, botão, mensagem */
.etf-reg-form > .etf-field:has(#etf_school_group),
.etf-reg-form > .etf-radio-fieldset,
.etf-reg-form > .etf-terms-field,
.etf-reg-form > .etf-consent-field,
.etf-reg-form > .etf-form-message { grid-column: 1 / -1; }
.etf-reg-form > .etf-field:has(.etf-submit-btn) { grid-column: 1 / -1; }
.etf-reg-form .etf-submit-btn {
    width: 100%;
    min-height: 50px;
    font-weight: 600;
    text-align: center;
}
.etf-notice { max-width: 820px; }

@media (min-width: 700px) {
    .etf-registration-form.etf-reg-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        padding: 0;
    }
    /* Dias e intérprete lado a lado (se não houver dias, o intérprete ocupa a largura toda) */
    .etf-reg-form > .etf-days-fieldset,
    .etf-reg-form > .etf-days-fieldset + .etf-radio-fieldset { grid-column: auto; }
    .etf-reg-form .etf-submit-btn { width: auto; min-width: 240px; }
    .etf-reg-form > .etf-field:has(.etf-submit-btn) { text-align: right; }
}
@media (max-width: 699px) {
    .etf-registration-form.etf-reg-form {
        padding: 0;
        gap: 1em;
    }
    .etf-reg-form .etf-radio-fieldset .etf-radio-label { margin-right: 1em; }
}

/* ---- Ticket ---- */
.etf-ticket {
    border: 2px dashed #1d4ed8;
    border-radius: 10px;
    padding: 1.5em;
    max-width: 360px;
    margin: 1.5em auto;
    text-align: center;
    font-family: sans-serif;
    background: #fff;
}
.etf-ticket-header h2 { margin: 0 0 .25em; font-size: 1.2em; }
/* O <img> leva estilos inline (width:100%; margin-bottom) porque o mesmo
   HTML é usado no email, onde este CSS não existe. No site, o !important
   garante o banner de ponta a ponta (sangra o padding do bilhete) mesmo
   com o inline e com regras de img do Elementor/Blocksy. */
.etf-ticket { overflow: hidden; }
.etf-ticket .etf-ticket-banner {
    display: block !important;
    height: auto !important;
    width: calc(100% + 3em) !important;
    max-width: calc(100% + 3em) !important;
    margin: -1.5em -1.5em 1em !important;
    border-radius: 0 !important;
}
.etf-ticket-footer-img {
    display: block;
    width: 100%;
    height: auto;
    margin-top: 1em;
}
.etf-ticket-date, .etf-ticket-location { margin: .1em 0; color: #444; font-size: .9em; }
.etf-ticket-qr { width: 200px; height: 200px; margin: 1em auto; display: block; }
.etf-ticket-code { font-family: monospace; letter-spacing: 1px; font-size: 1.1em; margin: .3em 0; }
.etf-ticket-attendee { font-weight: 600; }
.etf-ticket-footer { font-size: .8em; color: #666; margin-top: 1em; }

.etf-download-pdf {
    display: inline-block;
    margin-top: .5em;
    padding: .6em 1.4em;
    background: #1d4ed8;
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
}

.etf-email-note {
    text-align: center;
    color: #374151;
    background: #f0f9ff;
    border-radius: 6px;
    padding: .7em 1em;
    margin: 1em auto 0;
    max-width: 360px;
    font-size: .95em;
}

@media print {
    body * { visibility: hidden; }
    .etf-ticket, .etf-ticket * { visibility: visible; }
    .etf-ticket { position: absolute; top: 0; left: 0; }
}

/* ---- Scanner ---- */
.etf-scanner-wrap {
    max-width: 480px;
    margin: 0 auto;
}
.etf-scanner-stats {
    text-align: center;
    font-weight: 700;
    font-size: 1.1em;
    color: #1f2937;
    background: #f3f4f6;
    border-radius: 8px;
    padding: .6em 1em;
    margin-bottom: .8em;
}
#etf-scanner-video {
    width: 100%;
    border-radius: 10px;
    background: #000;
}
.etf-scanner-result {
    margin-top: 1em;
    padding: 1em;
    border-radius: 8px;
    font-weight: 700;
    text-align: center;
    font-size: 1.1em;
}
.etf-scanner-idle { background: #f3f4f6; color: #374151; }
.etf-scanner-ok { background: #dcfce7; color: #15803d; }
.etf-scanner-error { background: #fee2e2; color: #b91c1c; }
.etf-scanner-manual {
    margin-top: 1em;
    display: flex;
    flex-direction: column;
    gap: .6em;
}
.etf-scanner-manual label {
    font-weight: 600;
    font-size: 1.05em;
}
.etf-scanner-manual input {
    width: 100%;
    box-sizing: border-box;
    padding: .9em 1em;
    font-size: 1.15em;
    border: 1px solid #ccc;
    border-radius: 8px;
}
.etf-scanner-manual button {
    width: 100%;
    padding: .9em 1em;
    border: none;
    border-radius: 8px;
    background: #1d4ed8;
    color: #fff;
    font-size: 1.1em;
    font-weight: 700;
    cursor: pointer;
}
.etf-scanner-manual button:hover {
    background: #1e40af;
}

/* ---- Scan result popup (blocks the camera until dismissed) ---- */
.etf-scan-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 1em;
}
.etf-scan-modal[hidden] { display: none; }
.etf-scan-modal-box {
    background: #fff;
    border-radius: 14px;
    padding: 2em 1.75em 1.75em;
    max-width: 360px;
    width: 100%;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .3);
}
.etf-scan-modal-icon { font-size: 3em; line-height: 1; margin-bottom: .3em; }
.etf-scan-modal-message {
    font-size: 1.15em;
    font-weight: 700;
    margin: 0 0 1.5em;
    color: #1f2937;
}
.etf-scan-modal-ok {
    width: 100%;
    padding: .8em;
    border: none;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    background: #1d4ed8;
}
.etf-scan-modal-ok:focus { outline: 3px solid #93c5fd; outline-offset: 2px; }
.etf-scan-modal-ok:hover { background: #1e40af; }

/* Success/error state colors the whole popup card, not just the
   button — a big, unmistakable green/red signal is the point, since
   staff need to read the outcome at a glance while scanning quickly. */
.etf-scan-modal.is-ok .etf-scan-modal-box {
    background: #16a34a;
}
.etf-scan-modal.is-ok .etf-scan-modal-message {
    color: #fff;
}
.etf-scan-modal.is-ok .etf-scan-modal-ok {
    background: #fff;
    color: #15803d;
}
.etf-scan-modal.is-ok .etf-scan-modal-ok:hover {
    background: #ecfdf5;
}

.etf-scan-modal.is-error .etf-scan-modal-box {
    background: #dc2626;
}
.etf-scan-modal.is-error .etf-scan-modal-message {
    color: #fff;
}
.etf-scan-modal.is-error .etf-scan-modal-ok {
    background: #fff;
    color: #b91c1c;
}
.etf-scan-modal.is-error .etf-scan-modal-ok:hover {
    background: #fef2f2;
}

/* Confirmação de cancelamento (fora do formulário, que fica escondido) */
.etf-cancel-result .etf-form-message.success {
    padding: 1em 1.25em;
    border: 1px solid #bbf7d0;
    background: #f0fdf4;
    border-radius: 6px;
}

/* Erro por baixo de um campo (validação do email) */
.etf-field-error {
    display: none;
    margin-top: .4em;
    color: #b91c1c;
    font-size: .88em;
    line-height: 1.35;
}
.etf-reg-form input[aria-invalid="true"] {
    border-color: #b91c1c !important;
    box-shadow: 0 0 0 3px rgba(185, 28, 28, .12);
}

/* Scanner: install-as-app helper */
.etf-pwa { margin: 14px 0 0; text-align: center; }
.etf-pwa[hidden] { display: none; }
.etf-pwa-install {
    display: inline-block; padding: 12px 22px; border: 0; border-radius: 8px;
    background: #1d4ed8; color: #fff; font-size: 16px; font-weight: 600; cursor: pointer;
}
.etf-pwa-install[hidden] { display: none; }
.etf-pwa-help { margin-top: 10px; font-size: 14px; color: #475569; text-align: left; }
.etf-pwa-help summary { cursor: pointer; text-align: center; }
.etf-pwa-help p { margin: 8px 0 0; }
