/* AI Assessment Loading Overlay */
.ai-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.ai-loading-overlay.visible {
    opacity: 1;
}

.ai-loading-content {
    text-align: center;
    color: white;
    max-width: 700px;
    width: 90%;
    padding: 3rem;
}

.ai-loading-content h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 2rem 0 1rem 0;
    color: white;
}

.ai-loading-content p {
    font-size: 1.125rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 2rem;
}

/* Beautiful Spinner */
.ai-spinner {
    width: 80px;
    height: 80px;
    margin: 0 auto;
    margin-right: 300px; /* Shift spinner left for visual centering */
    position: relative;
    left: 0;
    right: 0;
}

.ai-spinner::before,
.ai-spinner::after {
    content: '';
    position: absolute;
    border-radius: 50%;
}

.ai-spinner::before {
    width: 80px;
    height: 80px;
    border: 4px solid transparent;
    border-top-color: #4caf50;
    border-right-color: #2196f3;
    border-bottom-color: #ff9800;
    border-left-color: #f44336;
    animation: spin 1.5s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
}

.ai-spinner::after {
    width: 60px;
    height: 60px;
    top: 10px;
    left: 10px;
    border: 4px solid transparent;
    border-top-color: #9c27b0;
    border-right-color: #e91e63;
    animation: spin 2s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite reverse;
}

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

/* Loading Stats */
.loading-stats {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 2rem;
}

.loading-status-item {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.9);
    padding: 0.75rem 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: fadeInUp 0.5s ease forwards;
    transition: opacity 0.6s ease;
}

.loading-status-item:nth-child(1) {
    animation-delay: 0.2s;
}

.loading-status-item:nth-child(2) {
    animation-delay: 0.4s;
}

.loading-status-item:nth-child(3) {
    animation-delay: 0.6s;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Pulse effect */
.ai-loading-content h2 {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Multi-Agent Progress Indicators */
.agent-progress {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: auto auto;
    gap: 1rem;
    row-gap: 4rem;
    margin-top: 2rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

/* Connection lines as separate DOM elements */
.connection-line {
    position: absolute;
    background: rgba(158, 158, 158, 0.4);
    border-radius: 2px;
    opacity: 0.2;
    transition: all 0.5s ease;
    pointer-events: none;
}

.connection-line.active {
    background: linear-gradient(to bottom, 
        #4caf50,
        #2196f3,
        #ff9800,
        #f44336,
        #9c27b0,
        #e91e63
    );
    background-size: 100% 400%;
    opacity: 0.8;
    box-shadow: 0 0 15px rgba(66, 165, 245, 0.5);
    animation: lineRainbow 3s linear infinite;
}

.connection-line.complete {
    background: rgba(76, 175, 80, 0.6);
    opacity: 0.8;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.3);
    animation: linePulse 2s ease-in-out infinite;
}

@keyframes lineRainbow {
    0% {
        background-position: 0% 0%;
    }
    100% {
        background-position: 0% 100%;
    }
}

@keyframes linePulse {
    0%, 100% {
        opacity: 0.8;
        box-shadow: 0 0 10px rgba(76, 175, 80, 0.3);
    }
    50% {
        opacity: 1;
        box-shadow: 0 0 20px rgba(76, 175, 80, 0.5);
    }
}

/* Simple vertical connection lines - one under each examiner */
#line-e1-v {
    top: 44%;
    left: 16.66%;
    transform: translateX(-50%);
    width: 3px;
    height: 3rem;
    background: linear-gradient(to bottom, #64b5f6, transparent);
}

/* Hide unused lines */
#line-e1-h,
#line-e1-drop {
    display: none;
}

/* Examiner 2 connection - simple vertical line */
#line-e2 {
    top: 44%;
    left: 50%;
    transform: translateX(-50%);
    width: 3px;
    height: 3rem;
    background: linear-gradient(to bottom, #64b5f6, transparent);
}

/* Examiner 3 connection - simple vertical line */
#line-e3-v {
    top: 44%;
    left: 83.33%;
    transform: translateX(-50%);
    width: 3px;
    height: 3rem;
    background: linear-gradient(to bottom, #64b5f6, transparent);
}

/* Hide unused lines */
#line-e3-h,
#line-e3-drop {
    display: none;
}

/* Agent Indicator Boxes */
.agent-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.5rem 1rem;
    border-radius: 8px;
    background: rgba(158, 158, 158, 0.15);
    border: 2px solid rgba(158, 158, 158, 0.3);
    transition: all 0.5s ease;
    opacity: 0.6;
    min-width: 120px;
    position: relative;
}
.agent-indicator .material-symbols-outlined {
    font-size: 2rem;
    color: #9e9e9e;
    transition: all 0.5s ease;
}

.agent-indicator .agent-name {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #9e9e9e;
    transition: all 0.5s ease;
}

.agent-indicator .agent-status {
    font-size: 0.7rem;
    font-weight: 500;
    color: #9e9e9e;
    min-height: 1rem;
    transition: all 0.5s ease;
}

/* Active state - examiner is working */
.agent-indicator.active {
    opacity: 1;
    background: rgba(66, 165, 245, 0.2);
    border-color: #42a5f5;
    animation: agentPulse 2s ease-in-out infinite;
}

.agent-indicator.active .material-symbols-outlined {
    color: #42a5f5;
    animation: iconBounce 1s ease-in-out infinite;
}

.agent-indicator.active .agent-name {
    color: #42a5f5;
}

.agent-indicator.active .agent-status {
    color: #42a5f5;
}

/* Complete state - examiner finished */
.agent-indicator.complete {
    opacity: 1;
    background: rgba(76, 175, 80, 0.2);
    border-color: #4caf50;
    animation: none;
}

.agent-indicator.complete .material-symbols-outlined {
    color: #4caf50;
    animation: none;
}

.agent-indicator.complete .agent-name {
    color: #4caf50;
}

.agent-indicator.complete .agent-status {
    color: #4caf50;
}

/* Retry state - examiner retrying */
.agent-indicator.retry {
    opacity: 1;
    background: rgba(255, 152, 0, 0.2);
    border-color: #ff9800;
    animation: retryPulse 1.5s ease-in-out infinite;
}

.agent-indicator.retry .material-symbols-outlined {
    color: #ff9800;
    animation: thinkingSpin 2s linear infinite;
}

.agent-indicator.retry .agent-name {
    color: #ff9800;
}

.agent-indicator.retry .agent-status {
    color: #ff9800;
}

/* Thinking state - examiner processing */
.agent-indicator.thinking {
    opacity: 1;
    background: rgba(156, 39, 176, 0.2);
    border-color: #9c27b0;
    animation: thinkingPulse 1.8s ease-in-out infinite;
}

.agent-indicator.thinking .material-symbols-outlined {
    color: #9c27b0;
    animation: thinkingSpin 2s linear infinite;
}

.agent-indicator.thinking .agent-name {
    color: #9c27b0;
}

.agent-indicator.thinking .agent-status {
    color: #9c27b0;
}

/* Waiting state - examiner waiting */
.agent-indicator.waiting {
    opacity: 0.6;
    background: rgba(158, 158, 158, 0.2);
    border-color: #9e9e9e;
    animation: waitingPulse 3s ease-in-out infinite;
}

.agent-indicator.waiting .material-symbols-outlined {
    color: #9e9e9e;
    animation: iconBounce 2s ease-in-out infinite;
}

.agent-indicator.waiting .agent-name {
    color: #9e9e9e;
}

.agent-indicator.waiting .agent-status {
    color: #9e9e9e;
}

/* Moderator styling */
#moderator {
    grid-column: 1 / -1;
    max-width: 100%;
    width: 100%;
    margin: 0;
    padding: 1.25rem 1rem;
    position: relative;
    overflow: hidden;
}

/* Rainbow gradient border animation for moderator */
#moderator.active {
    background: rgba(0, 0, 0, 0.3);
    border: 3px solid transparent;
    background-clip: padding-box;
    animation: moderatorGlow 3s ease-in-out infinite;
    opacity: 0.5;
}

#moderator.active::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    background: linear-gradient(
        45deg,
        #4caf50,
        #2196f3,
        #ff9800,
        #f44336,
        #9c27b0,
        #e91e63,
        #4caf50
    );
    background-size: 400% 400%;
    border-radius: 8px;
    z-index: -1;
    animation: rainbowBorder 3s linear infinite;
}

#moderator.active .material-symbols-outlined {
    color: #fff;
    animation: rainbowIcon 3s linear infinite;
}

#moderator.active .agent-name {
    color: #fff;
    font-weight: 700;
}

#moderator.active .agent-status {
    color: rgba(255, 255, 255, 0.9);
}

#moderator.complete {
    background: rgba(76, 175, 80, 0.2);
    border-color: #4caf50;
    animation: none;
}

#moderator.complete::before {
    display: none;
}

#moderator.complete .material-symbols-outlined {
    color: #4caf50;
    animation: none;
}

#moderator.complete .agent-name {
    color: #4caf50;
}

#moderator.complete .agent-status {
    color: #4caf50;
}

@keyframes rainbowBorder {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

@keyframes rainbowIcon {
    0% {
        filter: drop-shadow(0 0 8px #4caf50);
    }
    14% {
        filter: drop-shadow(0 0 8px #2196f3);
    }
    28% {
        filter: drop-shadow(0 0 8px #ff9800);
    }
    42% {
        filter: drop-shadow(0 0 8px #f44336);
    }
    57% {
        filter: drop-shadow(0 0 8px #9c27b0);
    }
    71% {
        filter: drop-shadow(0 0 8px #e91e63);
    }
    85% {
        filter: drop-shadow(0 0 8px #4caf50);
    }
    100% {
        filter: drop-shadow(0 0 8px #4caf50);
    }
}

@keyframes moderatorGlow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(76, 175, 80, 0.3);
    }
    16% {
        box-shadow: 0 0 20px rgba(33, 150, 243, 0.3);
    }
    33% {
        box-shadow: 0 0 20px rgba(255, 152, 0, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(244, 67, 54, 0.3);
    }
    66% {
        box-shadow: 0 0 20px rgba(156, 39, 176, 0.3);
    }
    83% {
        box-shadow: 0 0 20px rgba(233, 30, 99, 0.3);
    }
}

@keyframes agentPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(66, 165, 245, 0.7);
    }
    50% {
        box-shadow: 0 0 20px 5px rgba(66, 165, 245, 0);
    }
}

@keyframes iconBounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

@keyframes retryPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(255, 152, 0, 0.7);
    }
    50% {
        box-shadow: 0 0 20px 5px rgba(255, 152, 0, 0);
    }
}

@keyframes thinkingPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(156, 39, 176, 0.7);
    }
    50% {
        box-shadow: 0 0 20px 5px rgba(156, 39, 176, 0);
    }
}

@keyframes waitingPulse {
    0%, 100% {
        opacity: 0.4;
    }
    50% {
        opacity: 0.7;
    }
}

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