/* ============================================================
   SODATI VITA — Identidade visual
   ============================================================ */
:root {
    --primary:        #2c4a6f;
    --primary-dark:   #1f3553;
    --secondary:      #5da2be;
    --secondary-soft: #e3f2fd;
    --secondary-50:   #f8fbfd;
    --success:        #4caf50;
    --danger:         #f44336;
    --warn:           #ff9800;
    --text-dark:      #333333;
    --text-light:     #666666;
    --bg-page:        linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    --bg-soft:        #f8f9fa;
    --surface:        #ffffff;
    --border:         #e0e0e0;
    --shadow-sm:      0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md:      0 4px 16px rgba(0, 0, 0, 0.15);
    --radius:         12px;
    --radius-sm:      8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-page);
    color: var(--text-dark);
    line-height: 1.5;
    min-height: 100vh;
}

a { color: var(--primary); }

/* ============================================================
   Layout
   ============================================================ */
.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 1.25rem;
}

.topbar {
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    padding: 0.75rem 0;
}
.topbar .brand-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    color: var(--primary);
}
.topbar .brand-logo { height: 72px; width: auto; }

.nav {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}
.nav .nav-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-light);
    text-decoration: none;
    font-size: 0.92rem;
    font-family: inherit;
    background: none;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}
.nav .nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }
.nav .nav-item:hover {
    color: var(--primary);
    background: var(--secondary-50);
    border-color: var(--border);
}

@media (max-width: 560px) {
    .topbar .container { flex-direction: column; gap: 0.6rem; }
    .topbar .brand-logo { height: 56px; }
    .nav { justify-content: center; }
    .nav .nav-item span { display: none; }
    .nav .nav-item { padding: 0.5rem 0.7rem; }
    .nav .nav-item svg { width: 19px; height: 19px; }
}

main.container { padding-top: 3.5rem; padding-bottom: 3rem; }

.footer {
    border-top: 1px solid var(--border);
    background: var(--surface);
    padding: 1rem 0;
    margin-top: 2rem;
}

/* ============================================================
   Utilities
   ============================================================ */
.row { display: flex; align-items: center; gap: 1rem; }
.spread { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 0.85rem; }
.muted { color: var(--text-light); }
.lead { font-size: 1.1rem; color: var(--text-light); }
.center { text-align: center; }

/* ============================================================
   Cards / surfaces
   ============================================================ */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow-md);
}
.card.narrow { max-width: 460px; margin-left: auto; margin-right: auto; }
.card > h1, .card > h2 { margin-top: 0; color: var(--primary); }

.hero {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 3rem 2.5rem;
    box-shadow: var(--shadow-md);
    text-align: center;
}
.hero .brand-logo-hero { max-width: 340px; width: 100%; margin-bottom: 1.75rem; }
.hero h1 { color: var(--primary); margin: 0 0 0.5rem; font-size: 1.85rem; font-weight: 600; }
.hero p.lead { margin: 0 auto 1.75rem; max-width: 540px; }
.hero-secondary { margin: 1.5rem 0 0; color: var(--text-light); font-size: 0.95rem; }

.link-button {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    color: var(--secondary);
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.link-button:hover { color: var(--primary); }

/* ============================================================
   Forms (estilo SODATI portado do form atual)
   ============================================================ */
.form-group { margin-bottom: 1.75rem; }

.form-label {
    display: block;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.75rem;
    font-size: 1.05rem;
}
.form-label.required::after {
    content: " *";
    color: var(--danger);
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: inherit;
    background: #fff;
    color: var(--text-dark);
    transition: all 0.2s ease;
}
.form-input:focus {
    outline: none;
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(93, 162, 190, 0.15);
}
.form-input.valid   { border-color: var(--success); }
.form-input.invalid { border-color: var(--danger); }

label > span.input-label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 0.25rem;
}

.error-message {
    color: var(--danger);
    font-size: 0.9rem;
    margin-top: 0.4rem;
    font-weight: 500;
}
.error-message::before { content: '⚠ '; }

/* Radio (sim/não / escolhas verticais) */
.radio-group { display: flex; flex-direction: column; gap: 0.65rem; }

.radio-option {
    display: flex;
    align-items: center;
    padding: 0.9rem 1.1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fff;
}
.radio-option:hover { border-color: var(--secondary); background: var(--secondary-50); }
.radio-option input[type="radio"] { margin-right: 0.75rem; width: 18px; height: 18px; cursor: pointer; }
.radio-option.selected, .radio-option:has(input:checked) {
    border-color: var(--secondary);
    background: var(--secondary-soft);
    font-weight: 500;
}

/* Scale (botões horizontais) */
.scale-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 0.6rem;
    margin-top: 0.5rem;
}
.scale-option { text-align: center; }
.scale-option input[type="radio"] { display: none; }
.scale-option label {
    display: block;
    padding: 0.75rem 0.5rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.88rem;
    line-height: 1.3;
    background: #fff;
    color: var(--text-dark);
}
.scale-option label:hover { border-color: var(--secondary); background: var(--secondary-50); }
.scale-option input[type="radio"]:checked + label {
    border-color: var(--secondary);
    background: var(--secondary);
    color: #fff;
    font-weight: 600;
}

.question-counter {
    display: inline-block;
    background: var(--secondary);
    color: #fff;
    padding: 0.2rem 0.75rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

/* Autocomplete (filtros) */
.ac-field { position: relative; }
.ac-list {
    position: absolute;
    top: calc(100% - 2px);
    left: 0;
    right: 0;
    margin: 0;
    padding: 0.25rem 0;
    list-style: none;
    background: #fff;
    border: 2px solid var(--secondary);
    border-top: none;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    box-shadow: var(--shadow-md);
    max-height: 240px;
    overflow-y: auto;
    z-index: 60;
    display: none;
}
.ac-list.open { display: block; }
.ac-list li {
    padding: 0.5rem 0.85rem;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text-dark);
    line-height: 1.3;
}
.ac-list li:hover,
.ac-list li.active { background: var(--secondary-soft); }
.ac-list li mark { background: #ffe9a8; color: inherit; padding: 0 1px; border-radius: 2px; }
.ac-list .ac-empty {
    padding: 0.5rem 0.85rem;
    color: var(--text-light);
    font-size: 0.9rem;
    cursor: default;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
    padding: 0.85rem 1.75rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-decoration: none;
    line-height: 1.2;
}
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    box-shadow: var(--shadow-sm);
}
.btn-primary:hover:not([disabled]) { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-secondary {
    background: #fff;
    color: var(--primary);
    border: 2px solid var(--border);
}
.btn-secondary:hover:not([disabled]) { border-color: var(--primary); background: var(--bg-soft); }
.btn-ghost { background: transparent; color: var(--text-light); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--primary); border-color: var(--primary); }
.btn-lg { padding: 1rem 2rem; font-size: 1.05rem; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ============================================================
   Wizard
   ============================================================ */
.wizard-card {
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.wizard-header {
    text-align: center;
    padding: 2rem 1.5rem 1.25rem;
    background: var(--surface);
    border-bottom: 3px solid var(--border);
}
.wizard-header img.brand-logo { max-width: 330px; width: 100%; margin-bottom: 0.75rem; }
.wizard-header h1 {
    font-size: 1.6rem;
    color: var(--primary);
    margin: 0 0 0.25rem;
    font-weight: 600;
}
.wizard-header p { color: var(--text-light); margin: 0; }

.progress-steps {
    display: flex;
    justify-content: space-between;
    padding: 1.5rem 2rem;
    background: var(--surface);
    border-bottom: 2px solid var(--border);
    flex-wrap: wrap;
    gap: 0.5rem;
}
.progress-steps .step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    min-width: 70px;
}
.progress-steps .step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 18px;
    left: 50%;
    width: 100%;
    height: 3px;
    background: var(--border);
    z-index: 0;
}
.progress-steps .step.completed:not(:last-child)::after { background: var(--success); }
.progress-steps .step.active:not(:last-child)::after {
    background: linear-gradient(to right, var(--secondary) 50%, var(--border) 50%);
}
.step-number {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--border);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 1;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}
.step.active .step-number {
    background: var(--secondary);
    box-shadow: 0 0 0 4px rgba(93, 162, 190, 0.2);
    transform: scale(1.1);
}
.step.completed .step-number { background: var(--success); }
.step.completed .step-number::before { content: '✓'; }
.step.completed .step-number .step-num-text { display: none; }
.step-label {
    font-size: 0.7rem;
    color: var(--text-light);
    text-align: center;
    line-height: 1.3;
}
.step.active .step-label { color: var(--secondary); font-weight: 600; }
.step.completed .step-label { color: var(--success); }

.wizard-content {
    padding: 2.5rem 2rem;
    min-height: 380px;
}
.wizard-step { display: none; animation: fadeIn 0.35s ease; }
.wizard-step.active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateX(15px); }
    to   { opacity: 1; transform: translateX(0); }
}

.step-title {
    font-size: 1.7rem;
    color: var(--primary);
    margin: 0 0 0.5rem;
    font-weight: 600;
}
.step-description {
    color: var(--text-light);
    margin-bottom: 1.75rem;
    font-size: 1.02rem;
}

.wizard-navigation {
    display: flex;
    justify-content: space-between;
    padding: 1.5rem 2rem;
    background: var(--bg-soft);
    border-top: 2px solid var(--border);
    gap: 0.75rem;
}

/* ============================================================
   Loading overlay
   ============================================================ */
.loading-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}
.loading-overlay.active { display: flex; }
.loading-content { text-align: center; color: #fff; max-width: 320px; padding: 1rem; }
.spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #fff;
    border-radius: 50%;
    width: 56px;
    height: 56px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1.25rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   Alerts / badges / tables
   ============================================================ */
.alert { padding: 0.85rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; }
.alert-error   { background: #fdecea; color: #c62828; border: 1px solid #f5c6c2; }
.alert-success { background: #e8f5e9; color: #1b5e20; border: 1px solid #c8e6c9; }
.alert-info    { background: #e3f2fd; color: #0d47a1; border: 1px solid #bbdefb; }

/* ============================================================
   Modal
   ============================================================ */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(20, 30, 48, 0.55);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    animation: modalFade 0.18s ease;
}
.modal-overlay.active { display: flex; }
@keyframes modalFade { from { opacity: 0; } to { opacity: 1; } }

.modal {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
    padding: 2rem;
    max-width: 460px;
    width: 100%;
    position: relative;
    animation: modalPop 0.2s ease;
}
@keyframes modalPop {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal h2 { color: var(--primary); }
.modal-close {
    position: absolute;
    top: 0.6rem;
    right: 0.85rem;
    background: none;
    border: none;
    font-size: 1.75rem;
    line-height: 1;
    color: var(--text-light);
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    transition: color 0.2s ease;
}
.modal-close:hover { color: var(--primary); }

.data { width: 100%; border-collapse: collapse; margin-top: 1rem; }
.data th, .data td {
    text-align: left;
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
}
.data th {
    background: var(--bg-soft);
    font-weight: 600;
    color: var(--text-light);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.data code { background: #f3f4f6; padding: 0.1rem 0.4rem; border-radius: 4px; font-size: 0.85rem; }

.badge {
    display: inline-block;
    padding: 0.18rem 0.65rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
}
.badge-ok    { background: #e8f5e9; color: #1b5e20; }
.badge-muted { background: #f1f3f5; color: var(--text-light); }
.badge-err   { background: #fdecea; color: #c62828; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
    .wizard-header { padding: 1.5rem 1rem 1rem; }
    .wizard-header h1 { font-size: 1.3rem; }
    .progress-steps { padding: 1rem 0.75rem; }
    .step-label { font-size: 0.62rem; }
    .step-number { width: 30px; height: 30px; font-size: 0.8rem; }
    .wizard-content { padding: 1.75rem 1.25rem; }
    .step-title { font-size: 1.4rem; }
    .wizard-navigation { padding: 1rem 1.25rem; flex-direction: column; }
    .wizard-navigation .btn { width: 100%; }
    .scale-group { grid-template-columns: 1fr; }
}
