:root {
    --azul-escuro: #1a365d;
    --azul-medio: #2d5aa0;
    --azul-claro: #4a7bc8;
    --laranja: #fd7e14;
    --vermelho: #d9534f;
    --verde: #198754;
    --cinza-claro: #f8f9fa;
    --cinza-medio: #e9ecef;
    --cinza-escuro: #6c757d;
    --branco: #ffffff;
}

* {
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    background-color: #f0f2f5;
    color: #333;
    line-height: 1.5;
    font-size: 17px;
    padding-bottom: env(safe-area-inset-bottom);
    -webkit-font-smoothing: antialiased;
}

/* Header estilo metaPROF com logo */
.header-meta {
    background: white;
    padding: 12px 0;
    border-bottom: 1px solid #e1e5e9;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    max-width: 1200px;
    margin: 0 auto;
}

.logo-wrapper {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.logo-container {
    display: flex;
    align-items: center;
}

.logo-img {
    height: 40px;
    width: auto;
    margin-right: 12px;
}

.logo-fallback {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--azul-medio), var(--azul-claro));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    color: white;
    font-weight: bold;
    font-size: 18px;
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-main {
    color: var(--azul-escuro);
    font-size: 22px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.5px;
}

.logo-main span {
    color: var(--azul-medio);
}

.logo-subtitle {
    color: var(--cinza-escuro);
    font-size: 12px;
    font-weight: 500;
    margin-top: 2px;
}

.header-badge {
    background: linear-gradient(135deg, var(--azul-medio), var(--azul-claro));
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(45, 90, 160, 0.2);
}

/* Banner abaixo do header */
.form-banner {
    background: linear-gradient(135deg, var(--azul-escuro) 0%, var(--azul-medio) 100%);
    color: white;
    padding: 20px 0;
    text-align: center;
    border-bottom: 4px solid var(--azul-claro);
}

.form-banner h1 {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 8px 0;
    color: white;
}

.form-banner p {
    margin: 0;
    opacity: 0.9;
    font-size: 16px;
    font-weight: 400;
}

/* Container principal mobile */
.main-container {
    padding: 0;
    max-width: 100%;
}

/* Card do formulário */
.form-card {
    background: white;
    border-radius: 0;
    box-shadow: none;
    border: none;
    margin-bottom: 0;
}

@media (min-width: 768px) {
    .form-card {
        border-radius: 16px;
        box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
        margin: 20px auto;
        max-width: 600px;
        border: 1px solid #e1e5e9;
    }
}

.form-body {
    padding: 20px;
}

@media (min-width: 768px) {
    .form-body {
        padding: 30px;
    }
}

/* Elementos de formulário */
.form-label {
    font-weight: 600;
    color: var(--azul-escuro);
    margin-bottom: 10px;
    font-size: 16px;
    display: block;
}

.form-label.required-label::after {
    content: " *";
    color: var(--vermelho);
    font-weight: bold;
}

/* Estilos base para inputs - Consolidado */
.form-control, 
.form-select,
input[type="date"].form-control,
textarea.form-control,
.other-input {
    border: 2px solid #d1d9e6;
    border-radius: 12px;
    padding: 16px;
    font-size: 17px;
    transition: border-color 0.2s, box-shadow 0.2s;
    min-height: 56px;
    background-color: var(--branco) !important;
    width: 100%;
}

textarea.form-control {
    min-height: 120px;
    line-height: 1.5;
}

select.form-control, 
input[type="date"].form-control {
    height: 56px;
    padding: 16px;
}

/* Estados comuns para inputs */
.form-control:focus, 
.form-select:focus,
textarea.form-control:focus,
.other-input:focus,
input[type="date"].form-control:focus {
    border-color: var(--azul-claro);
    box-shadow: 0 0 0 4px rgba(74, 123, 200, 0.15);
    outline: none;
    background-color: var(--branco) !important;
}

.form-control:hover, 
.form-select:hover,
.form-control:active, 
.form-select:active {
    background-color: var(--branco) !important;
}

/* Sobrescreve autofill do navegador */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px var(--branco) inset !important;
    background-color: var(--branco) !important;
    color: inherit !important;
}

/* Checkboxes e radios */
.form-check-input {
    width: 22px;
    height: 22px;
    margin-top: 0.3em;
    margin-right: 12px;
    border: 2px solid #adb5bd;
}

.form-check-input:checked {
    background-color: var(--azul-medio);
    border-color: var(--azul-medio);
}

.form-check-input:focus {
    border-color: var(--azul-claro);
    box-shadow: 0 0 0 4px rgba(74, 123, 200, 0.15);
}

.form-check-label {
    font-size: 16px;
    color: #2d3748;
    line-height: 1.5;
    padding-top: 2px;
    display: block;
    font-weight: 500;
}

.form-check {
    margin-bottom: 14px;
    min-height: 24px;
    display: flex;
    align-items: flex-start;
}

/* Grupos de opções */
.options-group {
    background-color: var(--cinza-claro);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 24px;
    border-left: 6px solid var(--azul-claro);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.section-title {
    color: var(--azul-escuro);
    font-weight: 700;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid rgba(74, 123, 200, 0.2);
    font-size: 18px;
}

.section-title i {
    margin-right: 10px;
    color: var(--azul-medio);
    font-size: 20px;
}

/* Alertas */
.alert-meta {
    background-color: #e8f1ff;
    border: 2px solid #c5d7f2;
    border-left: 6px solid var(--azul-medio);
    color: var(--azul-escuro);
    border-radius: 12px;
    padding: 18px;
    margin-bottom: 24px;
    font-size: 15px;
}

.alert-meta strong {
    color: var(--azul-escuro);
    font-weight: 700;
}

.alert-danger-meta {
    background-color: #fde8e8;
    border: 2px solid #f5c6cb;
    border-left: 6px solid var(--vermelho);
    color: #721c24;
}

/* Botões */
.btn-meta {
    background: linear-gradient(to right, var(--laranja), #e96b00);
    border: none;
    color: white;
    font-weight: 700;
    padding: 18px 30px;
    border-radius: 14px;
    transition: all 0.3s;
    font-size: 18px;
    width: 100%;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(253, 126, 20, 0.2);
}

.btn-meta:hover, 
.btn-meta:active {
    background: linear-gradient(to right, #e96b00, #d45b00);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(253, 126, 20, 0.3);
}

.btn-outline-meta {
    background: transparent;
    border: 2px solid var(--laranja);
    color: var(--laranja);
    font-weight: 600;
    padding: 16px 24px;
    border-radius: 12px;
    transition: all 0.3s;
    font-size: 16px;
    width: 100%;
    min-height: 54px;
}

.btn-outline-meta:hover, 
.btn-outline-meta:active {
    background-color: var(--laranja);
    color: white;
}

/* Footer */
.footer-meta {
    background-color: var(--azul-escuro);
    color: rgba(255, 255, 255, 0.85);
    padding: 30px 20px;
    margin-top: 40px;
    font-size: 14px;
}

.footer-meta a {
    color: rgba(255, 255, 255, 0.95);
    text-decoration: none;
    font-weight: 500;
}

.footer-meta a:hover {
    color: white;
    text-decoration: underline;
}

/* Campos específicos */
.other-input {
    margin-top: 12px;
    margin-left: 34px;
    width: calc(100% - 34px);
}

/* Upload de arquivos */
.file-upload-container {
    background-color: var(--cinza-claro);
    border: 2px dashed #b8c4da;
    border-radius: 16px;
    padding: 24px 16px;
    text-align: center;
    margin-top: 16px;
    transition: all 0.3s;
    cursor: pointer;
}

.file-upload-container:hover,
.file-upload-container.active,
.file-upload-container.dragover {
    border-color: var(--azul-claro);
    background-color: #f0f5ff;
}

.file-upload-container.dragover {
    border-style: solid;
}

.file-list-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    margin-bottom: 0.75rem;
}

.file-list-item i {
    font-size: 1.2rem;
    margin-right: 0.75rem;
    color: var(--azul-medio);
}

.file-list-item .file-size {
    font-size: 0.9rem;
    color: var(--cinza-escuro);
    margin-left: auto;
}

.btn-remove-file {
    background: none;
    border: none;
    color: var(--vermelho);
    margin-left: 0.75rem;
    cursor: pointer;
    padding: 4px;
}

.btn-remove-file:hover {
    color: #a71d2a;
}

/* Progress indicator para mobile */
.progress-indicator {
    display: none;
}

@media (max-width: 767px) {
    .progress-indicator {
        display: flex;
        justify-content: center;
        padding: 12px 0;
        background: white;
        border-bottom: 1px solid #eaeaea;
    }
    
    .progress-step {
        width: 10px;
        height: 10px;
        border-radius: 50%;
        background-color: #e0e0e0;
        margin: 0 6px;
        transition: all 0.3s;
    }
    
    .progress-step.active {
        background-color: var(--azul-medio);
        transform: scale(1.3);
    }
    
    .header-badge {
        font-size: 11px;
        padding: 5px 10px;
    }
    
    .logo-img {
        height: 36px;
        margin-right: 10px;
    }
    
    .logo-main {
        font-size: 20px;
    }
    
    .logo-subtitle {
        font-size: 11px;
    }
}

/* Estilo para inputs de data */
input[type="date"] {
    position: relative;
}

input[type="date"]::-webkit-calendar-picker-indicator {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    opacity: 0.7;
    cursor: pointer;
}

/* Back to top button */
.back-to-top {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 50px;
    height: 50px;
    background-color: var(--azul-medio);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 999;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s;
    border: none;
}

.back-to-top.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Ajustes específicos para iOS */
@supports (-webkit-touch-callout: none) {
    .form-control, .form-select, input, select, textarea {
        font-size: 16px; /* Prevenir zoom automático no iOS */
    }
}

/* Utilitários */
.form-section-spacing {
    margin-bottom: 32px;
}

.required-hint {
    color: var(--vermelho);
    font-size: 14px;
    margin-top: 8px;
    margin-bottom: 16px;
    font-weight: 500;
}

.text-meta {
    color: var(--laranja) !important;
}

.touch-target {
    min-height: 44px;
    min-width: 44px;
}

/* Validação */
.is-valid {
    border-color: var(--verde) !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23198754' 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);
}

.is-invalid {
    border-color: var(--vermelho) !important;
    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 stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%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);
}

.border-danger {
    border: 2px solid var(--vermelho) !important;
    border-radius: 8px;
    padding: 10px;
    background-color: rgba(220, 53, 69, 0.05);
}

.border-success {
    border: 2px solid var(--verde) !important;
    border-radius: 8px;
    padding: 10px;
    background-color: rgba(25, 135, 84, 0.05);
}

/* Melhorar a visualização em telas muito pequenas */
@media (max-width: 360px) {
    .form-body {
        padding: 16px;
    }
    
    .options-group {
        padding: 16px;
    }
    
    .form-banner {
        padding: 16px 0;
    }
    
    .form-banner h1 {
        font-size: 20px;
    }
    
    .logo-img {
        height: 32px;
    }
    
    .logo-main {
        font-size: 18px;
    }
}