/* ============================================================
 * PUBLICO.CSS — Páginas públicas de adesão (cadastro e selfie).
 * Reconstrução MOBILE-FIRST do style.css legado (Cadastroini /
 * Selfie). Usa as CSS variables expostas pelo /api/aparencia/theme.css
 * (--primary, --empresa-nome, --empresa-logo) para aplicar a marca
 * do tenant, com fallback pro laranja do sistema.
 * ============================================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    /* Cores base — --primary é injetado pelo theme.css do tenant.
       Default = laranja "ink-on-orange" do design system unificado. */
    --primary: var(--primary, #FF6B2C);
    --primary-hover: color-mix(in srgb, var(--primary) 90%, black);
    --primary-light: color-mix(in srgb, var(--primary) 80%, white);
    --primary-soft: color-mix(in srgb, var(--primary) 8%, transparent);
    --orange-100: color-mix(in srgb, var(--primary) 18%, white);
    --secondary: #0057B8;
    --secondary-light: #2773c9;
    --secondary-soft: rgba(0, 87, 184, 0.06);

    --neutral-100: #FFFFFF;
    --neutral-200: #F7F8FA;
    --neutral-300: #E5E7EB;
    --neutral-400: #CAD1D9;
    --neutral-500: #9CA3AF;
    --neutral-600: #6B7280;
    --neutral-700: #2A2F3A;
    --neutral-800: #1A2634;
    --neutral-900: #0F1115;

    /* Sombras com tom quente — cartões "se aquecem" no hover, alinhado
       com o design system. shadow-orange é a assinatura visual dos CTAs. */
    --shadow-sm: 0 1px 2px rgba(15,17,21,0.06), 0 8px 18px -10px rgba(15,17,21,0.05);
    --shadow-md: 0 4px 12px rgba(15,17,21,0.06), 0 18px 32px -16px rgba(15,17,21,0.10);
    --shadow-orange: 0 10px 30px color-mix(in srgb, var(--primary) 25%, transparent);
    --shadow-focus: 0 0 0 4px color-mix(in srgb, var(--primary) 20%, transparent);

    --radius-sm: 8px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --transition: all 0.2s ease;

    /* Fonte display pra headlines (carregada no layout). Inter continua
       como base; Space Grotesk só nos títulos. */
    --font-display: 'Space Grotesk', 'Inter', system-ui, sans-serif;
    --font-body:    'Inter', system-ui, -apple-system, sans-serif;
}

html, body { min-height: 100vh; }

body {
    font-family: var(--font-body);
    background: linear-gradient(145deg, var(--neutral-200) 0%, #FFFFFF 100%);
    color: var(--neutral-900);
    line-height: 1.5;
    padding: 1rem 0.75rem;
    /* Centralização vertical + horizontal do card em qualquer viewport.
       `safe center` impede corte no topo quando o card é mais alto que a
       tela (browsers que ainda não têm safe fazem fallback pra center
       normal, que com `min-height: 100vh` + padding já funciona bem). */
    display: flex;
    align-items: safe center;
    justify-content: safe center;
}

/* ============================================================
 * CARD principal (glassmorphism)
 * ============================================================ */
.glass-card {
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
    background: rgba(255,255,255,0.88);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255,255,255,0.6);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 1.4rem 1.1rem;
}

/* ============================================================
 * Header com logo + nome da empresa
 * ============================================================ */
.logo-header {
    text-align: center;
    margin-bottom: 1.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .25rem;
}
.empresa-logo {
    max-height: 52px;
    max-width: 100%;
    object-fit: contain;
    margin-bottom: .25rem;
}
.empresa-nome {
    font-weight: 600;
    font-size: 1.4rem;
    letter-spacing: -0.02em;
    background: linear-gradient(140deg, var(--secondary) 0%, var(--primary) 90%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
    line-height: 1.2;
}
.empresa-nome i {
    background: none;
    -webkit-text-fill-color: var(--primary);
    margin-right: 6px;
}
.logo-header p {
    font-weight: 400;
    font-size: .92rem;
    color: var(--neutral-600);
}

/* ============================================================
 * Step indicator
 * ============================================================ */
.step-indicator {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.75rem;
    position: relative;
}
.step-indicator::before {
    content: '';
    position: absolute;
    top: 17px;
    left: 22%;
    right: 22%;
    height: 2px;
    background: var(--neutral-300);
    z-index: 1;
    border-radius: 4px;
}
.step-item {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--neutral-100);
    border: 2px solid var(--neutral-300);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: .95rem;
    color: var(--neutral-600);
    position: relative;
    z-index: 2;
    transition: var(--transition);
    box-shadow: 0 2px 6px rgba(0,0,0,0.02);
}
.step-item.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 8px 18px -8px var(--primary);
    transform: scale(1.05);
}
.step-item.completed {
    background: var(--secondary);
    border-color: var(--secondary);
    color: #fff;
    font-size: 1.1rem;
}
.step-item.completed span { display: none; }
.step-item.completed::after { content: '✓'; font-weight: 600; }

/* ============================================================
 * Step content
 * ============================================================ */
.step-content { transition: opacity .25s, transform .3s; }
.step-content.hidden { display: none !important; }
.fade-in { animation: fadeSlideIn .35s ease forwards; }
@keyframes fadeSlideIn {
    0%   { opacity: 0; transform: translateY(8px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* ============================================================
 * Tipografia — headlines em Space Grotesk (display), corpo em Inter.
 * ============================================================ */
h1, h2, h3 {
    font-family: var(--font-display);
    color: var(--neutral-900);
    line-height: 1.15;
    letter-spacing: -0.02em;
}
h1 { font-weight: 700; font-size: 1.85rem; margin-bottom: .35rem; }
h2 {
    font-weight: 700;
    font-size: 1.45rem;
    margin-bottom: .35rem;
}
h3 { font-weight: 600; font-size: 1.15rem; margin-bottom: .25rem; }
h2 i { color: var(--primary); margin-right: 6px; }

.text-muted        { color: var(--neutral-600); }
.text-muted-custom { color: var(--neutral-600); margin-bottom: 1.25rem; font-size: .92rem; }
.text-center       { text-align: center; }

/* ============================================================
 * Formulários
 * ============================================================ */
.form-row {
    display: flex;
    flex-direction: column;
    gap: .9rem;
    margin-bottom: 1rem;
}
.form-col-2 {
    display: grid;
    grid-template-columns: 1fr;
    gap: .9rem;
    margin-bottom: 1rem;
}
.form-label {
    font-weight: 500;
    color: var(--neutral-800);
    margin-bottom: .4rem;
    display: block;
    font-size: .95rem;
}
.form-label .small { font-weight: 400; color: var(--neutral-600); }

.input-premium {
    border: 1.5px solid var(--neutral-300);
    border-radius: 14px;
    padding: .85rem 1.05rem;
    font-size: 1rem;
    font-weight: 400;
    background: rgba(255,255,255,0.75);
    transition: var(--transition);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.01);
    width: 100%;
    font-family: inherit;
    color: inherit;
    -webkit-appearance: none;
    appearance: none;
}
.input-premium:focus {
    border-color: var(--primary);
    box-shadow: var(--shadow-focus);
    outline: none;
    background: #fff;
}
.input-premium[readonly],
.input-premium:disabled {
    background: var(--neutral-200);
    cursor: not-allowed;
    color: var(--neutral-600);
    border-color: var(--neutral-300);
}
.input-premium::placeholder { color: var(--neutral-400); }

/* ============================================================
 * Botões
 * ============================================================ */
.btn-modern {
    border-radius: var(--radius-md);
    padding: .75rem 1.25rem;
    font-weight: 600;
    font-size: .95rem;
    border: 1px solid var(--neutral-300);
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    background: #fff;
    color: var(--neutral-900);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    font-family: inherit;
    width: auto;
    white-space: nowrap;
}
.btn-modern:disabled { opacity: .6; cursor: not-allowed; }
.btn-modern i { font-size: 1.05rem; }

.btn-modern:hover:not(:disabled) {
    transform: translateY(-1px);
    background: var(--neutral-200);
    border-color: var(--neutral-400);
}
.btn-primary-modern {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: var(--shadow-orange);
}
.btn-primary-modern:hover:not(:disabled) {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    color: #fff;
    transform: translateY(-1px);
}
.btn-secondary-modern {
    background: var(--secondary);
    border-color: var(--secondary);
    color: #fff;
}
.btn-secondary-modern:hover:not(:disabled) {
    background: var(--secondary-light);
    border-color: var(--secondary-light);
}
.btn-row {
    display: flex;
    flex-direction: row;     /* sempre lado a lado, inclusive no mobile */
    flex-wrap: wrap;         /* se não couber, quebra pra linha nova */
    align-items: center;
    justify-content: center;
    gap: .55rem;
    margin-top: 1rem;
    width: 100%;
}

/* ============================================================
 * Success screen
 * ============================================================ */
.success-screen { text-align: center; padding: 1rem .5rem; }
.success-screen .check-circle {
    font-size: 4rem;
    color: var(--primary);
    filter: drop-shadow(0 8px 16px var(--primary));
    margin-bottom: 1.25rem;
}
.success-screen h2 { font-weight: 600; color: var(--neutral-900); }

/* ============================================================
 * Loading overlay
 * ============================================================ */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity .3s ease;
}
.loading-overlay.hidden { opacity: 0; pointer-events: none; }
.loading-content { text-align: center; max-width: 300px; padding: 2rem; }
.loading-spinner {
    width: 54px; height: 54px;
    border: 4px solid var(--neutral-300);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .8s linear infinite;
    margin: 0 auto 1.25rem;
}
.loading-text    { font-size: 1rem; font-weight: 500; color: var(--neutral-800); margin-bottom: .25rem; }
.loading-subtext { font-size: .85rem; color: var(--neutral-600); }
.loading-progress {
    width: 100%; height: 4px;
    background: var(--neutral-300);
    border-radius: 4px;
    margin-top: 1.25rem;
    overflow: hidden;
}
.loading-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
    width: 0%;
    transition: width .3s ease;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
 * Util
 * ============================================================ */
.hidden        { display: none !important; }
.w-100         { width: 100%; }
.flex-grow-1   { flex-grow: 1; }
.d-flex        { display: flex; }
.justify-center{ justify-content: center; }
.align-center  { align-items: center; }
.gap-2         { gap: .5rem; }
.gap-3         { gap: 1rem; }
.mt-3          { margin-top: 1rem; }
.mt-4          { margin-top: 1.5rem; }
.mb-3          { margin-bottom: 1rem; }
.mb-4          { margin-bottom: 1.5rem; }

/* ============================================================
 * SweetAlert override — alinha ao tema
 * ============================================================ */
.swal2-popup   { border-radius: 18px !important; font-family: 'Inter', sans-serif !important; }
.swal2-confirm { background-color: var(--primary) !important; border-radius: 8px !important; }
.swal2-cancel  { background-color: #a7a7a7 !important; border-radius: 8px !important; }

/* ============================================================
 * Breakpoints — mobile-first; só ampliamos em telas maiores
 * ============================================================ */
@media (min-width: 480px) {
    body { padding: 1.5rem 1rem; }
    .glass-card { padding: 1.75rem 1.4rem; }
    .empresa-nome { font-size: 1.6rem; }
    .empresa-logo { max-height: 58px; }
    h2 { font-size: 1.45rem; }
    .step-item { width: 40px; height: 40px; font-size: 1rem; }
    .step-indicator::before { top: 19px; }
    /* No desktop/tablet os botões ganham um pouco de padding extra para
       ficarem mais confortáveis (mantendo tamanho natural, centralizados). */
    .btn-row .btn-modern { padding: .8rem 1.3rem; font-size: 1rem; }
    .form-col-2 { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 720px) {
    body { padding: 2rem 1.25rem; }
    .glass-card { padding: 2rem 1.8rem; }
    .empresa-nome { font-size: 1.9rem; }
    .empresa-logo { max-height: 60px; }
    .logo-header p { font-size: 1rem; }
    h2 { font-size: 1.6rem; }
    .step-indicator { gap: 1.8rem; }
}
