/* 
   Design: Neumorfismo Clínico (Soft UI)
   Principles: Suavidade, Limpeza, Acessibilidade
*/

:root {
    --bg-color: #F0F3F5;
    --surface-color: #F0F3F5;
    --primary-color: #007AFF;
    --text-color: #2C3E50;
    --text-light: #7F8C8D;
    --shadow-light: #FFFFFF;
    --shadow-dark: #D1D9E6;
    --danger-color: #FF3B30;
    --success-color: #28C76F;
    --border-radius: 16px;
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Nunito', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 480px; /* Mobile-first constraint */
    margin: 0 auto;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px 0;
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* Tabs */
.tabs {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
    background: var(--surface-color);
    padding: 5px;
    border-radius: 20px;
    box-shadow: 
        5px 5px 10px var(--shadow-dark), 
        -5px -5px 10px var(--shadow-light);
}

.tab-btn {
    flex: 1;
    border: none;
    background: transparent;
    padding: 12px;
    border-radius: 15px;
    color: var(--text-light);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    font-size: 0.85rem;
}

.tab-btn i {
    font-size: 1.2rem;
    margin-bottom: 2px;
}

.tab-btn.active {
    color: var(--primary-color);
    box-shadow: 
        inset 3px 3px 6px var(--shadow-dark), 
        inset -3px -3px 6px var(--shadow-light);
}

/* Form Sections */
.form-section {
    margin-bottom: 25px;
    padding: 20px;
    border-radius: var(--border-radius);
    background: var(--surface-color);
    box-shadow: 
        5px 5px 10px var(--shadow-dark), 
        -5px -5px 10px var(--shadow-light);
}

.form-section h3 {
    font-size: 1.1rem;
    margin-bottom: 20px;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.optional {
    font-size: 0.8rem;
    color: var(--text-light);
    font-weight: 400;
}

/* Inputs */
.input-group {
    margin-bottom: 15px;
    position: relative;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-color);
    margin-left: 5px;
}

input {
    width: 100%;
    padding: 12px 15px;
    border: none;
    border-radius: 12px;
    background: var(--surface-color);
    color: var(--text-color);
    font-size: 1rem;
    box-shadow: 
        inset 2px 2px 5px var(--shadow-dark), 
        inset -2px -2px 5px var(--shadow-light);
    transition: var(--transition);
    outline: none;
}

input:focus {
    box-shadow: 
        inset 1px 1px 2px var(--shadow-dark), 
        inset -1px -1px 2px var(--shadow-light),
        0 0 0 2px rgba(0, 122, 255, 0.1);
}

input.input-error {
    border: 1px solid var(--danger-color);
    box-shadow: 0 0 0 2px rgba(255, 59, 48, 0.1);
}

/* input[readonly] removido para permitir edição total */

/* Layout Helpers */
.row {
    display: flex;
    gap: 15px;
}

.w-30 { width: 30%; }
.w-40 { width: 40%; }
.w-60 { width: 60%; }
.w-70 { width: 70%; }

.hidden {
    display: none !important;
}

/* Buttons */
.actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 30px;
    margin-bottom: 50px;
}

button {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 
        5px 5px 10px rgba(0, 122, 255, 0.2), 
        -5px -5px 10px var(--shadow-light);
}

.btn-primary:active {
    transform: scale(0.98);
    box-shadow: inset 2px 2px 5px rgba(0,0,0,0.2);
}

.btn-secondary {
    background-color: var(--surface-color);
    color: var(--text-light);
    box-shadow: 
        5px 5px 10px var(--shadow-dark), 
        -5px -5px 10px var(--shadow-light);
}

.btn-secondary:active {
    box-shadow: 
        inset 2px 2px 5px var(--shadow-dark), 
        inset -2px -2px 5px var(--shadow-light);
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(240, 243, 245, 0.8);
    backdrop-filter: blur(5px);
    display: none; /* Alterado de flex para none para iniciar oculto */
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.active {
    display: flex !important; /* Força exibição mesmo se tiver classe hidden */
}

.modal-content {
    background: var(--surface-color);
    padding: 30px;
    border-radius: 20px;
    width: 90%;
    max-width: 350px;
    text-align: center;
    box-shadow: 
        10px 10px 20px var(--shadow-dark), 
        -10px -10px 20px var(--shadow-light);
}

.modal-content h3 {
    color: var(--text-color);
    margin-bottom: 10px;
}

.modal-content p {
    color: var(--text-light);
    margin-bottom: 25px;
    font-size: 0.9rem;
}

.modal-actions {
    display: flex;
    gap: 10px;
}

/* Valor Section */
.valor-section {
    text-align: center;
    border: 2px solid var(--primary-color);
}

.valor-display {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary-color);
    margin: 10px 0;
}

.valor-detalhe {
    font-size: 0.9rem;
    color: var(--text-light);
}

/* Beneficiários Múltiplos */
.beneficiario-card {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 25px; /* Aumentado para dar espaço */
    position: relative;
    border: 1px solid #e9ecef;
    box-shadow: inset 2px 2px 5px rgba(0,0,0,0.05);
}

.action-btn-container {
    margin-top: 20px;
    padding-top: 10px;
    border-top: 1px dashed #e9ecef;
    text-align: center;
}

.remove-btn {
    position: absolute;
    top: -10px;
    right: -10px;
    background: var(--danger-color);
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10; /* Garante que fique acima de outros elementos */
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.error-msg {
    color: var(--danger-color);
    font-size: 0.8rem;
    margin-top: 5px;
    /* display: block; REMOVIDO para evitar conflito com .hidden */
}

/* Loading State */
.loading {
    position: relative;
    opacity: 0.7;
    pointer-events: none;
}

@media (max-width: 360px) {
    .tabs {
        flex-wrap: wrap;
    }
    .tab-btn span {
        font-size: 0.75rem;
    }
}
