* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 20px 0;
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 20px 0;
}

/* Hierarchy Container */
.hierarchy-container {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    margin-bottom: 30px;
    overflow-x: auto;
}

/* Hierarchy Nodes */
.hierarchy-node {
    margin: 20px 0;
    position: relative;
}

.node {
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 10px;
    padding: 15px 20px;
    margin: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    display: inline-block;
    min-width: 200px;
    text-align: center;
}

.node:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.node.expanded::after {
    content: '';
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 20px;
    background: #6c757d;
}

/* Node Types */
.node.dirben {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: white;
    border-color: #c0392b;
}

.node.sr {
    background: linear-gradient(135deg, #4834d4, #686de0);
    color: white;
    border-color: #3742fa;
}

.node.coordenacao {
    background: linear-gradient(135deg, #00d2d3, #01a3a4);
    color: white;
    border-color: #00a085;
}

.node.divisao {
    background: linear-gradient(135deg, #ff9ff3, #f368e0);
    color: white;
    border-color: #e056fd;
}

.node.ceab {
    background: linear-gradient(135deg, #feca57, #ff9ff3);
    color: #2c2c54;
    border-color: #ff6348;
}

.node.gex {
    background: linear-gradient(135deg, #48dbfb, #0abde3);
    color: white;
    border-color: #006ba6;
}

.node.secao {
    background: linear-gradient(135deg, #1dd1a1, #10ac84);
    color: white;
    border-color: #00d2d3;
}

.node.aps {
    background: linear-gradient(135deg, #a55eea, #8854d0);
    color: white;
    border-color: #3742fa;
}

.node.servidor {
    background: linear-gradient(135deg, #fd79a8, #e84393);
    color: white;
    border-color: #d63031;
}

/* Node Content */
.node-title {
    font-weight: bold;
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.node-subtitle {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-bottom: 5px;
}

.node-description {
    font-size: 0.8rem;
    opacity: 0.7;
}

/* Children Container */
.children {
    margin-left: 40px;
    margin-top: 20px;
    padding-left: 20px;
    border-left: 2px solid #dee2e6;
    display: none;
}

.children.expanded {
    display: block;
}

/* Level-specific styling */
.level-1 { margin-left: 0; }
.level-2 { margin-left: 50px; }
.level-3 { margin-left: 100px; }
.level-4 { margin-left: 150px; }
.level-5 { margin-left: 200px; }

/* Controls */
.controls {
    text-align: center;
    margin: 30px 0;
}

.btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 25px;
    cursor: pointer;
    margin: 0 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.btn-primary { background: linear-gradient(135deg, #007bff, #0056b3); }
.btn-secondary { background: linear-gradient(135deg, #6c757d, #495057); }
.btn-info { background: linear-gradient(135deg, #17a2b8, #138496); }

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 15px;
    width: 80%;
    max-width: 600px;
    position: relative;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close:hover {
    color: #000;
}

/* Legend */
.legend-content {
    margin-top: 20px;
}

.legend-item {
    display: flex;
    align-items: center;
    margin: 10px 0;
    padding: 8px;
    border-radius: 5px;
    background: #f8f9fa;
}

.color-box {
    width: 30px;
    height: 20px;
    border-radius: 4px;
    margin-right: 15px;
    border: 1px solid #dee2e6;
}

.color-box.dirben { background: linear-gradient(135deg, #ff6b6b, #ee5a24); }
.color-box.sr { background: linear-gradient(135deg, #4834d4, #686de0); }
.color-box.coordenacao { background: linear-gradient(135deg, #00d2d3, #01a3a4); }
.color-box.divisao { background: linear-gradient(135deg, #ff9ff3, #f368e0); }
.color-box.ceab { background: linear-gradient(135deg, #feca57, #ff9ff3); }
.color-box.gex { background: linear-gradient(135deg, #48dbfb, #0abde3); }
.color-box.secao { background: linear-gradient(135deg, #1dd1a1, #10ac84); }
.color-box.aps { background: linear-gradient(135deg, #a55eea, #8854d0); }

/* Footer */
.footer {
    background: rgba(0,0,0,0.1);
    color: white;
    text-align: center;
    padding: 20px 0;
    margin-top: 50px;
}

/* Responsive */
@media (max-width: 768px) {
    .header h1 {
        font-size: 2rem;
    }
    
    .container {
        padding: 0 10px;
    }
    
    .hierarchy-container {
        padding: 20px;
    }
    
    .node {
        min-width: 150px;
        margin: 5px;
        padding: 10px 15px;
    }
    
    .children {
        margin-left: 20px;
        padding-left: 10px;
    }
    
    .level-2, .level-3, .level-4, .level-5 {
        margin-left: 0;
    }
    
    .btn {
        margin: 5px;
        padding: 10px 20px;
        font-size: 0.9rem;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
        padding: 20px;
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideDown {
    from { 
        opacity: 0;
        transform: translateY(-20px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

.hierarchy-node {
    animation: fadeIn 0.6s ease;
}

.children.expanded {
    animation: slideDown 0.4s ease;
}

/* Conectores visuais */
.connector {
    position: absolute;
    background: #6c757d;
}

.connector-vertical {
    width: 2px;
    height: 30px;
    left: 50%;
    bottom: -30px;
}

.connector-horizontal {
    height: 2px;
    width: 40px;
    top: 50%;
    right: -40px;
}