/**
 * PingPulse Unified Stage Icons CSS
 * Shared styles for stage circles across landing, demo, and dashboard pages.
 *
 * CSS Custom Properties for customization:
 * --pp-stage-accent: Primary accent color (default: #00ff88 neon green)
 * --pp-stage-accent-rgb: RGB values for rgba() usage (default: 0, 255, 136)
 * --pp-node-radius: Border radius for shape (50% = circle, 12px = rounded square)
 * --pp-stage-size: Circle size (default: 60px)
 */

:root {
    --pp-stage-accent: #00ff88;
    --pp-stage-accent-rgb: 0, 255, 136;
    --pp-node-radius: 50%;
    --pp-stage-size: 60px;
}

/* Base Stage Circle - works with both .stage-circle and .step-button .step-circle */
.stage-circle,
.step-button .step-circle {
    width: var(--pp-stage-size);
    height: var(--pp-stage-size);
    border-radius: var(--pp-node-radius);
    border: 3px solid #e5e7eb;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.25rem;
    color: #6b7280;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
}

/* Larger size variant for demo page */
.stage-circle.large,
.step-button.large .step-circle {
    --pp-stage-size: 80px;
    font-size: 1.5rem;
}

/* Smaller size variant */
.stage-circle.small,
.step-button.small .step-circle {
    --pp-stage-size: 48px;
    font-size: 1rem;
}

/* Hover state */
.stage-circle:hover,
.step-button:hover .step-circle {
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(var(--pp-stage-accent-rgb), 0.3);
}

/* Pending state (default) */
.stage-circle.pending,
.step-button.pending .step-circle,
.step-button .step-circle {
    border-color: #e5e7eb;
    background: white;
    color: #9ca3af;
}

/* Active state - currently executing */
.stage-circle.active,
.step-button.active .step-circle {
    background: var(--pp-stage-accent);
    border-color: var(--pp-stage-accent);
    color: #111827;
    box-shadow: 0 0 20px rgba(var(--pp-stage-accent-rgb), 0.5);
    animation: stage-pulse 1.5s ease-in-out infinite;
}

/* Completed state */
.stage-circle.completed,
.step-button.completed .step-circle {
    background: var(--pp-stage-accent);
    border-color: var(--pp-stage-accent);
    color: #111827;
    box-shadow: 0 0 20px rgba(var(--pp-stage-accent-rgb), 0.5);
}

/* Failed/Error state */
.stage-circle.failed,
.stage-circle.error,
.step-button.error .step-circle {
    background: white;
    border-color: #ef4444;
    color: #ef4444;
}

/* Missed stage (out-of-order in strict mode) */
.stage-circle.missed,
.step-button.missed .step-circle {
    background: #fee2e2;
    border-color: #ef4444;
    color: #ef4444;
}

.stage-circle.missed::after,
.step-button.missed .step-circle::after {
    content: '\2715'; /* X mark */
    position: absolute;
    top: -5px;
    right: -5px;
    font-size: 0.875rem;
    color: #ef4444;
    font-weight: bold;
}

/* Error X overlay */
.stage-circle.error::before,
.stage-circle.error::after,
.step-button.error .step-circle::before,
.step-button.error .step-circle::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 60%;
    height: 3px;
    background: #ef4444;
    transform: translate(-50%, -50%) rotate(45deg);
}

.stage-circle.error::after,
.step-button.error .step-circle::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

/* Pinging animation state */
.stage-circle.pinging,
.step-button.pinging .step-circle {
    animation: stage-ping-pulse 0.8s ease-out;
}

.stage-circle.pinging::before,
.stage-circle.pinging::after,
.step-button.pinging .step-circle::before,
.step-button.pinging .step-circle::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    border-radius: var(--pp-node-radius);
    border: 2px solid var(--pp-stage-accent);
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    animation: ping-ring-expand 0.8s ease-out;
    pointer-events: none;
}

.stage-circle.pinging::after,
.step-button.pinging .step-circle::after {
    animation-delay: 0.2s;
}

/* Keyframes */
@keyframes stage-pulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(var(--pp-stage-accent-rgb), 0.3);
    }
    50% {
        box-shadow: 0 0 30px rgba(var(--pp-stage-accent-rgb), 0.6);
    }
}

@keyframes stage-ping-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes ping-ring-expand {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0;
    }
}

/* Ping Label - positioned at 10-11 o'clock */
.ping-label {
    position: absolute;
    top: -45px;
    left: -60px;
    font-size: 0.875rem;
    font-weight: bold;
    color: #111827;
    font-family: 'Space Mono', monospace;
    white-space: nowrap;
    animation: ping-label-bounce 2s ease-out;
    pointer-events: none;
    z-index: 20;
}

@keyframes ping-label-bounce {
    0% {
        opacity: 1;
        transform: translateY(0);
    }
    25% {
        transform: translateY(-5px);
    }
    50% {
        transform: translateY(0);
    }
    75% {
        transform: translateY(-3px);
    }
    100% {
        opacity: 0;
        transform: translateY(-20px);
    }
}

/* Ping Arrow pointing to circle */
.ping-arrow {
    position: absolute;
    top: -35px;
    left: -50px;
    width: 50px;
    height: 50px;
    pointer-events: none;
    z-index: 19;
    animation: ping-arrow-fade 2s ease-out;
}

@keyframes ping-arrow-fade {
    0% { opacity: 1; }
    90% { opacity: 1; }
    100% { opacity: 0; }
}

/* Error Label */
.error-label {
    position: absolute;
    top: -45px;
    left: -60px;
    font-size: 0.875rem;
    font-weight: bold;
    color: #ef4444;
    font-family: 'Space Mono', monospace;
    white-space: nowrap;
    animation: error-shake 2s ease-out;
    pointer-events: none;
    z-index: 20;
}

@keyframes error-shake {
    0%, 100% { transform: translateX(0); opacity: 1; }
    10%, 30%, 50% { transform: translateX(-5px); }
    20%, 40% { transform: translateX(5px); }
    90% { opacity: 1; }
    100% { opacity: 0; }
}

/* Connector lines between stages */
.connector,
.connector-line {
    height: 3px;
    background: #e5e7eb;
    flex: 1;
    margin: 0 10px;
    transition: all 0.5s ease;
    position: relative;
}

.connector.pending,
.connector-line.pending {
    background: #e5e7eb;
}

.connector.completed,
.connector.active,
.connector-line.completed,
.connector-line.active {
    background: var(--pp-stage-accent);
    box-shadow: 0 0 10px rgba(var(--pp-stage-accent-rgb), 0.5);
}
