:root {
    --primary: #28a745;
    --primary-hover: #218838;
    --bg-light: #f8f9fa;
    --border-color: #e5e7eb;
    --text-main: #333;
    --text-muted: #4b5563;
    --text-helper: #6b7280;
}

/* Base */
body {
    font-family: 'Inter', sans-serif;
    margin: 0;
}

/* Layout Principal */
.cadastro-wrapper {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--bg-light) 0%, #e9ecef 100%);
    padding: 2rem 1rem;
    display: flex;
    justify-content: center;
    box-sizing: border-box;
}

.cadastro-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    width: 100%;
    max-width: 850px;
    padding: 2.5rem;
    box-sizing: border-box;
}

/* Tipografia e Headers */
.cadastro-header { text-align: center; margin-bottom: 2.5rem; }
.emoji-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }

.section { 
    margin-bottom: 2.5rem; 
    animation: fadeIn 0.5s ease forwards; 
}

.section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 2px solid var(--bg-light);
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
}

/* Grid de Formulário */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
    width: 100%;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-width: 0; /* Evita quebra de grid com inputs longos */
}

.field.full {
    grid-column: span 2;
}

/* Inputs, Selects e Labels */
label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.required::after {
    content: " *";
    color: #dc3545;
}

input,
select,
.ts-control {
    padding: 0.75rem !important;
    border: 2px solid var(--border-color) !important;
    border-radius: 10px !important;
    font-size: 16px !important; /* Evita zoom no iOS */
    transition: all 0.2s ease;
    width: 100%;
    box-sizing: border-box;
    background-color: #fff;
}

input:focus, 
.ts-wrapper.focus .ts-control {
    outline: none;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 4px rgba(40, 167, 69, 0.1) !important;
}

/* Elementos Selecionáveis (Valores/Pagamento) */
.selectable-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    margin: 1rem 0;
}

.selectable-item {
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
}

.selectable-item.active {
    border-color: var(--primary);
    background: #f0fff4;
    box-shadow: 0 4px 10px rgba(40, 167, 69, 0.1);
    transform: translateY(-2px);
}

.item-label { font-weight: 700; display: block; }
.item-desc { font-size: 0.75rem; color: var(--text-helper); }

/* Conformidade e LGPD */
.compliance-container {
    background: #fdfdfd;
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    margin-top: 1rem;
}

.check-field {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 12px;
    cursor: pointer;
}

.check-field input {
    width: 18px;
    height: 18px;
    margin-top: 2px;
}

.check-label {
    font-size: 0.9rem;
    line-height: 1.4;
    color: var(--text-muted);
}

.check-label a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}

/* Helpers e Utilidades */
.helper-text {
    font-size: 0.75rem;
    color: var(--text-helper);
    font-style: italic;
}

.hidden { display: none !important; }

.btn-submit {
    background: var(--primary);
    color: white;
    border: none;
    padding: 1.25rem;
    border-radius: 50px; /* Estilo mais moderno e arredondado */
    font-size: 1.2rem;
    font-weight: 700;
    width: 100%;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 1rem;
}

.btn-submit:hover {
    background: var(--primary-hover);
    transform: scale(1.01);
}

.field.full:has(#diocese-select) {
    position: relative;
    z-index: 100;
}

/* Customização do Dropdown do Tom Select */
.ts-dropdown {
    z-index: 999 !important; /* Joga as opções para a frente de tudo */
    border-radius: 10px !important;
    border: 2px solid var(--primary) !important;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1) !important;
    margin-top: 5px !important;
}

/* Estilo das opções individuais */
.ts-dropdown .option {
    padding: 10px 12px !important;
    font-size: 14px;
}

/* Cor de destaque ao passar o mouse ou selecionar */
.ts-dropdown .active {
    background-color: var(--primary) !important;
    color: white !important;
}

/* Ajuste para não cortar o card se o select for o último item da seção */
.section {
    overflow: visible !important;
}

.cadastro-card {
    overflow: visible !important;
}

/* Responsividade */
@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }

    .field.full {
        grid-column: span 1;
    }

    .cadastro-card {
        padding: 1.5rem;
    }

    .cadastro-header h2 {
        font-size: 1.5rem;
    }
}

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