/* ==========================================================================
   ORGANOGRAMA CLÁSSICO - ESTILO ARQUIVO HISTÓRICO
   ========================================================================== */

.organograma-container {
    background-color: #fbf9f6;
    border: 1px solid #e8e3da;
    border-radius: 8px;
    padding: 40px;
    width: 100%;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Linhas Gerais de Organograma */
.organograma-row {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

/* --- CARDS DE SÓCIOS / FAMILIARES (NODES) --- */
.org-node {
    background: #ffffff;
    border: 1px solid #dcd7cd;
    border-left: 5px solid #ccc;
    border-radius: 4px;
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex; /* Mantemos flex */
    flex-direction: column; /* O padrão é coluna (para os outros familiares) */
    width: 220px;
    box-sizing: border-box;
}

.org-node:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.06) !important;
}

.org-role {
    font-size: 0.65rem;
    text-transform: uppercase;
    font-weight: bold;
    color: #888277;
    margin-bottom: 2px;
}

.org-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: #2b2823;
    line-height: 1.2;
}

.org-desc {
    font-size: 0.65rem;
    color: #a09a8f;
    font-style: italic;
    margin-top: 4px;
    border-top: 1px solid #f0ece6;
    padding-top: 2px;
}

/* --- CORES DE BORDA (LEGENDA DO CLIENTE) --- */
.org-node.node-blue {
    border-left-color: #1a3c5e !important;
}

.org-node.node-pink {
    border-left-color: #ab4442 !important;
}

.org-node.node-green {
    border-left-color: #14881a !important;
}

/* Sócio Principal (Highlight Gold / Estilo Caderno Ouro) */
.org-node.node-gold {
    width: 350px !important; /* Aumentamos um pouco para caber a foto */
    flex-direction: row !important; /* FORÇA A LINHA AQUI */
    align-items: center !important;
    gap: 15px;
    background-color: #fffbef !important;
    border: 2px solid #d4af37 !important;
    border-left: 5px solid #d4af37 !important;
}

.org-node.node-gold .org-role {
    color: #b67a0b;
}

.org-node.node-gold .org-name {
    color: #8a5e00;
}

.org-node.node-gold .node-text-side {
    display: flex;
    flex-direction: column;
    flex: 1;
}


/* --- NÍVEL 1: BRACKET DO PAI PARA AS MULHERES --- */
.row-antepassados {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0px;
}

.col-pai {
    padding-right: 30px;
}

.col-maes-bracket {
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: relative;
    border-left: 2px solid #dcd7cd;
    /* Linha vertical do casamento */
    padding-left: 40px;
}

.org-marriage-branch {
    display: flex;
    align-items: center;
    position: relative;
}

/* Linha Horizontal de Ligação */
.org-connector-line {
    width: 40px;
    height: 2px;
    background-color: #dcd7cd;
    position: absolute;
    left: -40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.org-marriage-date {
    font-size: 0.63rem;
    background: #ffffff;
    border: 1px solid #dcd7cd;
    border-radius: 12px;
    padding: 1px 6px;
    color: #666;
    position: absolute;
    white-space: nowrap;
    z-index: 5;
}

/* --- DIVISÓRIA CENTRAL (BADGE ESCURA) --- */
.organograma-separator {
    text-align: center;
    position: relative;
    margin: 40px 0;
}

.organograma-separator::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: #edf0f4;
    z-index: 1;
}

.org-badge {
    background: #1a3c5e;
    color: #ffffff;
    padding: 6px 20px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
    position: relative;
    z-index: 2;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

/* --- NÍVEL 2: GRELHA DE IRMÃOS --- */
.org-siblings-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
}

/* Linha Vertical de ligação entre as secções */
.org-vertical-divider {
    width: 2px;
    height: 35px;
    background-color: #dcd7cd;
    margin: 0 auto;
}

/* --- NÍVEL 3: SÓCIO PRINCIPAL E MULHERES --- */
.row-socio-conjuges {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0px;
}

.col-socio {
    padding-right: 30px;
}

.col-conjuges-bracket {
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: relative;
    border-left: 2px solid #dcd7cd;
    padding-left: 40px;
}

/* --- NÍVEL 4: GRELHA HORIZONTAL DE FILHOS --- */
.org-children-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
}

/* --- LEGENDA INSTITUCIONAL --- */
.organograma-legenda {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
    border-top: 1px solid #edf0f4;
    padding-top: 20px;
}

.legenda-item {
    font-size: 0.68rem;
    color: #7a7469;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: bold;
}

.legenda-cor {
    width: 15px;
    height: 8px;
    border-radius: 2px;
    display: inline-block;
}

.cor-azul {
    background-color: #1a3c5e;
}

.cor-ouro {
    background-color: #d4af37;
}

.cor-rosa {
    background-color: #ab4442;
}

.cor-verde {
    background-color: #14881a;
}

/* --- RESPONSIVIDADE COMPLETA --- */
@media (max-width: 991px) {
    .org-siblings-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .organograma-container {
        padding: 20px 10px;
    }

    .row-antepassados,
    .row-socio-conjuges {
        flex-direction: column;
        gap: 20px;
    }

    .col-pai,
    .col-socio {
        padding-right: 0;
    }

    .col-maes-bracket,
    .col-conjuges-bracket {
        border-left: none;
        padding-left: 0;
    }

    .org-connector-line {
        display: none;
    }

    .org-siblings-grid {
        grid-template-columns: 1fr;
    }

    .org-node {
        width: 100%;
    }
}

/* --- METADADOS (DATAS E LOCAIS NO RODAPÉ DO CARD) --- */
.org-node {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    /* Empurra o rodapé para o fundo do cartão */
}

.node-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.65rem;
    color: #888;
    margin-top: 10px;
    border-top: 1px solid #eee;
    padding-top: 6px;
    width: 100%;
}

.meta-left {
    text-align: left;
    display: flex;
    align-items: center;
    gap: 4px;
}

.meta-right {
    text-align: right;
    font-style: italic;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Ícones dos Metadados (Calendário e Pin) */
.node-meta i {
    color: #999;
    font-size: 0.7rem;
}

.org-node {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.node-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto; /* Empurra para o fundo do node */
    padding-top: 8px;
    border-top: 1px solid rgba(0,0,0,0.05);
    font-size: 0.65rem;
}

.meta-left, .meta-right {
    display: flex;
    align-items: center;
    gap: 4px;
}

.node-text-side.no-image {
    text-align: center !important;
    align-items: center;
}


/* Garante que o container interno (.node-flex-content) ocupa o resto do espaço */
.node-flex-content {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    gap: 15px;
    width: 100%;
}

/* Estilo da Foto */
.node-image-side {
    flex: 0 0 60px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.node-image-side img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* O conteúdo de texto que fica à direita */
.node-text-side {
    flex: 1;
    display: flex;
    flex-direction: column;
}
