/**
 * CBG Organograma - Estilos
 * 
 * @version 1.0.0
 */

/* ==========================================================================
   Container Principal
   ========================================================================== */

.organograma-wrapper {
    display: inline-block;
    min-width: 100%;
    text-align: center;
}

/* ==========================================================================
   Título
   ========================================================================== */

.organograma-title {
    text-align: center;
    margin-bottom: 30px;
}

.organograma-title h2 {
    margin: 0;
    color: #23282d;
    font-size: 24px;
    font-weight: 600;
}

/* ==========================================================================
   Grid
   ========================================================================== */

.organograma-grid {
    display: inline-grid;
    gap: 20px 30px;
    position: relative;
    margin: 0 auto;
}

.org-cell {
    position: relative;
    min-height: 120px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

/* ==========================================================================
   Item / Card
   ========================================================================== */

.org-item {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    width: 160px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: relative;
    z-index: 2;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Item raiz (sem pai) */
.org-item.is-root {
    background: linear-gradient(135deg, #2e7d32 0%, #4caf50 100%);
    color: #fff;
    border: none;
}

.org-item.is-root .org-cargo {
    color: rgba(255,255,255,0.9);
}

/* Item clicável (com currículo) */
.org-item.has-curriculo {
    cursor: pointer;
}

.org-item.has-curriculo:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* ==========================================================================
   Imagem e Placeholder
   ========================================================================== */

.org-item img {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 10px;
    border: 3px solid #4caf50;
}

.org-item.is-root img {
    border-color: rgba(255,255,255,0.5);
}

.org-placeholder {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: #e0e0e0;
    margin: 0 auto 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
}

.org-item.is-root .org-placeholder {
    background: rgba(255,255,255,0.2);
}

/* ==========================================================================
   Nome e Cargo
   ========================================================================== */

.org-nome {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 5px;
    color: #23282d;
}

.org-item.is-root .org-nome {
    color: #fff;
}

.org-cargo {
    font-size: 12px;
    color: #666;
    line-height: 1.3;
}

/* ==========================================================================
   Conectores (nós para as linhas)
   ========================================================================== */

.connector-node {
    width: 14px;
    height: 14px;
    background: #4caf50;
    border-radius: 50%;
    position: absolute;
    bottom: -7px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
}

.connector-node-top {
    width: 14px;
    height: 14px;
    background: #4caf50;
    border-radius: 50%;
    position: absolute;
    top: -7px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
}

/* ==========================================================================
   Linhas SVG
   ========================================================================== */

.org-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.org-line {
    stroke: #4caf50;
    stroke-width: 2;
    fill: none;
}

/* ==========================================================================
   Modal de Currículo
   ========================================================================== */

.curriculo-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.curriculo-modal.active {
    display: flex;
}

.curriculo-modal-content {
    background: #fff;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.curriculo-modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    background: none;
    border: none;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
}

.curriculo-modal-close:hover {
    color: #333;
}

.curriculo-modal-header {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 30px;
    padding-right: 50px;
    border-bottom: 1px solid #eee;
}

.curriculo-modal-header img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.curriculo-modal-header .placeholder-img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    flex-shrink: 0;
}

.curriculo-modal-header h3 {
    margin: 0 0 5px 0;
    font-size: 24px;
    color: #23282d;
}

.curriculo-modal-header .cargo {
    color: #666;
    font-size: 16px;
    margin: 0;
}

.curriculo-modal-body {
    padding: 30px;
    line-height: 1.6;
    color: #444;
}

.curriculo-modal-body h4 {
    margin: 0 0 10px 0;
    color: #23282d;
    font-size: 16px;
}

.curriculo-modal-body p {
    margin: 0 0 20px 0;
}

/* ==========================================================================
   Lista de Organogramas (archive)
   ========================================================================== */

.organogramas-archive {
    display: flex;
    flex-direction: column;
    gap: 60px;
}

/* ==========================================================================
   Erro
   ========================================================================== */

.organograma-error {
    text-align: center;
    color: #666;
    padding: 40px;
    background: #f9f9f9;
    border-radius: 8px;
}

/* ==========================================================================
   Responsivo
   ========================================================================== */

/* Versão Mobile: escondida por padrão */
.organograma-mobile {
    display: none;
}

@media (max-width: 768px) {
    /* Esconde o grid no mobile */
    .organograma-desktop {
        display: none !important;
    }
    
    /* Mostra a lista no mobile */
    .organograma-mobile {
        display: block;
    }
    
    .organograma-container {
        padding: 15px;
    }
    
    /* Estilos da lista mobile */
    .org-list-item {
        background: #fff;
        border: 1px solid #ddd;
        border-radius: 12px;
        padding: 20px;
        margin-bottom: 15px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    } 
    
    
    .org-list-header {
        display: flex;
        align-items: center;
        gap: 15px;
    }
    
    .org-list-header img {
        width: 60px;
        height: 60px;
        border-radius: 50%;
        object-fit: cover;
        flex-shrink: 0;
        border: 3px solid #4caf50;
    }

    
    .org-list-header .org-placeholder {
        width: 60px;
        height: 60px;
        margin: 0;
        flex-shrink: 0;
    }

    
    .org-list-info {
        flex: 1;
    }
    
    .org-list-info .org-nome {
        font-size: 16px;
        font-weight: 600;
        margin-bottom: 3px;
    }
    
    .org-list-info .org-cargo {
        font-size: 14px;
    }
    
    .org-list-curriculo {
        margin-top: 15px;
        padding-top: 15px;
        border-top: 1px solid rgba(0,0,0,0.1);
        font-size: 14px;
        line-height: 1.6;
        color: #444;
    }
    
    
    .org-list-curriculo p {
        margin: 0 0 10px 0;
    }
    
    .org-list-curriculo p:last-child {
        margin-bottom: 0;
    }
    
    .org-list-curriculo a {
        color: #0073aa;
        text-decoration: underline;
    }    
    
    .curriculo-modal-header {
        flex-direction: column;
        text-align: center;
        padding: 20px;
    }
    
    .curriculo-modal-header h3 {
        font-size: 20px;
    }
    
    .curriculo-modal-body {
        padding: 20px;
    }
}

/* ==========================================================================
   Print
   ========================================================================== */

@media print {
    .curriculo-modal {
        display: none !important;
    }
    
    .organograma-container {
        padding: 0;
        background: #fff;
    }
    
    .org-item {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
