@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --success-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --warning-gradient: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    --dark-bg: #0f0f23;
    --card-bg: rgba(255, 255, 255, 0.05);
    --card-border: rgba(255, 255, 255, 0.1);
    --text-primary: #ffffff;
    --text-secondary: #a0aec0;
    --accent-purple: #9f7aea;
    --accent-blue: #4299e1;
    --accent-pink: #ed64a6;
    --accent-green: #48bb78;
    --glow-color: rgba(159, 122, 234, 0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--dark-bg);
    color: var(--text-primary);
    overflow-x: hidden;
    min-height: 100vh;
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(102, 126, 234, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(237, 100, 166, 0.1) 0%, transparent 50%);
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 2rem;
    position: relative;
}

/* Header Styles */
.main-header {
    text-align: center;
    margin-bottom: 3rem;
    position: relative;
    z-index: 10;
}

.main-header h1 {
    font-size: 3.5rem;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

/* Coordinator Status */
.coordinator-status {
    display: inline-flex;
    align-items: center;
    gap: 1rem;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 1rem 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.coordinator-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    position: relative;
}

.coordinator-avatar.pulse::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--primary-gradient);
    animation: pulse-ring 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse-ring {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.3);
        opacity: 0;
    }
}

.coordinator-info h3 {
    font-size: 1.2rem;
    margin-bottom: 0.25rem;
}

.status-text {
    color: var(--accent-green);
    font-size: 0.9rem;
    font-weight: 500;
}

/* Workflow Container */
.workflow-container {
    position: relative;
    z-index: 5;
}

/* Phase Sections */
.phase-section {
    margin-bottom: 3rem;
    padding: 2rem;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.phase-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-gradient);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.phase-section:hover::before {
    opacity: 1;
}

.phase-section:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
}

.phase-1 { border-left: 4px solid #667eea; }
.phase-2 { border-left: 4px solid #f093fb; }
.phase-3 { border-left: 4px solid #4facfe; }
.phase-4 { border-left: 4px solid #fa709a; }
.phase-5 { border-left: 4px solid #48bb78; }
.phase-6 { border-left: 4px solid #9f7aea; }

/* Phase Header */
.phase-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.phase-header h2 {
    font-size: 1.8rem;
    font-weight: 600;
}

.phase-badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--primary-gradient);
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Departments */
.department {
    margin-bottom: 2rem;
}

.departments-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
}

.dept-title {
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    color: var(--accent-purple);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dept-title::before {
    content: '';
    width: 4px;
    height: 24px;
    background: var(--primary-gradient);
    border-radius: 2px;
}

/* Agents Grid */
.agents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.5rem;
}

/* Agent Node */
.agent-node {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1.5rem;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
}

.agent-node::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--primary-gradient);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 0;
}

.agent-node:hover::before {
    opacity: 0.1;
}

.agent-node:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 12px 24px rgba(159, 122, 234, 0.3);
    border-color: var(--accent-purple);
}

.agent-node.female {
    border-left: 3px solid var(--accent-pink);
}

.agent-node.male {
    border-left: 3px solid var(--accent-blue);
}

.agent-node.executive {
    background: rgba(102, 126, 234, 0.1);
}

.agent-node.reception {
    background: rgba(72, 187, 120, 0.1);
}

.agent-avatar {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 1rem;
    position: relative;
    z-index: 1;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-8px); }
}

.agent-info {
    text-align: center;
    position: relative;
    z-index: 1;
}

.agent-info h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.agent-info p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Activity Indicator */
.activity-indicator {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 12px;
    height: 12px;
    background: var(--accent-green);
    border-radius: 50%;
    animation: pulse-dot 2s ease-in-out infinite;
    box-shadow: 0 0 12px var(--accent-green);
    z-index: 2;
}

@keyframes pulse-dot {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.3);
        opacity: 0.7;
    }
}

/* Monitoring Status */
.monitoring-status {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.status-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease;
}

.status-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3);
    border-color: var(--accent-purple);
}

.status-card h4 {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-value {
    font-size: 2.5rem;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.status-value.health-good {
    background: var(--success-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.animated-count {
    animation: count-up 2s ease-out;
}

@keyframes count-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Task Flow Container */
.task-flow-container {
    margin-top: 4rem;
    padding: 2rem;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    position: relative;
    z-index: 5;
}

.task-flow-container h3 {
    font-size: 1.8rem;
    margin-bottom: 2rem;
    text-align: center;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.flow-track {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.flow-item {
    flex: 1;
    min-width: 150px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid var(--card-border);
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    position: relative;
    animation: flow-pulse 3s ease-in-out infinite;
    animation-delay: var(--delay);
}

@keyframes flow-pulse {
    0%, 100% {
        box-shadow: 0 0 0 rgba(159, 122, 234, 0);
        border-color: var(--card-border);
    }
    50% {
        box-shadow: 0 0 24px rgba(159, 122, 234, 0.6);
        border-color: var(--accent-purple);
    }
}

.flow-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.5rem;
}

.flow-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.flow-arrow {
    width: 40px;
    height: 2px;
    background: var(--primary-gradient);
    position: relative;
    flex-shrink: 0;
}

.flow-arrow::after {
    content: '';
    position: absolute;
    right: -6px;
    top: -4px;
    width: 0;
    height: 0;
    border-left: 8px solid var(--accent-purple);
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    animation: arrow-move 2s ease-in-out infinite;
}

@keyframes arrow-move {
    0%, 100% {
        transform: translateX(0);
        opacity: 1;
    }
    50% {
        transform: translateX(10px);
        opacity: 0.5;
    }
}

/* Canvas for Connection Lines */
#connectionsCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .agents-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}

@media (max-width: 768px) {
    .main-header h1 {
        font-size: 2.5rem;
    }
    
    .departments-row {
        grid-template-columns: 1fr;
    }
    
    .agents-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 1rem;
    }
    
    .flow-track {
        flex-direction: column;
    }
    
    .flow-arrow {
        width: 2px;
        height: 40px;
        transform: rotate(90deg);
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: var(--dark-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-gradient);
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-gradient);
}

/* Loading Animation */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.loading {
    animation: shimmer 2s infinite;
    background: linear-gradient(
        to right,
        rgba(255, 255, 255, 0.05) 0%,
        rgba(255, 255, 255, 0.1) 50%,
        rgba(255, 255, 255, 0.05) 100%
    );
    background-size: 1000px 100%;
}
