/* ========================================
   Aprendiz do Futuro - Formulário
   ======================================== */

:root {
    --green-primary: rgb(19, 130, 58);
    --green-dark: rgb(15, 105, 47);
    --green-bg: rgba(19, 130, 58, 0.05);
    --green-light: rgba(19, 130, 58, 0.08);
    --gray-muted: #6b7280;
    --gray-border: #e5e7eb;
    --gray-light: #f9fafb;
    --white: #ffffff;
    --text-dark: #111827;
    --red-error: #ef4444;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --radius-full: 9999px;
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
    --max-width: 800px;
    --font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* --- Reset --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--green-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Container --- */
.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 40px 20px 30px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    flex: 1;
}

/* --- Header --- */
.header {
    text-align: center;
}

.logo {
    max-width: 100%;
    width: 560px;
    height: auto;
    margin-bottom: 24px;
}

.main-title {
    color: var(--green-primary);
    font-size: 2.25rem;
    line-height: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 12px;
}

.main-description {
    color: var(--gray-muted);
    font-size: 1.125rem;
    line-height: 1.75rem;
    max-width: 640px;
    margin: 0 auto;
}

/* --- Progress Bar Card --- */
.progress-card {
    background: var(--white);
    border: 1px solid var(--gray-border);
    border-radius: var(--radius-md);
    padding: 20px 24px 16px;
    box-shadow: var(--shadow-card);
}

.progress-label {
    font-size: 0.875rem;
    color: var(--gray-muted);
    display: block;
    margin-bottom: 10px;
}

.progress-bar-track {
    width: 100%;
    height: 10px;
    background: var(--gray-border);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--green-primary);
    border-radius: var(--radius-full);
    transition: width 0.4s ease;
}

/* --- Question Card --- */
.question-card {
    background: var(--white);
    border: 1px solid var(--gray-border);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-card);
}

.step {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.step.hidden {
    display: none;
}

.question-title {
    color: var(--green-primary);
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.35;
}

.question-desc {
    color: var(--gray-muted);
    font-size: 0.95rem;
    line-height: 1.65;
}

.required-asterisk {
    color: var(--red-error);
    font-weight: bold;
}

/* --- Option Buttons --- */
.options-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-option {
    width: 100%;
    padding: 16px 20px;
    background: var(--white);
    border: 2px solid var(--gray-border);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: var(--font-family);
    color: var(--text-dark);
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s ease, background-color 0.15s ease;
    outline: none;
}

.btn-option:hover {
    border-color: var(--green-primary);
    background: var(--green-light);
}

.btn-option.selected {
    border-color: var(--green-primary);
    border-width: 2.5px;
    background: var(--green-light);
    font-weight: 500;
}

/* --- CPF Input --- */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-label {
    font-size: 0.95rem;
    color: var(--text-dark);
    font-weight: 600;
}

.optional-hint {
    font-size: 0.85rem;
    color: var(--gray-muted);
    font-weight: 400;
}

.cpf-input,
.text-input {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid var(--gray-border);
    border-radius: var(--radius-md);
    font-size: 1.25rem;
    font-family: var(--font-family);
    color: var(--text-dark);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    letter-spacing: 0.05em;
}

.cpf-input::placeholder,
.text-input::placeholder {
    color: #d1d5db;
    letter-spacing: 0.05em;
}

.cpf-input:focus,
.text-input:focus {
    border-color: var(--green-primary);
    box-shadow: 0 0 0 3px rgba(19, 130, 58, 0.12);
}

.cpf-input.input-error,
.text-input.input-error {
    border-color: var(--red-error);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* --- Error Messages --- */
.error-message {
    color: var(--red-error);
    font-size: 0.85rem;
    min-height: 1.2em;
    display: block;
}

/* --- Navigation Buttons --- */
.nav-buttons {
    display: flex;
    gap: 16px;
    margin-top: 8px;
}

.nav-buttons > * {
    flex: 1;
}

.btn {
    padding: 14px 24px;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font-family);
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.15s ease;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-primary {
    background: var(--green-primary);
    color: var(--white);
    border-color: var(--green-primary);
}

.btn-primary:hover {
    background: var(--green-dark);
    border-color: var(--green-dark);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-outline {
    background: var(--white);
    color: var(--green-primary);
    border-color: var(--gray-border);
}

.btn-outline:hover {
    border-color: var(--green-primary);
}

.btn-confirm {
    background: var(--green-primary);
    color: var(--white);
    border-color: var(--green-primary);
}

.btn-confirm:hover {
    background: var(--green-dark);
    border-color: var(--green-dark);
}

.btn-confirm:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* --- Step 6: Review --- */
.review-subtitle {
    color: var(--gray-muted);
    font-size: 1rem;
    margin-top: -8px;
}

.review-sections {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.review-section {
    background: var(--gray-light);
    border: 1px solid var(--gray-border);
    border-radius: var(--radius-md);
    padding: 20px;
}

.review-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.review-check-icon {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--green-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.review-check-icon svg {
    width: 12px;
    height: 12px;
    stroke: var(--green-primary);
    fill: none;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.review-section-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-dark);
}

.review-field {
    font-size: 0.9rem;
    color: var(--text-dark);
    padding: 2px 0;
}

.review-field strong {
    font-weight: 600;
}

/* Confirm checkbox */
.confirm-group {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 4px;
}

.confirm-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: var(--green-primary);
    cursor: pointer;
    flex-shrink: 0;
}

.confirm-group label {
    font-size: 0.95rem;
    color: var(--text-dark);
    cursor: pointer;
    line-height: 1.4;
}

/* --- Success Screen --- */
.success-screen {
    text-align: center;
    padding: 40px 20px;
}

.success-screen.hidden {
    display: none;
}

.success-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 20px;
    background: var(--green-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.success-icon svg {
    width: 36px;
    height: 36px;
    stroke: var(--white);
    fill: none;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.success-title {
    color: var(--green-primary);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.success-desc {
    color: var(--gray-muted);
    font-size: 1rem;
    line-height: 1.6;
    max-width: 480px;
    margin: 0 auto;
}

/* --- Footer --- */
.footer {
    text-align: center;
    padding: 20px 0 0;
    color: var(--gray-muted);
    font-size: 0.85rem;
    line-height: 1.6;
}

/* --- Loading spinner on buttons --- */
.btn .spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--white);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.btn.loading .spinner {
    display: inline-block;
}

.btn.loading .btn-text {
    display: none;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* --- Responsive --- */
@media (max-width: 640px) {
    .container {
        padding: 20px 16px 20px;
        gap: 18px;
    }

    .logo {
        width: 90%;
    }

    .main-title {
        font-size: 1.75rem;
        line-height: 2rem;
    }

    .main-description {
        font-size: 1rem;
        line-height: 1.6rem;
    }

    .progress-card {
        padding: 16px 18px 14px;
    }

    .question-card {
        padding: 22px 18px;
    }

    .question-title {
        font-size: 1.25rem;
    }

    .btn-option {
        padding: 14px 16px;
        font-size: 0.95rem;
    }

    .cpf-input,
    .text-input {
        font-size: 1.125rem;
        padding: 14px 16px;
    }

    .nav-buttons {
        flex-direction: column-reverse;
        gap: 10px;
    }

    .btn {
        padding: 14px 20px;
    }
}

/* ========================================
   Admin Page Styles
   ======================================== */
.admin-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    min-height: 100vh;
}

.admin-card {
    background: var(--white);
    border: 1px solid var(--gray-border);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-card);
    width: 100%;
    max-width: 480px;
}

.admin-card.admin-card-wide {
    max-width: 100%;
}

.admin-title {
    color: var(--green-primary);
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 8px;
}

.admin-subtitle {
    color: var(--gray-muted);
    font-size: 0.95rem;
    text-align: center;
    margin-bottom: 24px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray-border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: var(--font-family);
    color: var(--text-dark);
    outline: none;
    transition: border-color 0.15s ease;
}

.form-group input:focus {
    border-color: var(--green-primary);
}

.admin-btn {
    width: 100%;
    padding: 14px 24px;
    background: var(--green-primary);
    color: var(--white);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font-family);
    cursor: pointer;
    transition: background 0.15s ease;
    margin-top: 8px;
}

.admin-btn:hover {
    background: var(--green-dark);
}

.admin-error {
    background: rgba(239, 68, 68, 0.08);
    color: var(--red-error);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    margin-bottom: 16px;
    text-align: center;
}

/* Dashboard */
.dashboard-count {
    text-align: center;
    padding: 24px 0;
}

.dashboard-count .count-number {
    font-size: 4rem;
    font-weight: 800;
    color: var(--green-primary);
    line-height: 1;
    margin-bottom: 8px;
}

.dashboard-count .count-label {
    font-size: 1rem;
    color: var(--gray-muted);
}

.admin-logout {
    display: inline-block;
    color: var(--gray-muted);
    font-size: 0.875rem;
    text-decoration: none;
    text-align: center;
    width: 100%;
    margin-top: 12px;
}

.admin-logout:hover {
    color: var(--red-error);
}

/* Admin Table */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -8px;
}

.admin-table {
    width: 100%;
    min-width: 800px;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.admin-table th,
.admin-table td {
    white-space: nowrap;
    padding: 12px 16px;
}

.admin-table thead th {
    background: var(--green-primary);
    color: var(--white);
    text-align: left;
    font-weight: 600;
}

.admin-table thead th:first-child {
    border-radius: var(--radius-sm) 0 0 0;
}

.admin-table thead th:last-child {
    border-radius: 0 var(--radius-sm) 0 0;
}

.admin-table tbody td {
    border-bottom: 1px solid var(--gray-border);
    color: var(--text-dark);
}

.admin-table tbody tr:hover {
    background: var(--green-light);
}

.admin-table tbody tr:last-child td {
    border-bottom: none;
}

.admin-table .cpf-col {
    font-family: 'Courier New', monospace;
    font-weight: 600;
}

.admin-table .date-col {
    color: var(--gray-muted);
    font-size: 0.8rem;
}

.admin-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 20px;
}

.admin-pagination-info {
    font-size: 0.9rem;
    color: var(--gray-muted);
}

.admin-pagination-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
}

.admin-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--green-primary);
    color: var(--green-primary);
    text-decoration: none;
    font-weight: 600;
    transition: background 0.15s ease, color 0.15s ease;
}

.admin-page-btn:hover {
    background: var(--green-primary);
    color: var(--white);
}

.admin-page-btn.disabled {
    border-color: var(--gray-border);
    color: var(--gray-muted);
    background: transparent;
    cursor: not-allowed;
}

.admin-page-current {
    color: var(--text-dark);
    font-weight: 600;
}
