/* Estilos para o formulário de administração de pessoas */

body {
    background-color: #f8f9fa;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.coordenai-logo {
    height: 48px;
    width: auto;
}

/* ===== CARD HEADER (gradiente) ===== */
.pessoa-form-header {
    min-height: 110px;
}

.pessoa-form-avatar {
    align-items: center;
    justify-content: center;
    opacity: 0.8;
}

/* Rótulo dos campos no header */
.pessoa-header-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
    letter-spacing: 0.02em;
}

/* Inputs e selects dentro do header */
.pessoa-header-input {
    background-color: rgba(255, 255, 255, 0.18) !important;
    border: 1px solid rgba(255, 255, 255, 0.45) !important;
    border-radius: 0.5rem;
    color: #fff !important;
    transition: background-color 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.pessoa-header-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
    font-style: italic;
}

.pessoa-header-input:focus {
    background-color: rgba(255, 255, 255, 0.26) !important;
    border-color: rgba(255, 255, 255, 0.75) !important;
    box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.2) !important;
    color: #fff !important;
    outline: none;
}

.pessoa-header-input.is-invalid {
    border-color: rgba(255, 193, 7, 0.9) !important;
}

/* Seta branca para o select no header */
select.pessoa-header-input {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: right 0.75rem center !important;
    background-size: 16px 12px !important;
    padding-right: 2.25rem;
}

/* Resetar texto das opções para padrão do sistema —
   color: #fff do select cascateia para option e tornaria o texto invisível */
select.pessoa-header-input option {
    color: #212529;
    background-color: #fff;
}


/* Autocomplete: preservar tema escuro */
.pessoa-header-input:-webkit-autofill,
.pessoa-header-input:-webkit-autofill:hover,
.pessoa-header-input:-webkit-autofill:focus {
    -webkit-text-fill-color: #fff;
    -webkit-box-shadow: 0 0 0 1000px rgba(13, 110, 253, 0.55) inset;
    transition: background-color 5000s ease-in-out 0s;
}

/* ===== ABAS (mesmo padrão do perfil) ===== */
.pessoa-form-tabs {
    border-bottom: 2px solid #e9ecef;
    gap: 0.25rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.pessoa-form-tabs::-webkit-scrollbar {
    display: none;
}

.pessoa-form-tabs .nav-link {
    font-size: 0.85rem;
    font-weight: 500;
    color: #6c757d;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 0.6rem 1rem;
    margin-bottom: -2px;
    white-space: nowrap;
    transition: color 0.2s, border-color 0.2s;
    border-radius: 0;
    background: transparent;
}

.pessoa-form-tabs .nav-link:hover {
    color: #495057;
    border-bottom-color: #dee2e6;
}

.pessoa-form-tabs .nav-link.active {
    color: var(--bs-primary);
    border-bottom-color: var(--bs-primary);
    background: transparent;
}

.pessoa-form-tabs .nav-link i {
    opacity: 0.65;
}

.pessoa-form-tabs .nav-link.active i {
    opacity: 1;
}

/* Badge de erro na aba */
.tab-error-badge {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #dc3545;
    border-radius: 50%;
    position: absolute;
    top: 4px;
    right: 4px;
    pointer-events: none;
}

/* ===== FORMULÁRIOS DENTRO DAS ABAS ===== */
.required {
    color: #dc3545;
}

.form-label {
    font-weight: 600;
    color: #495057;
}

.form-control.bg-light,
.form-select.bg-light {
    border-radius: 0.5rem;
    transition: box-shadow 0.2s;
}

.form-control.bg-light:focus,
.form-select.bg-light:focus {
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
    background-color: #f8f9fa !important;
}

/* ===== ACESSIBILIDADE ===== */
.form-check-input:focus {
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.btn:focus {
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* ===== CATEGORIAS INCOMPATÍVEIS ===== */
.categoria-disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* ===== TABELAS ===== */
.table-responsive {
    border-radius: 8px;
    overflow: hidden;
}

.table th {
    border-top: none;
    font-weight: 600;
}

/* ===== ESTADO DE CARREGAMENTO ===== */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== PAINEL COLAPSÍVEL DE CURSO ===== */
#btnTogglePanelCurso {
    transition: all 0.25s ease-in-out;
    font-weight: 500;
}

#btnTogglePanelCurso:not(.collapsed) {
    background-color: #0d6efd;
    border-color: #0d6efd;
    color: white;
}

#btnTogglePanelCurso i {
    display: inline-block;
    transition: transform 0.3s ease-in-out;
}

#btnTogglePanelCurso:not(.collapsed) i {
    transform: rotate(180deg);
}

/* ===== DROPDOWN DE BUSCA ===== */
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    max-height: 250px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.search-result-item {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    transition: background-color 0.15s ease;
}

.search-result-item:hover {
    background-color: #f8f9fa;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item strong {
    display: block;
    margin-bottom: 2px;
}

.search-result-item small {
    white-space: normal;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* ===== ÁRVORE DE VÍNCULOS (aba Curso/Vínculo) ===== */
.curso-arvore-container {
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    max-height: 220px;
    overflow-y: auto;
    background: #fff;
    padding: 0.5rem;
}

.curso-arvore { list-style: none; padding-left: 0; margin: 0; }
.curso-arvore ul { list-style: none; padding-left: 1.2rem; margin: 0; border-left: 2px solid #dee2e6; margin-left: 0.35rem; }
.curso-arvore li { padding: 0.2rem 0; }

.curso-arvore-node {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.4rem;
    border-radius: 0.35rem;
    cursor: default;
    font-size: 0.875rem;
}

.curso-arvore-node.selecionavel {
    cursor: pointer;
    transition: background-color 0.15s;
}

.curso-arvore-node.selecionavel:hover {
    background-color: #e8f0fe;
}

.curso-arvore-node.selecionavel:active {
    background-color: #0d6efd;
    color: #fff;
}

.curso-arvore-node.selecionavel:active .badge {
    background-color: rgba(255,255,255,0.25) !important;
    color: #fff !important;
}

.curso-arvore-node.selecionado {
    background-color: #0d6efd;
    color: #fff;
}

.curso-arvore-node.selecionado .badge {
    background-color: rgba(255,255,255,0.25) !important;
    color: #fff !important;
}

.curso-arvore-root {
    font-weight: 600;
    color: #495057;
}

/* ===== TOGGLE COLLAPSE/EXPAND DA ÁRVORE ===== */
.tree-toggle-btn {
    cursor: pointer;
    width: 1.1rem;
    height: 1.1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    flex-shrink: 0;
    user-select: none;
}
.tree-toggle-btn:hover { color: #0d6efd; }
.tree-toggle-btn > i { transition: transform 0.15s ease; }
.tree-toggle-placeholder { display: inline-block; width: 1.1rem; flex-shrink: 0; }

.curso-arvore li.tree-collapsed > ul,
.vinculo-tree  li.tree-collapsed > ul { display: none; }

.curso-arvore li.tree-collapsed > div > .tree-toggle-btn > i,
.vinculo-tree  li.tree-collapsed > div > .tree-toggle-btn > i { transform: rotate(-90deg); }

.curso-arvore li.tree-hidden,
.vinculo-tree  li.tree-hidden { display: none; }

/* ===== RESPONSIVIDADE ===== */
@media (max-width: 575.98px) {
    .pessoa-form-tabs .nav-link {
        font-size: 0.78rem;
        padding: 0.5rem 0.65rem;
    }

    .pessoa-form-tabs .nav-link .tab-label {
        display: none;
    }

    .tab-content {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
}

@media (max-width: 767.98px) {
    .pessoa-form-header {
        padding: 1.25rem !important;
    }

    .card-footer .btn {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}
