/**
 * AWA B2B Register Form — Override do módulo register.css
 *
 * Repositório de regras CSS que sobrescrevem o register.css do módulo B2B.
 * Este arquivo é carregado APÓS register.css na cascata.
 *
 * CORREÇÃO DE SELETOR (2026-04-09):
 *   O seletor original `html body .page-wrapper .b2b-register-page` nunca
 *   funcionava na página de cadastro porque ela usa page-layout-empty —
 *   que NÃO renderiza .page-wrapper. Substituído por:
 *   `body.b2b-register-index .b2b-register-page` (body-class sempre presente).
 *
 * Regras: melhorias de UX/UI alinhadas com awa-bundle-auth.css
 */

/* =====================================================
   INPUT FIELDS — Melhorias de awa-bundle-auth
   ===================================================== */
body.b2b-register-index .b2b-register-page .field .input-text,
body.b2b-register-index .b2b-register-page .field input[type="text"],
body.b2b-register-index .b2b-register-page .field input[type="email"],
body.b2b-register-index .b2b-register-page .field input[type="tel"],
body.b2b-register-index .b2b-register-page .field input[type="password"],
body.b2b-register-index .b2b-register-page .field select {
    padding: 12px 16px !important;
    border-color: var(--awa-auth-border-strong, #c7d2e1) !important;
    border-width: 1px !important;
    border-radius: 8px !important;
    font-size: 15px !important;
    line-height: 1.5;
    color: var(--awa-auth-text, #333);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

body.b2b-register-index .b2b-register-page .field .input-text::placeholder,
body.b2b-register-index .b2b-register-page .field input::placeholder {
    color: #aaa;
}

/* =====================================================
   FOCUS STATES — Alinhamento com awa-bundle-auth
   ===================================================== */
body.b2b-register-index .b2b-register-page .field .input-text:focus,
body.b2b-register-index .b2b-register-page .field .input-text:focus-visible,
body.b2b-register-index .b2b-register-page .field input:focus,
body.b2b-register-index .b2b-register-page .field input:focus-visible,
body.b2b-register-index .b2b-register-page .field select:focus,
body.b2b-register-index .b2b-register-page .field select:focus-visible {
    border-color: var(--awa-auth-primary, #b73337) !important;
    box-shadow: 0 0 0 3px rgb(183 51 55 / 18%) !important;
    outline: none !important;
}

/* =====================================================
   LABELS — Melhorias de tipografia
   ===================================================== */
body.b2b-register-index .b2b-register-page .field .label {
    font-weight: 600;
    font-size: 14px;
    color: var(--awa-auth-text, #333);
    margin-bottom: 8px;
    letter-spacing: -0.01em;
    text-align: start;
}

body.b2b-register-index .b2b-register-page .field.required > .label::after {
    content: ' *';
    color: #dc2626;
    margin-left: 2px;
}

/* =====================================================
   FIELD ROW LAYOUT — Refine gap e flex
   ===================================================== */
.b2b-register-page .field-row {
    display: flex;
    gap: 16px !important;
    flex-wrap: wrap;
}

.b2b-register-page .field-row .field {
    flex: 1 1 auto;
    min-width: 0;
}

.b2b-register-page .field-row .field.field-narrow {
    flex: 0 0 130px;
    max-width: 160px;
}

.b2b-register-page .field-row .field.field-wide {
    flex: 1 1 0%;
    min-width: 0;
}

/* =====================================================
   FORM SECTIONS — Focus/error states
   ===================================================== */
body.b2b-register-index .b2b-register-page .form-section:focus-within {
    border-color: var(--awa-auth-border-strong, #c7d2e1) !important;
    box-shadow: 0 0 0 3px rgb(183 51 55 / 8%), 0 8px 18px rgb(15 23 42 / 6%) !important;
}

body.b2b-register-index .b2b-register-page .form-section.has-errors {
    border-color: #fecaca !important;
    box-shadow: 0 0 0 2px rgb(220 38 38 / 6%) !important;
}

/* =====================================================
   ERROR MESSAGES — Melhorias de acessibilidade
   ===================================================== */
body.b2b-register-index .b2b-register-page .mage-error,
body.b2b-register-index .b2b-register-page .field-error .input.mage-error {
    border-color: #dc2626 !important;
    box-shadow: 0 0 0 3px rgb(220 38 38 / 10%) !important;
}

body.b2b-register-index .b2b-register-page .mage-error {
    color: #7f1d1d;
    font-size: 13px;
    margin-top: 6px;
}

/* =====================================================
   BUTTON — Melhorias de estado
   ===================================================== */
body.b2b-register-index .b2b-register-page .action.primary {
    border-radius: 8px;
    font-weight: 600;
    letter-spacing: -0.01em;
    min-height: 48px;
    transition: all 0.2s ease;
}

body.b2b-register-index .b2b-register-page .action.primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 16px rgb(183 51 55 / 20%);
}

body.b2b-register-index .b2b-register-page .action.primary:focus-visible {
    outline: 2px solid var(--awa-auth-primary, #b73337);
    outline-offset: 2px;
}

/* =====================================================
   PROGRESS STEPS — Refinamentos
   ===================================================== */
.b2b-register-page .progress-step {
    font-size: 13px;
    border-radius: 10px;
    transition: all 0.2s ease;
}

.b2b-register-page .progress-step:hover {
    border-color: #d1d5db;
    background: #fff;
}

.b2b-register-page .progress-step:focus-visible {
    outline: 2px solid var(--awa-auth-primary, #b73337);
    outline-offset: 2px;
}

/* =====================================================
   RESPONSIVE — Mobile/tablet improvements
   ===================================================== */
@media (max-width: 576px) {
    .b2b-register-page .field-row {
        gap: 12px !important;
        flex-direction: column;
    }

    .b2b-register-page .field-row .field.field-narrow {
        flex: 1 1 100%;
        max-width: none;
    }

    body.b2b-register-index .b2b-register-page .field .input-text,
    body.b2b-register-index .b2b-register-page .field input,
    body.b2b-register-index .b2b-register-page .field select {
        padding: 11px 14px !important;
        font-size: 16px !important; /* Evita zoom automático no iOS */
    }

    body.b2b-register-index .b2b-register-page .form-section {
        padding: 16px 14px 14px;
    }
}

@media (max-width: 768px) {
    body.b2b-register-index .b2b-register-page {
        padding: 24px 12px;
    }

    body.b2b-register-index .b2b-register-page .b2b-register-container {
        padding: 24px 18px;
    }
}

/* =====================================================
   HELP TEXT & NOTES — Styling improvement
   ===================================================== */
.b2b-register-page .field .note,
.b2b-register-page .field-note {
    font-size: 12px;
    color: var(--awa-auth-muted, #999);
    line-height: 1.5;
    margin-top: 6px;
}

/* =====================================================
   REQUIRED FIELD INDICATOR — Better visibility
   ===================================================== */
body.b2b-register-index .b2b-register-page .field.required > .label span::after {
    content: ' *';
    color: #dc2626;
    font-weight: 700;
    margin-left: 2px;
}

/* =====================================================
   FIX CRÍTICO: LAYOUT — Reset do display:grid/justify-items:center
   =====================================================
   O awa-bundle-auth.css e refine.css definem:
     .b2b-login-page { display: grid; justify-items: center; }
     .b2b-register-shell-content { width: min(100%, 468px); }
   Isso foi pensado para o LOGIN (card estreito, 468px), mas o
   template de REGISTRO usa .b2b-login-page, quebrando o layout.
   Usa o ID #b2b-register-shell (especificidade máxima) para corrigir.
*/
/* Overrides display:grid + justify-items:center from .b2b-login-page (auth CSS).
   flex-direction:column keeps logo and form stacked vertically.
   align-items:stretch allows children to fill the width. */
#b2b-register-shell {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0 !important;
    padding-bottom: clamp(32px, 4vw, 48px);
    background:
        radial-gradient(circle at 8% -8%, rgb(183 51 55 / 8%), transparent 42%),
        radial-gradient(circle at 92% 8%, rgb(142 38 41 / 6%), transparent 38%),
        linear-gradient(180deg, #f7f8fa 0%, #eef1f5 100%) !important;
}

/* Fix logo: auth CSS constrains it to min(100%, 468px); make it full-width with a real max */
#b2b-register-shell .b2b-login-logo {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
    padding: clamp(20px, 3vw, 28px) var(--awa-container-padding, 24px) 18px !important;
    text-align: center;
    background: transparent !important;
    border-bottom: 1px solid rgba(0,0,0,0.06) !important;
}

/* Shell content: full-width container, max-width handled by inner .b2b-register-page */
#b2b-register-shell .b2b-register-shell-content {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0;
    box-sizing: border-box;
}

/* Enforce proper register-page width if module CSS loses cascade */
body.b2b-register-index .b2b-register-page {
    max-width: 1040px !important;
    margin: 0 auto !important;
    padding: clamp(24px, 3vw, 40px) var(--awa-container-padding, 24px) !important;
    box-sizing: border-box;
    width: 100% !important;
}

body.b2b-register-index .b2b-register-page .b2b-register-container {
    padding: clamp(24px, 3vw, 36px) !important;
    border-radius: 20px !important;
}

body.b2b-register-index .b2b-register-page .b2b-register-form {
    gap: clamp(20px, 2.5vw, 28px);
}

body.b2b-register-index .b2b-register-page .form-section {
    padding: clamp(20px, 2.5vw, 28px) !important;
}

body.b2b-register-index .b2b-register-page .b2b-benefits {
    gap: 20px;
    padding: clamp(18px, 2.5vw, 24px);
    border-radius: 18px;
}

/* =====================================================
   STEPPER — .is-active com cor AWA brand
   ===================================================== */
body.b2b-register-index .b2b-register-page .b2b-register-progress .progress-step.is-active {
    border-color: rgba(183, 51, 55, 0.30);
    background: linear-gradient(180deg, #ffffff 0%, #fff1f2 100%);
    color: #8e2629;
    font-weight: 700;
    box-shadow: 0 2px 10px rgba(183, 51, 55, 0.14);
}

body.b2b-register-index .b2b-register-page .b2b-register-progress .progress-step.is-active .progress-step__num {
    background: var(--awa-red) !important;
    color: #ffffff !important;
    box-shadow: 0 2px 8px rgba(183, 51, 55, 0.38) !important;
}

/* =====================================================
   BOTÃO SUBMIT — padding 16px 32px, width 100%, brand primary
   ===================================================== */
body.b2b-register-index .b2b-register-page .actions-toolbar .action.submit.primary,
body.b2b-register-index .b2b-register-page .actions-toolbar .create-b2b-account {
    width: 100% !important;
    padding: 16px 32px !important;
    font-weight: 600 !important;
    font-size: 16px !important;
    background: var(--awa-red) !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 10px !important;
    min-height: 54px;
    letter-spacing: -0.01em;
    transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

body.b2b-register-index .b2b-register-page .actions-toolbar .action.submit.primary:hover,
body.b2b-register-index .b2b-register-page .actions-toolbar .create-b2b-account:hover {
    background: #8e2629 !important;
    box-shadow: 0 6px 18px rgba(183, 51, 55, 0.30) !important;
    transform: translateY(-1px);
}

/* =====================================================
   CHECKBOX — custom AWA brand style
   ===================================================== */
body.b2b-register-index .b2b-register-page .terms-section .field.choice {
    background: #fafafa;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 16px;
}

body.b2b-register-index .b2b-register-page .terms-section input[type="checkbox"].checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 20px !important;
    min-width: 20px;
    height: 20px !important;
    margin: 0 !important;
    margin-top: 1px !important;
    flex-shrink: 0;
    border: 2px solid #c7d2e1;
    border-radius: 5px;
    background: #ffffff;
    cursor: pointer;
    position: relative;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
    vertical-align: top;
}

body.b2b-register-index .b2b-register-page .terms-section input[type="checkbox"].checkbox:checked {
    background: var(--awa-red);
    border-color: var(--awa-red);
}

body.b2b-register-index .b2b-register-page .terms-section input[type="checkbox"].checkbox:checked::after {
    content: "";
    display: block;
    position: absolute;
    top: 2px;
    left: 5px;
    width: 6px;
    height: 10px;
    border: 2px solid #ffffff;
    border-top: none;
    border-left: none;
    transform: rotate(45deg);
}

body.b2b-register-index .b2b-register-page .terms-section input[type="checkbox"].checkbox:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(183, 51, 55, 0.20) !important;
    border-color: var(--awa-red);
}

body.b2b-register-index .b2b-register-page .terms-section input[type="checkbox"].checkbox:hover:not(:checked) {
    border-color: var(--awa-red);
}

@media (max-width: 480px) {
    body.b2b-register-index .b2b-register-page .actions-toolbar .action.submit.primary,
    body.b2b-register-index .b2b-register-page .actions-toolbar .create-b2b-account {
        padding: 14px 24px !important;
        font-size: 15px !important;
        min-height: 50px;
    }
}

/* =====================================================
   HONEYPOT FIX — impede overflow horizontal (#b2b_website)
   O input honeypot herda width:100% !important de regras
   globais (styles-m, awa-bundle-site). Este reset garante
   que o campo fique completamente invisível e sem layout.
   ===================================================== */
.b2b-register-form .b2b-ht,
.b2b-register-form #b2b_website,
#b2b-register-form > .b2b-ht {
    width: 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
    height: 0 !important;
    max-height: 0 !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    overflow: hidden !important;
    position: absolute !important;
    opacity: 0 !important;
    pointer-events: none !important;
    clip: rect(0, 0, 0, 0) !important;
    -webkit-appearance: none !important;
}

/* =====================================================
   FORM CONTAINER — async CSS removes padding/border/shadow from container
   ===================================================== */
body.b2b-register-index #b2b-register-shell .b2b-register-container {
    background: #fff !important;
    border-radius: 16px !important;
    border: 1px solid #e5e7eb !important;
    box-shadow: 0 12px 32px rgb(15 23 42 / 8%) !important;
    padding: 34px !important;
    box-sizing: border-box;
}

/* FORM GRID — async CSS overrides display:grid with display:block, removes gap */
body.b2b-register-index #b2b-register-shell .b2b-register-form {
    display: grid !important;
    gap: 18px !important;
}

/* FORM SECTIONS — async CSS (styles-l theme) strips border/bg/radius/padding */
body.b2b-register-index #b2b-register-shell .b2b-register-page .form-section {
    padding: 18px 18px 16px !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 12px !important;
    background: linear-gradient(180deg, #fff 0%, #fcfcfd 100%) !important;
    box-shadow: 0 1px 2px rgb(15 23 42 / 3%) !important;
    margin-bottom: 0 !important;
}

body.b2b-register-index #b2b-register-shell .b2b-register-page .form-section:focus-within {
    border-color: rgba(183, 51, 55, 0.35) !important;
    box-shadow: 0 0 0 3px rgb(183 51 55 / 8%), 0 8px 18px rgb(15 23 42 / 6%) !important;
}

body.b2b-register-index #b2b-register-shell .b2b-register-page .form-section.has-errors {
    border-color: #fecaca !important;
    box-shadow: 0 0 0 2px rgb(220 38 38 / 6%) !important;
}

/* FORM SECTION BODY — ensure it's visible (not hidden by async CSS) */
body.b2b-register-index #b2b-register-shell .b2b-register-page .form-section .form-section__body {
    display: block !important;
    margin-top: 16px;
}

/* =====================================================
   BENEFITS GRID — async AWA CSS overrides display:grid to flex
   ===================================================== */
body.b2b-register-index .b2b-register-page .b2b-benefits {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) !important;
    gap: 18px;
}

/* =====================================================
   FORM SECTION TOGGLE — reset AWA button red background
   Async AWA CSS (awa-bundle-phases, styles-l) overrides
   the module's transparent button with rgb(183,51,55).
   ===================================================== */
body.b2b-register-index .b2b-register-page .form-section .form-section__toggle {
    background: transparent !important;
    background-image: none !important;
    border: 0 !important;
    border-radius: 0 !important;
    padding: 0 !important;
    color: var(--awa-text-primary, #333) !important;
    font-size: 18px !important;
    font-weight: 600 !important;
    box-shadow: none !important;
    width: 100% !important;
    text-align: left !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    cursor: default !important;
    min-height: auto !important;
    line-height: 1.2 !important;
}

body.b2b-register-index .b2b-register-page .form-section .form-section__toggle::before {
    content: attr(data-step-number) !important;
    width: 28px !important;
    height: 28px !important;
    border-radius: 50% !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    background: linear-gradient(135deg, var(--awa-primary, #b73337) 0%, #8e2629 100%) !important;
    color: #fff !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    box-shadow: 0 4px 12px rgb(183 51 55 / 20%) !important;
}

body.b2b-register-index .b2b-register-page .form-section .form-section__toggle:hover {
    background: transparent !important;
    box-shadow: none !important;
    transform: none !important;
}

body.b2b-register-index .b2b-register-page .form-section .form-section__toggle:focus-visible {
    outline: 2px solid var(--awa-primary, #b73337) !important;
    outline-offset: 2px;
    box-shadow: none !important;
}
