/* ===== RESET & VARIABLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #1a2744;
    --primary-light: #2c3e6b;
    --gold: #c9a84c;
    --gold-light: #d4b96a;
    --gold-dark: #a68a34;
    --white: #ffffff;
    --gray-50: #f8f9fa;
    --gray-100: #e9ecef;
    --gray-200: #dee2e6;
    --gray-300: #ced4da;
    --gray-400: #adb5bd;
    --gray-500: #6c757d;
    --gray-600: #495057;
    --gray-700: #343a40;
    --gray-800: #212529;
    --success: #28a745;
    --success-light: #d4edda;
    --danger: #dc3545;
    --danger-light: #f8d7da;
    --warning: #ffc107;
    --info: #17a2b8;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.12);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.16);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: var(--gray-800);
    min-height: 100vh;
    line-height: 1.6;
}

/* ===== HEADER ===== */
.header {
    background: var(--white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--primary);
}

.logo-icon {
    font-size: 1.8rem;
}

.logo-name {
    font-family: 'Playfair Display', serif;
    font-size: 1.4rem;
    font-weight: 700;
}

.header-badge {
    background: var(--gold);
    color: var(--primary);
    padding: 0.4rem 1rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* ===== MAIN CONTAINER ===== */
.main-container {
    max-width: 900px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.form-wrapper {
    background: var(--white);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    padding: 2.5rem;
    margin-bottom: 2rem;
}

/* ===== STEPPER ===== */
.stepper {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2.5rem;
    padding: 0 1rem;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    z-index: 1;
    transition: var(--transition);
}

.step-circle {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--gray-200);
    color: var(--gray-500);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    transition: var(--transition);
    border: 3px solid transparent;
}

.step.active .step-circle {
    background: var(--primary);
    color: var(--white);
    border-color: var(--gold);
    box-shadow: 0 0 0 6px rgba(201, 168, 76, 0.2);
}

.step.completed .step-circle {
    background: var(--success);
    color: var(--white);
}

.step-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--gray-500);
    text-align: center;
    transition: var(--transition);
}

.step.active .step-label {
    color: var(--primary);
    font-weight: 600;
}

.step.completed .step-label {
    color: var(--success);
}

.step-line {
    width: 80px;
    height: 3px;
    background: var(--gray-200);
    margin: 0 0.5rem;
    transition: var(--transition);
    flex-shrink: 0;
}

.step.completed + .step-line,
.step-line.completed {
    background: var(--success);
}

/* ===== FORM STEPS ===== */
.form-step {
    display: none;
    animation: fadeSlideIn 0.5s ease;
}

.form-step.active {
    display: block;
}

@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.step-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.6rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.step-icon {
    font-size: 1.8rem;
}

.step-description {
    color: var(--gray-500);
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

/* ===== FORM GRID ===== */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--gray-700);
}

.required {
    color: var(--danger);
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 0.75rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: 'Inter', sans-serif;
    transition: var(--transition);
    background: var(--white);
    color: var(--gray-800);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 4px rgba(201, 168, 76, 0.1);
}

.form-group input:read-only {
    background: var(--gray-100);
    color: var(--gray-600);
    cursor: not-allowed;
}

.form-group input.error,
.form-group select.error,
.form-group textarea.error {
    border-color: var(--danger);
    box-shadow: 0 0 0 4px rgba(220, 53, 69, 0.1);
}

.form-group input.success,
.form-group select.success,
.form-group textarea.success {
    border-color: var(--success);
    box-shadow: 0 0 0 4px rgba(40, 167, 69, 0.1);
}

.error-message {
    font-size: 0.75rem;
    color: var(--danger);
    min-height: 1.1rem;
    display: block;
}

.char-counter {
    font-size: 0.75rem;
    color: var(--gray-500);
    text-align: right;
}

.loading-cep {
    font-size: 0.8rem;
    color: var(--info);
    margin-top: 0.25rem;
}

/* ===== ANEXOS ===== */
.anexos-container {
    margin-top: 1rem;
}

.anexos-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.anexo-item {
    background: var(--gray-50);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 1.25rem;
    transition: var(--transition);
    animation: fadeSlideIn 0.4s ease;
}

.anexo-item:hover {
    border-color: var(--gold-light);
    box-shadow: var(--shadow);
}

.anexo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.anexo-number {
    font-weight: 700;
    color: var(--primary);
    font-size: 0.9rem;
}

.btn-remove-anexo {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid var(--danger);
    background: var(--white);
    color: var(--danger);
    cursor: pointer;
    font-size: 0.9rem;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-remove-anexo:hover {
    background: var(--danger);
    color: var(--white);
}

.anexo-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.file-info {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
}

.btn-add-anexo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 1rem;
    margin-top: 1rem;
    border: 2px dashed var(--gold);
    background: transparent;
    color: var(--gold-dark);
    font-weight: 600;
    cursor: pointer;
    border-radius: var(--radius);
    transition: var(--transition);
    font-size: 0.95rem;
}

.btn-add-anexo:hover {
    background: rgba(201, 168, 76, 0.05);
    border-style: solid;
}

.btn-add-anexo:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-icon {
    font-size: 1.3rem;
    font-weight: 700;
}

.anexos-info {
    text-align: center;
    color: var(--gray-400);
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

/* ===== NAVIGATION BUTTONS ===== */
.form-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--gray-200);
    gap: 1rem;
}

.btn {
    padding: 0.85rem 2rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    font-family: 'Inter', sans-serif;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-prev {
    background: var(--gray-100);
    color: var(--gray-600);
    border: 1px solid var(--gray-200);
}

.btn-prev:hover {
    background: var(--gray-200);
    color: var(--gray-800);
}

.btn-next {
    background: var(--primary);
    color: var(--white);
    margin-left: auto;
    box-shadow: 0 4px 12px rgba(26, 39, 68, 0.3);
}

.btn-next:hover {
    background: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(26, 39, 68, 0.4);
}

.btn-submit {
    background: var(--gold);
    color: var(--primary);
    margin-left: auto;
    box-shadow: 0 4px 12px rgba(201, 168, 76, 0.3);
    font-size: 1rem;
}

.btn-submit:hover {
    background: var(--gold-dark);
    color: var(--white);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(201, 168, 76, 0.4);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ===== SUCCESS PAGE (STEP 4) ===== */
.success-container {
    text-align: center;
    padding: 2rem 1rem;
    animation: fadeSlideIn 0.6s ease;
}

.success-icon {
    font-size: 5rem;
    margin-bottom: 1rem;
    animation: bounceIn 0.8s ease;
}

@keyframes bounceIn {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.success-title {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.success-message {
    color: var(--gray-500);
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

.protocolo-box {
    background: var(--primary);
    color: var(--white);
    padding: 1.5rem 2rem;
    border-radius: var(--radius);
    display: inline-block;
    margin-bottom: 2rem;
}

.protocolo-label {
    display: block;
    font-size: 0.85rem;
    color: var(--gold-light);
    margin-bottom: 0.5rem;
}

.protocolo-numero {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 2px;
    font-family: 'Courier New', monospace;
}

.whatsapp-text {
    color: var(--gray-600);
    margin-bottom: 1rem;
}

.btn-whatsapp {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--success);
    color: var(--white);
    text-decoration: none;
    padding: 1rem 2rem;
    border-radius: 50px;
    font-weight: 600;
    transition: var(--transition);
    font-size: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.btn-whatsapp:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
}

.whatsapp-icon {
    width: 24px;
    height: 24px;
}

.btn-voltar {
    display: block;
    color: var(--gray-500);
    text-decoration: none;
    margin-top: 1rem;
    font-weight: 500;
    transition: var(--transition);
}

.btn-voltar:hover {
    color: var(--primary);
    text-decoration: underline;
}

/* ===== MODAL LOADING ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-loading {
    background: var(--white);
    padding: 2.5rem;
    border-radius: var(--radius);
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--gray-200);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.modal-loading p {
    color: var(--gray-600);
    font-weight: 500;
}

/* ===== FOOTER ===== */
.footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--gray-500);
    font-size: 0.8rem;
}

/* ===== ALERTA URGÊNCIA ===== */
.alerta-urgencia {
    background: var(--warning);
    color: var(--gray-800);
    padding: 1rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
    margin-top: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: fadeSlideIn 0.3s ease;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .form-wrapper {
        padding: 1.5rem;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .anexo-fields {
        grid-template-columns: 1fr;
    }
    
    .stepper {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .step-line {
        width: 40px;
    }
    
    .form-navigation {
        flex-direction: column;
    }
    
    .btn-next,
    .btn-submit {
        margin-left: 0;
        width: 100%;
        justify-content: center;
    }
    
    .btn-prev {
        width: 100%;
        justify-content: center;
    }
    
    .success-title {
        font-size: 1.5rem;
    }
    
    .protocolo-numero {
        font-size: 1.3rem;
    }
}

@media (max-width: 480px) {
    .header-container {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .step-circle {
        width: 35px;
        height: 35px;
        font-size: 0.85rem;
    }
    
    .step-line {
        width: 20px;
    }
    
    .step-label {
        font-size: 0.7rem;
    }
}