:root {
    --maxpool-primary: #04658c;
    --maxpool-secondary: #6c757d;
    --maxpool-success: #28a745;
    --maxpool-light: #f8f9fa;
    --maxpool-gradient: linear-gradient(135deg, #04658c 0%, #033d5c 100%);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #f5f7fa;
    min-height: 100vh;
    color: #2c3e50;
}

.main-container {
    background: white;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border-radius: 15px;
    overflow: hidden;
    margin: 1rem auto;
    max-width: 1000px;
}

.header-section {
    background: var(--maxpool-gradient);
    color: white;
    padding: 1.5rem;
    text-align: center;
}

.logo-section h2 {
    font-size: 1.3rem;
    margin: 0.5rem 0 0.2rem 0;
}

.logo-section p {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Progress Indicator - MANTIDO PARA COMPATIBILIDADE */
.progress-container {
    padding: 0 2rem;
}

.progress-steps {
    display: flex;
    justify-content: space-between;
    position: relative;
}

.progress-steps::before {
    content: '';
    position: absolute;
    top: 15px;
    left: 0;
    right: 0;
    height: 2px;
    background: #e9ecef;
    z-index: 1;
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 2;
    flex: 1;
}

.step-number {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #e9ecef;
    color: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    border: 2px solid #e9ecef;
}

.progress-step.active .step-number {
    background: var(--maxpool-primary);
    color: white;
    border-color: var(--maxpool-primary);
}

.step-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: #6c757d;
    text-align: center;
}

.progress-step.active .step-label {
    color: var(--maxpool-primary);
    font-weight: 600;
}

/* Form Steps - MANTIDO PARA COMPATIBILIDADE */
.form-step {
    display: none;
}

.form-step.active {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

/* Seções Compactas - MANTIDO PARA COMPATIBILIDADE */
.section-title-ficha {
    background: var(--maxpool-gradient);
    color: white;
    padding: 0.7rem 1rem;
    margin: 1.5rem -1.5rem 1rem -1.5rem;
    font-size: 1rem;
    font-weight: 600;
}

.form-section {
    padding: 1.5rem;
}

/* Form Controls Compactos */
.form-control, .form-select {
    border: 1.5px solid #e9ecef;
    border-radius: 8px;
    padding: 0.6rem 0.8rem;
    font-size: 0.9rem;
}

.form-control:focus, .form-select:focus {
    border-color: var(--maxpool-primary);
    box-shadow: 0 0 0 0.2rem rgba(4, 101, 140, 0.1);
}

.form-control-sm {
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
}

.form-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.3rem;
    font-size: 0.9rem;
}

/* Checkboxes Compactos */
.form-check.compact {
    margin-bottom: 0.5rem;
    padding-left: 1.8rem;
}

.form-check.compact .form-check-input {
    margin-left: -1.8rem;
    margin-top: 0.2rem;
}

.form-check-label {
    font-size: 0.9rem;
}

/* Grids Compactos */
.grid-container {
    display: grid;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 1rem;
}

.grid-header {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    background: var(--maxpool-gradient);
    color: white;
    font-weight: 600;
    padding: 0.8rem 0.5rem;
    font-size: 0.8rem;
    gap: 0.3rem;
}

.grid-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    padding: 0.5rem;
    gap: 0.3rem;
    align-items: center;
    border-bottom: 1px solid #e9ecef;
    background: white;
}

.grid-row:last-child {
    border-bottom: none;
}

.grid-cell {
    padding: 0.3rem;
}

.grid-cell .form-control {
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 0.85rem;
    width: 100%;
}

/* Alert Compact */
.compact-alert {
    padding: 0.6rem 0.8rem;
    font-size: 0.85rem;
    margin: 0;
}

.compact-alert i {
    font-size: 0.9rem;
}

/* Botões */
.btn {
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.btn-primary {
    background: var(--maxpool-primary);
    border: none;
}

.btn-primary:hover {
    background: #033d5c;
    transform: translateY(-1px);
}

.btn-success {
    background: #28a745;
    border: none;
}

.btn-success:hover {
    background: #218838;
    transform: translateY(-1px);
}

.add-row-btn {
    background: rgba(40, 167, 69, 0.1);
    border: 1.5px solid var(--maxpool-success);
    color: var(--maxpool-success);
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
}

.remove-row-btn {
    background: rgba(220, 53, 69, 0.1);
    border: none;
    color: var(--maxpool-danger);
    padding: 0.3rem 0.6rem;
    font-size: 0.7rem;
}

/* ✅ ESTILOS PARA TERMOS E CONDIÇÕES */
.terms-section {
    margin-bottom: 1.5rem;
}

.terms-content {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    background: #f8f9fa;
    font-size: 0.85rem;
    line-height: 1.5;
    margin-bottom: 1rem;
}

.terms-content h6 {
    color: #04658c;
    font-size: 0.95rem;
    margin-bottom: 15px;
    font-weight: 600;
}

.terms-content p {
    margin-bottom: 10px;
}

.terms-content ul, .terms-content ol {
    padding-left: 1.5rem;
    margin-bottom: 10px;
}

.terms-content li {
    margin-bottom: 5px;
    line-height: 1.4;
}

.terms-content strong {
    color: #04658c;
}

.terms-acceptance {
    margin-top: 1rem;
}

.terms-acceptance .form-check {
    padding-left: 2rem;
}

.terms-acceptance .form-check-input {
    width: 1.2em;
    height: 1.2em;
    margin-left: -2rem;
    margin-top: 0.2em;
    border: 2px solid #6c757d;
}

.terms-acceptance .form-check-input:focus {
    border-color: #04658c;
    box-shadow: 0 0 0 0.2rem rgba(4, 101, 140, 0.25);
}

.terms-acceptance .form-check-input:checked {
    background-color: #04658c;
    border-color: #04658c;
}

.terms-acceptance .form-check-input:invalid {
    border-color: #dc3545;
}

.terms-acceptance .form-check-input:valid {
    border-color: #28a745;
}

.terms-acceptance .form-check-label {
    font-size: 0.85rem;
    line-height: 1.4;
    font-weight: 600;
    color: #2c3e50;
    cursor: pointer;
}

.terms-acceptance .form-text {
    font-size: 0.8rem;
    color: #6c757d;
    margin-top: 0.5rem;
}

/* ✅ ESTILOS PARA UPLOAD DE PDF */
.upload-section {
    margin-bottom: 1.5rem;
}

.upload-item {
    padding: 12px;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    background: #f8f9fa;
    transition: all 0.3s ease;
    margin-bottom: 15px;
    position: relative;
}

.upload-item:hover {
    border-color: #04658c;
    background: #e8f4fd;
}

.upload-item .form-control {
    border: 1px solid #dee2e6;
    font-size: 0.85rem;
}

.upload-item .form-control.is-valid {
    border-color: #28a745;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%2328a745' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.upload-item .form-control.is-invalid {
    border-color: #dc3545;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath d='m5.8 3.6.4.4.4-.4'/%3e%3cpath d='M6 7v1'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.file-error-message {
    font-size: 0.75rem;
    color: #dc3545;
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.upload-section .btn-outline-secondary {
    border-color: #04658c;
    color: #04658c;
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
    transition: all 0.3s ease;
}

.upload-section .btn-outline-secondary:hover {
    background: #04658c;
    color: white;
    transform: translateY(-1px);
}

.upload-section .btn-outline-danger {
    font-size: 0.7rem;
    padding: 0.3rem 0.6rem;
    margin-top: 5px;
}

/* Instruções Compactas */
.instructions-section {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1.5rem;
}

.instructions-section h6 {
    color: #04658c;
    margin-bottom: 0.8rem;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
}

.instruction-item {
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    line-height: 1.4;
    padding-left: 0.5rem;
    border-left: 2px solid #04658c;
}

.instruction-item:last-child {
    margin-bottom: 0;
}

.instruction-item strong {
    color: #04658c;
}

/* Navegação */
.form-navigation {
    border-top: 1px solid #e9ecef;
    padding-top: 1.5rem;
}

/* Input Groups Compactos */
.input-group-sm .input-group-text {
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
}

.input-group-sm .form-control {
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
}

/* Form Floating Compact */
.form-floating {
    margin-bottom: 1rem;
}

.form-floating > .form-control {
    height: 100px;
    font-size: 0.9rem;
}

.form-floating > label {
    font-size: 0.9rem;
    padding: 0.8rem 0.75rem;
}

/* Validação de Campos */
.is-invalid {
    border-color: #dc3545 !important;
}

.is-valid {
    border-color: #28a745 !important;
}

.invalid-feedback {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #dc3545;
}

/* Animações de loading */
.loading-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Mensagens */
.alert {
    border-radius: 8px;
    border: none;
    font-size: 0.9rem;
}

.error-container {
    animation: slideDown 0.3s ease-out;
}

/* Utilitários */
.g-3 {
    --bs-gutter-x: 0.75rem;
    --bs-gutter-y: 0.75rem;
}

.mt-1 {
    margin-top: 0.25rem !important;
}

.mt-4 {
    margin-top: 1rem !important;
}

.mb-3 {
    margin-bottom: 0.75rem !important;
}

.mb-4 {
    margin-bottom: 1rem !important;
}

/* ===== NOVOS ESTILOS PARA FORMULÁRIO SIMPLIFICADO ===== */

/* Seções Colapsáveis */
.form-section-collapsible {
    border: 1px solid #e9ecef;
    border-radius: 10px;
    margin-bottom: 1rem;
    overflow: hidden;
    background: white;
    transition: all 0.3s ease;
}

.form-section-collapsible.active {
    border-color: var(--maxpool-primary);
    box-shadow: 0 2px 10px rgba(4, 101, 140, 0.1);
}

.section-header {
    background: #f8f9fa;
    padding: 1rem 1.5rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    border-bottom: 1px solid transparent;
}

.form-section-collapsible.active .section-header {
    background: var(--maxpool-gradient);
    color: white;
    border-bottom-color: #e9ecef;
}

.section-header:hover {
    background: #e9ecef;
}

.form-section-collapsible.active .section-header:hover {
    background: #033d5c;
}

/* CORREÇÃO: Mudado de .section-title para .section-title-collapse para evitar conflito */
.section-title-collapse {
    font-weight: 600;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    margin: 0;
}

.section-toggle {
    transition: transform 0.3s ease;
    font-size: 0.9rem;
}

.form-section-collapsible.active .section-toggle {
    transform: rotate(180deg);
}

.section-content {
    padding: 1.5rem;
    display: block;
}

.form-section-collapsible:not(.active) .section-content {
    display: none;
}

.section-subtitle {
    font-weight: 600;
    color: var(--maxpool-primary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e9ecef;
    font-size: 1rem;
    display: flex;
    align-items: center;
}

/* Botões de Ação Globais */
.form-actions {
    text-align: center;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.btn-expand-all, .btn-collapse-all {
    background: var(--maxpool-secondary);
    border: none;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    margin: 0 0.25rem;
    transition: all 0.3s ease;
    font-weight: 500;
}

.btn-expand-all:hover, .btn-collapse-all:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

/* Ajustes para o formulário simplificado */
.simplified-form .progress-container {
    display: none;
}

.simplified-form .form-navigation {
    border-top: 1px solid #e9ecef;
    padding-top: 1.5rem;
    text-align: center;
}

.simplified-form .btn-success {
    padding: 0.75rem 2rem;
    font-size: 1rem;
    font-weight: 600;
}

/* Estados dos campos obrigatórios */
.required-field::after {
    content: " *";
    color: #dc3545;
}

/* Melhorias de espaçamento para o formulário único */
.simplified-form .form-section {
    padding: 1.5rem;
}

.simplified-form .section-content .row {
    margin-bottom: 0.5rem;
}

/* Indicador visual para seções com campos obrigatórios */


/* ===== ANIMAÇÕES UNIFICADAS ===== */
@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(10px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

@keyframes slideDown {
    from { 
        opacity: 0; 
        transform: translateY(-10px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes slideDownExpand {
    from {
        opacity: 0;
        max-height: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        max-height: 1000px;
        transform: translateY(0);
    }
}

.form-section-collapsible.active .section-content {
    animation: slideDownExpand 0.3s ease-out;
}

.form-step.active {
    animation: fadeIn 0.3s ease-in;
}

/* ===== RESPONSIVIDADE UNIFICADA ===== */
@media (max-width: 768px) {
    .main-container {
        margin: 0;
        border-radius: 0;
    }
    
    .form-section {
        padding: 1rem;
    }
    
    .progress-steps {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .progress-step {
        flex: 0 0 calc(50% - 0.5rem);
    }
    
    .section-title-ficha {
        margin: 1rem -1rem 0.8rem -1rem;
        padding: 0.6rem 1rem;
        font-size: 0.95rem;
    }
    
    .grid-header {
        display: none;
    }
    
    .grid-row {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.8rem;
        border: 1px solid #e9ecef;
        border-radius: 8px;
        margin-bottom: 0.8rem;
    }
    
    .grid-cell {
        display: flex;
        flex-direction: column;
        width: 100%;
    }
    
    .grid-cell::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 0.8rem;
        margin-bottom: 0.25rem;
        color: var(--maxpool-primary);
    }
    
    .row.g-3 {
        --bs-gutter-x: 0.75rem;
        --bs-gutter-y: 0.75rem;
    }
    
    /* Seções colapsáveis mobile */
    .section-header {
        padding: 0.8rem 1rem;
    }
    
    .section-content {
        padding: 1rem;
    }
    
    .section-title-collapse {
        font-size: 1rem;
    }
    
    .form-actions {
        padding: 0.8rem;
    }
    
    .btn-expand-all, .btn-collapse-all {
        display: block;
        width: 100%;
        margin: 0.25rem 0;
    }
    
    /* Responsividade para termos */
    .terms-content {
        max-height: 150px;
        font-size: 0.8rem;
        padding: 10px;
    }
    
    .terms-acceptance .form-check-label {
        font-size: 0.8rem;
    }
    
    /* Responsividade para upload */
    .upload-item {
        padding: 10px;
    }
}

@media (max-width: 576px) {
    .header-section {
        padding: 1rem;
    }
    
    .header-section h2 {
        font-size: 1.2rem;
    }
    
    .progress-step {
        flex: 0 0 100%;
    }
    
    .step-label {
        font-size: 0.75rem;
    }
    
    .form-check.compact {
        margin-bottom: 0.3rem;
    }
    
    .instructions-section {
        padding: 0.8rem;
    }
    
    .instruction-item {
        font-size: 0.8rem;
    }
    
    /* Seções colapsáveis mobile pequeno */
    .section-header {
        padding: 0.7rem 0.8rem;
    }
    
    .section-title-collapse {
        font-size: 0.95rem;
    }
    
    .section-content {
        padding: 0.8rem;
    }
    
    /* Mobile para termos */
    .terms-acceptance .form-check {
        padding-left: 1.8rem;
    }
    
    .terms-acceptance .form-check-input {
        margin-left: -1.8rem;
    }
}

/* Estados de foco e hover para melhor UX */
.form-check-input:focus {
    box-shadow: 0 0 0 0.2rem rgba(4, 101, 140, 0.25);
}

.btn:focus {
    box-shadow: 0 0 0 0.2rem rgba(4, 101, 140, 0.25);
}

/* Estilos para ícones */
.fas, .fab {
    font-size: 0.9em;
}

/* Melhorias de acessibilidade */
@media (prefers-reduced-motion: reduce) {
    .form-step.active,
    .form-section-collapsible.active .section-content,
    .btn {
        animation: none;
        transition: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .terms-content {
        border: 2px solid #000;
    }
    
    .upload-item {
        border: 2px dashed #000;
    }
    
    .section-title-ficha {
        background: #000;
        color: #fff;
    }
    
    .grid-header {
        background: #000;
    }
}