/* Organization Tree Styles */
.organization-tree-container {
    display: flex;
    gap: 20px;
    height: 600px;
}

.organization-tree-panel {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 20px;
    margin-bottom: 20px;
    flex: 1;
    overflow: auto;
}

.org-details-panel {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 20px;
    width: 350px;
    overflow-y: auto;
}

.org-details-panel h5 {
    margin-bottom: 15px;
    color: #333;
}

.org-details-panel .details-content {
    color: #666;
}

.org-details-panel .details-content p {
    margin: 8px 0;
}

.org-tree-controls {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.control-buttons {
    display: flex;
    align-items: center;
    gap: 10px;
}

.control-buttons .btn {
    font-size: 0.875rem;
}

.search-box {
    flex: 1;
    max-width: 300px;
}

.org-stats {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.org-stats .badge {
    font-size: 0.85rem;
    padding: 5px 10px;
}

/* Tree Content */
.org-tree-content {
    max-height: 600px;
    overflow-y: auto;
    overflow-x: auto;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 15px;
    background: #fafafa;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 20px;
}

/* Tree Structure */
.org-tree {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 14px;
}

.org-subtree {
    list-style: none;
    padding-left: 25px;
    margin: 5px 0 0 0;
}

.org-node {
    margin: 3px 0;
}

.node-content {
    display: flex;
    align-items: center;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
    border: 1px solid #e0e0e0;
}

.node-content:hover {
    background: #f0f7ff;
    border-color: #3498db;
}

.org-node.selected .node-content {
    background: #e3f2fd;
    border-color: #2196f3;
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.2);
}

.org-node.inactive .node-content {
    opacity: 0.6;
}

.org-node.search-match .node-content {
    background: #fff3cd;
    border-color: #ffc107;
}

/* Expand/Collapse Button */
.expand-btn {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 5px;
    color: #666;
    transition: transform 0.2s ease;
}

.expand-btn:hover {
    color: #333;
}

.expand-btn.expanded i {
    transform: rotate(0deg);
}

.expand-placeholder {
    width: 20px;
    margin-right: 5px;
}

/* Node Icons */
.node-icon {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
    border-radius: 4px;
    background: #f0f0f0;
    color: #666;
}

.node-icon i {
    font-size: 12px;
}

/* Node Content */
.node-name {
    flex: 1;
    font-weight: 500;
    color: #333;
}

.node-email {
    font-size: 12px;
    color: #666;
    margin-left: 10px;
}

/* Badges */
.role-badge,
.status-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 12px;
    color: white;
    margin-left: 8px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Details Panel */
.org-details-panel {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 20px;
    position: sticky;
    top: 20px;
}

.org-details-panel h5 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 10px;
}

.details-content p {
    margin: 8px 0;
    font-size: 14px;
}

.details-content strong {
    color: #555;
    margin-right: 5px;
}

.org-details-panel button {
    margin-top: 10px;
}

/* Action buttons */
.node-actions {
    display: none;
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
}

.node-content {
    position: relative;
}

.node-content:hover .node-actions {
    display: inline-block;
}

.action-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    margin: 0 2px;
    font-size: 14px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.action-btn:hover {
    opacity: 1;
}

.edit-btn {
    color: #3498db;
}

.delete-btn {
    color: #e74c3c;
}

/* Modal enhancements */
.modal {
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-dialog {
    margin-top: 100px;
}

/* Export dropdown */
.dropdown-menu {
    min-width: 180px;
}

.dropdown-item i {
    margin-right: 8px;
    width: 16px;
    display: inline-block;
}

/* Add node button */
.btn-outline-warning {
    color: #f39c12;
    border-color: #f39c12;
}

.btn-outline-warning:hover {
    background-color: #f39c12;
    color: white;
}

/* Error and No Data States */
.no-data,
.error-message {
    text-align: center;
    padding: 40px;
    color: #666;
    font-style: italic;
}

.error-message {
    color: #e74c3c;
}

/* Node Type Specific Colors */
.org-node[data-node-id^="company-"] .node-icon {
    background: #34495e;
    color: white;
}

.org-node[data-node-id^="section-"] .node-icon {
    background: #16a085;
    color: white;
}

.org-node[data-node-id^="team-"] .node-icon {
    background: #f39c12;
    color: white;
}

.org-node[data-node-id^="user-"] .node-icon {
    background: #3498db;
    color: white;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .org-tree-container {
        max-height: 400px;
    }
    
    .control-buttons {
        flex-wrap: wrap;
    }
    
    .search-box {
        width: 100%;
        max-width: none;
        margin-top: 10px;
    }
    
    .node-email {
        display: none;
    }
    
    .org-subtree {
        padding-left: 15px;
    }
}

/* Animation for tree expansion */
.org-subtree {
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Drag and Drop Styles */
.org-node[data-node-id^="user-"] .node-content {
    cursor: move;
}

.org-node.dragging {
    opacity: 0.5;
}

.org-node.drop-target .node-content {
    border: 2px dashed #3498db;
    background-color: #e3f2fd;
}

.org-node.drag-over .node-content {
    border: 2px solid #2196f3;
    background-color: #bbdefb;
    box-shadow: 0 0 10px rgba(33, 150, 243, 0.5);
}

/* Move indicator */
.move-indicator {
    display: inline-block;
    margin-left: 5px;
    font-size: 12px;
    color: #666;
    cursor: move;
}

/* Section highlight during drag */
.org-node[data-node-id^="section-"].drop-target .node-content,
.org-node[data-node-id^="company-"].drop-target .node-content {
    transition: all 0.2s ease;
}

/* Print Styles */
@media print {
    .org-tree-controls {
        display: none;
    }
    
    .org-details-panel {
        display: none;
    }
    
    .org-tree-container {
        max-height: none;
        border: none;
        padding: 0;
    }
    
    .node-content {
        border: 1px solid #ddd;
        background: white !important;
    }
}