/* ================================
   XHELOS 2: PROCESS FLOW COMPONENT
   Unified Process & Flow Visualizations
   ================================ */

/* #region ===== BASE PROCESS FLOW ===== */

/* Base Container */
.process-flow {
    position: relative;
    padding: var(--space-xl) 0;
}

/* Vertical Layout (default) */
.process-flow--vertical {
    display: flex;
    flex-direction: column;
    gap: var(--space-xl);
}

/* Horizontal Layout */
.process-flow--horizontal {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: var(--space-xl);
    overflow-x: auto;
    padding: var(--space-xl) var(--space-md);
}

/* Circular/Loop Layout */
.process-flow--circular {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-xl);
    position: relative;
    max-width: 600px;
    margin: 0 auto;
}

/* #endregion */

/* #region ===== PROCESS STEP ===== */

/* Base Step */
.process-step {
    display: flex;
    align-items: center;
    position: relative;
    min-height: 80px;
}

/* Step Number/Index */
.process-step__number {
    width: 50px;
    height: 50px;
    background: var(--bg-tertiary);
    border: 2px solid var(--accent-bio);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: var(--accent-bio);
    margin-right: var(--space-lg);
    flex-shrink: 0;
    position: relative;
    box-shadow: 0 4px 8px rgba(74, 222, 128, 0.2);
    z-index: 2;
}

/* Step Content */
.process-step__content {
    flex: 1;
    background: var(--bg-secondary);
    border-left: 3px solid var(--accent-bio);
    padding: var(--space-md);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    transition: all var(--transition-fast);
}


.process-step:hover .process-step__content {
    /*transform: translateX(5px);*/
    box-shadow: var(--shadow-md);
}

/* Step Title */
.process-step__title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
    font-size: 1rem;
}

/* Step Description */
.process-step__desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Step Details (expandable) */
.process-step__details {
    margin-top: var(--space-sm);
    padding-top: var(--space-sm);
    border-top: 1px solid var(--border);
    font-size: 0.85rem;
    color: var(--accent-crystal);
}

/* Step Icon Alternative */
.process-step__icon {
    width: 60px;
    height: 60px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin-right: var(--space-lg);
}

/* #endregion */

/* #region ===== CONNECTORS & ARROWS ===== */

/* Vertical Connector */
.process-flow--vertical .process-step:not(:last-child) .process-step__number::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -40px;
    transform: translateX(-50%);
    width: 0;
    height: 30px;
    border-left: 2px dashed var(--accent-bio);
    opacity: 0.4;
}

/* Arrow Down */
.process-flow--vertical .process-step:not(:last-child) .process-step__number::before {
    content: '▼';
    position: absolute;
    left: 50%;
    bottom: -45px;
    transform: translateX(-50%);
    color: var(--accent-bio);
    font-size: 0.8rem;
    opacity: 0.6;
    animation: flow-down 2s ease-in-out infinite;
}

/* Horizontal Connector */
.process-flow--horizontal .process-step:not(:last-child)::after {
    content: '→';
    position: absolute;
    right: -30px;
    font-size: 1.5rem;
    color: var(--accent-bio);
    opacity: 0.6;
    animation: flow-right 2s ease-in-out infinite;
}

/* Circular Connector */
.process-flow--circular::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    height: 80%;
    border: 2px dashed var(--accent-bio);
    border-radius: 50%;
    opacity: 0.2;
    animation: rotate-slow 20s linear infinite;
}

/* #endregion */

/* #region ===== CYCLE VISUALIZATIONS ===== */

/* AP/Turn Cycle */
.cycle-visual {
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: var(--space-xl);
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    position: relative;
}

.cycle-step {
    text-align: center;
    position: relative;
    flex: 1;
}

.cycle-step__number {
    position: absolute;
    top: -10px;
    right: -10px;
    background: var(--accent-tech);
    color: var(--bg-primary);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
}

.cycle-step__icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: var(--space-sm);
}

.cycle-step__label {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

.cycle-step__desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Cycle Arrow */
.cycle-arrow {
    font-size: 2rem;
    color: var(--accent-tech);
    opacity: 0.6;
    animation: pulse 2s ease-in-out infinite;
}

/* Loop Indicator */
.cycle-indicator {
    position: absolute;
    top: var(--space-md);
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--bg-primary), var(--bg-tertiary));
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius-full);
    border: 2px solid var(--accent-bio);
    font-size: 0.8rem;
    font-weight: bold;
    color: var(--accent-bio);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    box-shadow: 0 4px 12px rgba(74, 222, 128, 0.2);
    z-index: 10;
}

/* #endregion */

/* #region ===== TURN TIMELINE ===== */

.turn-timeline {
    position: relative;
    padding: var(--space-2xl) var(--space-xl) var(--space-xl);
    margin: var(--space-xl) 0;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    overflow: visible;
}

.turn-timeline__container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-xl);
    position: relative;
    max-width: 900px;
    margin: 0 auto;
}

/* Phase Cards for Timeline */
.turn-phase {
    flex: 1;
    background: var(--bg-tertiary);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    position: relative;
    transition: all var(--transition-fast);
    cursor: pointer;
    min-height: 180px;
    display: flex;
    flex-direction: column;
}

.turn-phase:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.turn-phase--1 { border-color: var(--accent-bio); }
.turn-phase--2 { border-color: var(--accent-crystal); }
.turn-phase--3 { border-color: var(--accent-tech); }

.turn-phase__icon {
    font-size: 2.5rem;
    margin-bottom: var(--space-sm);
    align-self: center;
}

.turn-phase__title {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.9rem;
    margin-bottom: var(--space-sm);
    text-align: center;
}

.turn-phase__details {
    font-size: 0.85rem;
    color: var(--text-secondary);
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Loop Arrow for Turn Cycle */
.turn-loop-arrow {
    position: absolute;
    bottom: -16px;
    left: 10%;
    width: 80%;
    height: 80px;
    overflow: visible;
    z-index: 0;
}

.turn-loop-arrow svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

.turn-loop-arrow .arrow-path {
    stroke: var(--accent-bio);
    stroke-width: 2.5;
    fill: none;
    stroke-dasharray: 8, 4;
    animation: dash-loop 15s linear infinite;
    opacity: 0.5;
    filter: drop-shadow(0 2px 4px rgba(74, 222, 128, 0.3));
}

/* #endregion */

/* #region ===== PROCESS VARIANTS ===== */

/* Tech Process */
.process-flow--tech .process-step__number {
    border-color: var(--accent-tech);
    color: var(--accent-tech);
    background: rgba(245, 158, 11, 0.1);
}

.process-flow--tech .process-step__content {
    border-left-color: var(--accent-tech);
}

/* Bio Process */
.process-flow--bio .process-step__number {
    border-color: var(--accent-bio);
    color: var(--accent-bio);
    background: rgba(74, 222, 128, 0.1);
}

/* Psi Process */
.process-flow--psi .process-step__number {
    border-color: var(--accent-psi);
    color: var(--accent-psi);
    background: rgba(167, 139, 250, 0.1);
}

.process-flow--psi .process-step__content {
    border-left-color: var(--accent-psi);
}

/* Crystal Process */
.process-flow--crystal .process-step__number {
    border-color: var(--accent-crystal);
    color: var(--accent-crystal);
    background: rgba(96, 165, 250, 0.1);
}

/* #endregion */

/* #region ===== SPECIAL PROCESS TYPES ===== */

/* Combat Loop (4 steps) */
.combat-loop {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-xl);
    max-width: 600px;
    margin: var(--space-xl) auto;
    position: relative;
}

.combat-loop__step {
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    text-align: center;
    position: relative;
    transition: all var(--transition-fast);
}

.combat-loop__step:hover {
    transform: scale(1.05);
    border-color: var(--accent-bio);
}

.combat-loop__number {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-primary);
    padding: var(--space-xs) var(--space-md);
    border: 2px solid var(--accent-bio);
    border-radius: var(--radius-full);
    font-weight: bold;
    color: var(--accent-bio);
}

.combat-loop__label {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

.combat-loop__desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Central Arrow System */
.combat-loop::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60%;
    height: 60%;
    border: 2px dashed var(--accent-bio);
    border-radius: 50%;
    opacity: 0.3;
    animation: rotate-slow 10s linear infinite;
}

/* #endregion */

/* #region ===== ANIMATIONS ===== */

@keyframes flow-down {
    0%, 100% { 
        opacity: 0.3;
        transform: translateX(-50%) translateY(0);
    }
    50% { 
        opacity: 0.6;
        transform: translateX(-50%) translateY(3px);
    }
}

@keyframes flow-right {
    0%, 100% { 
        opacity: 0.3;
        transform: translateX(0);
    }
    50% { 
        opacity: 0.6;
        transform: translateX(3px);
    }
}

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

@keyframes rotate-slow {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

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

/* #endregion */

/* #region ===== RESPONSIVE ===== */

@media (max-width: 768px) {
    .process-flow--horizontal {
        flex-direction: column;
    }
    
    .turn-timeline__container {
        flex-direction: column;
    }
    
    .combat-loop {
        grid-template-columns: 1fr;
    }
    
    .process-step__number {
        width: 40px;
        height: 40px;
        font-size: 0.9rem;
    }
}

/* #endregion */