/* Custom styles for the organizational chart */

:root {
    --primary-color: #3b82f6;
    --secondary-color: #10b981;
    --accent-color: #8b5cf6;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --dark-color: #1f2937;
    --light-color: #f9fafb;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

/* React Flow customization */
.react-flow__node {
    font-size: 14px;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    transition: all 0.3s ease;
}

.react-flow__node:hover {
    box-shadow: 0 10px 25px -5px rgb(0 0 0 / 0.2);
    transform: translateY(-2px);
}

.react-flow__edge-path {
    stroke-width: 2;
}

.react-flow__handle {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary-color);
    border: 2px solid #fff;
}

/* Custom node styles */
.ceo-node {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    padding: 20px 30px;
    border-radius: 16px;
    border: 3px solid white;
    min-width: 200px;
    text-align: center;
}

.ceo-node .node-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
}

.ceo-node .node-name {
    font-size: 14px;
    opacity: 0.95;
}

.executive-node {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    padding: 16px 24px;
    border-radius: 12px;
    border: 2px solid white;
    min-width: 180px;
}

.department-node {
    background: white;
    padding: 16px 20px;
    border-radius: 12px;
    border: 2px solid var(--primary-color);
    min-width: 160px;
    position: relative;
}

.department-node.expanded {
    background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
    border-color: var(--primary-color);
}

.department-node .node-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.department-node .node-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-color);
    color: white;
    margin-right: 12px;
}

.department-node .node-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--dark-color);
}

.department-node .node-subtitle {
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
}

.department-node .expand-indicator {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--light-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.department-node .expand-indicator:hover {
    background: var(--primary-color);
    color: white;
}

.role-node {
    background: white;
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    min-width: 140px;
    font-size: 13px;
}

.role-node .role-title {
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 4px;
}

.role-node .role-name {
    font-size: 12px;
    color: #6b7280;
}

/* Connection lines styles */
.connection-line {
    stroke: var(--primary-color);
    stroke-width: 2;
    stroke-dasharray: 5, 5;
    animation: dash 20s linear infinite;
}

@keyframes dash {
    to {
        stroke-dashoffset: -100;
    }
}

/* Tooltip styles */
.node-tooltip {
    position: absolute;
    background: var(--dark-color);
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    z-index: 1000;
    pointer-events: none;
    box-shadow: 0 10px 25px -5px rgb(0 0 0 / 0.3);
    max-width: 300px;
}

.node-tooltip::before {
    content: '';
    position: absolute;
    top: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 8px;
    background: var(--dark-color);
    transform: rotate(45deg);
}

/* Detail panel styles */
.detail-panel {
    position: fixed;
    right: -400px;
    top: 0;
    width: 400px;
    height: 100vh;
    background: white;
    box-shadow: -4px 0 20px rgb(0 0 0 / 0.1);
    transition: right 0.3s ease;
    z-index: 100;
    overflow-y: auto;
}

.detail-panel.open {
    right: 0;
}

.detail-panel-header {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    padding: 24px;
}

.detail-panel-content {
    padding: 24px;
}

/* Stats cards */
.stats-card {
    background: white;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 8px rgb(0 0 0 / 0.08);
    transition: all 0.3s ease;
}

.stats-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgb(0 0 0 / 0.12);
}

/* Loading animation */
.loading-spinner {
    border: 3px solid var(--light-color);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .detail-panel {
        width: 100%;
        right: -100%;
    }
    
    .ceo-node {
        padding: 16px 20px;
        min-width: 160px;
    }
    
    .department-node {
        min-width: 140px;
        padding: 12px 16px;
    }
}