/* ========================================
   HOW IT WORKS PAGE - FLOW CHART & BLUEPRINT
   Extends styles.css design system
   ======================================== */

/* ----------------------------------------
   FLOW CHART COMPONENT
   ---------------------------------------- */

.flow-chart {
    display: grid;
    grid-template-columns: 1fr 60px 1.4fr 60px 1fr;
    gap: 0;
    align-items: stretch;
    min-height: 650px;
    position: relative;
    margin-top: var(--space-md);
}

/* Column Containers */
.flow-column {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    padding: var(--space-sm);
}

.flow-column__title {
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--color-highlight);
    text-align: center;
    margin-bottom: var(--space-sm);
    text-shadow: 0 0 20px rgba(74, 158, 255, 0.5);
}

/* Input Nodes (Left Side) */
.flow-column--inputs {
    justify-content: center;
}

.flow-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-md);
    background: linear-gradient(135deg, rgba(15, 36, 64, 0.95) 0%, rgba(20, 45, 80, 0.95) 100%);
    border: 1px solid var(--color-divider);
    border-radius: 12px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.flow-node:hover {
    border-color: var(--color-highlight);
    box-shadow: 0 8px 30px rgba(74, 158, 255, 0.2);
    transform: translateY(-4px);
}

.flow-node__icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, rgba(74, 158, 255, 0.2) 0%, rgba(0, 212, 255, 0.15) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 0 0 20px rgba(74, 158, 255, 0.2);
}

.flow-node__icon svg {
    width: 28px;
    height: 28px;
    stroke: var(--color-highlight);
    stroke-width: 1.5;
    fill: none;
    filter: drop-shadow(0 0 4px rgba(74, 158, 255, 0.5));
}

.flow-node__icon--filled svg {
    fill: var(--color-highlight);
    stroke: none;
}

/* Different colors for input nodes */
.flow-node:nth-child(2) .flow-node__icon {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.2) 0%, rgba(192, 132, 252, 0.15) 100%);
    box-shadow: 0 0 20px rgba(168, 85, 247, 0.2);
}

.flow-node:nth-child(2) .flow-node__icon svg {
    stroke: #a855f7;
    filter: drop-shadow(0 0 4px rgba(168, 85, 247, 0.5));
}

.flow-node:nth-child(3) .flow-node__icon {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2) 0%, rgba(52, 211, 153, 0.15) 100%);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.2);
}

.flow-node:nth-child(3) .flow-node__icon svg {
    stroke: #10b981;
    filter: drop-shadow(0 0 4px rgba(16, 185, 129, 0.5));
}

.flow-node__label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-text);
    text-align: center;
}

/* Highlight Box (metrics) */
.flow-highlight {
    background: linear-gradient(135deg, rgba(74, 158, 255, 0.12) 0%, rgba(0, 212, 255, 0.08) 100%);
    border: 1px solid rgba(74, 158, 255, 0.3);
    border-radius: 12px;
    padding: var(--space-md);
    text-align: center;
    margin-top: var(--space-sm);
    backdrop-filter: blur(10px);
}

.flow-highlight__row {
    display: flex;
    justify-content: center;
    gap: var(--space-md);
    margin-bottom: var(--space-sm);
}

.flow-highlight__stat {
    text-align: center;
}

.flow-highlight__number {
    display: block;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--color-highlight);
    line-height: 1;
}

.flow-highlight__text {
    display: block;
    font-size: 0.7rem;
    color: var(--color-text-secondary);
    margin-top: 4px;
}

.flow-highlight__badge {
    display: inline-block;
    background: var(--color-highlight);
    color: white;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 4px 12px;
    border-radius: 20px;
}

/* Center Components (Supernova Platform) */
.flow-column--center {
    justify-content: center;
    position: relative;
}

.flow-component {
    position: relative;
    background: linear-gradient(145deg, rgba(20, 45, 80, 0.98) 0%, rgba(15, 36, 64, 0.98) 100%);
    border: 1px solid var(--color-divider);
    border-radius: 14px;
    padding: var(--space-sm) var(--space-md);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.flow-component::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 14px;
    padding: 2px;
    background: linear-gradient(135deg, var(--color-highlight), var(--color-neon), var(--color-highlight));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.flow-component:hover {
    transform: scale(1.02);
    box-shadow: 0 12px 40px rgba(74, 158, 255, 0.15);
}

.flow-component:hover::before {
    opacity: 1;
}

.flow-component__inner {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    position: relative;
    z-index: 1;
}

.flow-component__icon {
    width: 40px;
    height: 40px;
    min-width: 40px;
    background: linear-gradient(135deg, var(--color-highlight) 0%, var(--color-neon) 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(74, 158, 255, 0.4);
}

/* Different colors for each platform component icon */
.flow-component:nth-of-type(1) .flow-component__icon {
    background: linear-gradient(135deg, #a855f7 0%, #c084fc 100%);
    box-shadow: 0 4px 15px rgba(168, 85, 247, 0.4);
}

.flow-component:nth-of-type(2) .flow-component__icon {
    background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

.flow-component:nth-of-type(3) .flow-component__icon {
    background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4);
}

.flow-component:nth-of-type(4) .flow-component__icon {
    background: linear-gradient(135deg, #ec4899 0%, #f472b6 100%);
    box-shadow: 0 4px 15px rgba(236, 72, 153, 0.4);
}

.flow-component:nth-of-type(5) .flow-component__icon {
    background: linear-gradient(135deg, #4a9eff 0%, #00d4ff 100%);
    box-shadow: 0 4px 15px rgba(74, 158, 255, 0.4);
}

.flow-component__icon svg {
    width: 20px;
    height: 20px;
    stroke: white;
    stroke-width: 1.5;
    fill: none;
}

.flow-component__text {
    flex: 1;
}

.flow-component__name {
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--color-text);
    display: block;
}

.flow-component__subtitle {
    font-size: 0.7rem;
    color: var(--color-text-secondary);
}

/* Vertical Connectors Between Components */
.flow-connector-vertical {
    width: 2px;
    height: 20px;
    background: linear-gradient(180deg, var(--color-highlight), var(--color-accent));
    margin: 0 auto;
    position: relative;
}

.flow-connector-vertical::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 6px;
    background: var(--color-highlight);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--color-highlight);
    animation: pulse-connector 2s ease-in-out infinite;
}

@keyframes pulse-connector {
    0%, 100% { opacity: 1; transform: translateX(-50%) scale(1); }
    50% { opacity: 0.6; transform: translateX(-50%) scale(0.7); }
}

/* Horizontal Flow Connectors */
.flow-connectors {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: visible;
}

.flow-connectors__line {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg,
        var(--color-divider) 0%,
        var(--color-highlight) 50%,
        var(--color-divider) 100%);
    opacity: 0.8;
    box-shadow: 0 0 10px rgba(74, 158, 255, 0.3);
}

.flow-connectors__pulse {
    position: absolute;
    top: 50%;
    left: -20px;
    width: 20px;
    height: 4px;
    background: linear-gradient(90deg, transparent, var(--color-neon), transparent);
    transform: translateY(-50%);
    animation: flow-pulse 3s ease-in-out infinite;
    border-radius: 2px;
}

.flow-connectors--right .flow-connectors__pulse {
    animation-delay: 1.5s;
}

@keyframes flow-pulse {
    0% { left: -20px; opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { left: calc(100% + 20px); opacity: 0; }
}

/* Outcome Nodes (Right Side) */
.flow-column--outcomes {
    justify-content: center;
}

.flow-outcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-md);
    background: linear-gradient(135deg, rgba(30, 58, 95, 0.95) 0%, rgba(20, 45, 80, 0.95) 100%);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 12px;
    transition: all 0.3s ease;
    position: relative;
    backdrop-filter: blur(10px);
}

.flow-outcome:hover {
    border-color: var(--color-neon);
    box-shadow: 0 8px 30px rgba(0, 212, 255, 0.25);
    transform: translateY(-4px);
}

.flow-outcome__icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.2) 0%, rgba(74, 158, 255, 0.15) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.2);
}

.flow-outcome__icon svg {
    width: 24px;
    height: 24px;
    stroke: var(--color-neon);
    stroke-width: 1.5;
    fill: none;
    filter: drop-shadow(0 0 4px rgba(0, 212, 255, 0.5));
}

/* Different colors for each outcome icon */
.flow-outcome:nth-child(1) .flow-outcome__icon {
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.2) 0%, rgba(244, 114, 182, 0.15) 100%);
    box-shadow: 0 0 20px rgba(236, 72, 153, 0.2);
}

.flow-outcome:nth-child(1) .flow-outcome__icon svg {
    stroke: #ec4899;
    filter: drop-shadow(0 0 4px rgba(236, 72, 153, 0.5));
}

.flow-outcome:nth-child(2) .flow-outcome__icon {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2) 0%, rgba(52, 211, 153, 0.15) 100%);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.2);
}

.flow-outcome:nth-child(2) .flow-outcome__icon svg {
    stroke: #10b981;
    filter: drop-shadow(0 0 4px rgba(16, 185, 129, 0.5));
}

.flow-outcome:nth-child(3) .flow-outcome__icon {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2) 0%, rgba(251, 191, 36, 0.15) 100%);
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.2);
}

.flow-outcome:nth-child(3) .flow-outcome__icon svg {
    stroke: #f59e0b;
    filter: drop-shadow(0 0 4px rgba(245, 158, 11, 0.5));
}

.flow-outcome__label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text);
    text-align: center;
}

.flow-outcome__metric {
    font-size: 0.7rem;
    color: var(--color-accent);
    text-align: center;
}

/* ----------------------------------------
   BLUEPRINT COMPONENT
   ---------------------------------------- */

.blueprint {
    max-width: 900px;
    margin: 0 auto;
    padding-top: var(--space-md);
}

.blueprint__timeline {
    position: relative;
}

/* Individual Step */
.blueprint__step {
    display: grid;
    grid-template-columns: 70px 1fr;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

/* Step Marker (number + line) */
.blueprint__step-marker {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.blueprint__step-number {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--color-highlight) 0%, var(--color-neon) 100%);
    color: white;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 700;
    border-radius: 50%;
    position: relative;
    z-index: 2;
    box-shadow: 0 4px 20px rgba(74, 158, 255, 0.3);
}

/* Different colors for each step number */
.blueprint__step:nth-child(1) .blueprint__step-number {
    background: linear-gradient(135deg, #a855f7 0%, #c084fc 100%);
    box-shadow: 0 4px 20px rgba(168, 85, 247, 0.3);
}

.blueprint__step:nth-child(2) .blueprint__step-number {
    background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.3);
}

.blueprint__step:nth-child(3) .blueprint__step-number {
    background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
    box-shadow: 0 4px 20px rgba(245, 158, 11, 0.3);
}

.blueprint__step:nth-child(4) .blueprint__step-number {
    background: linear-gradient(135deg, #ec4899 0%, #f472b6 100%);
    box-shadow: 0 4px 20px rgba(236, 72, 153, 0.3);
}

.blueprint__step:nth-child(5) .blueprint__step-number {
    background: linear-gradient(135deg, #4a9eff 0%, #00d4ff 100%);
    box-shadow: 0 4px 20px rgba(74, 158, 255, 0.3);
}

.blueprint__step-line {
    width: 2px;
    flex: 1;
    min-height: 40px;
    background: linear-gradient(180deg, var(--color-highlight), var(--color-divider));
    margin-top: var(--space-xs);
}

.blueprint__step:last-child .blueprint__step-line {
    background: linear-gradient(180deg, var(--color-highlight), transparent);
}

/* Step Content */
.blueprint__step-content {
    padding-bottom: var(--space-sm);
}

.blueprint__step-title {
    font-family: var(--font-sans);
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: var(--space-xs);
}

.blueprint__step-desc {
    font-size: 0.95rem;
    color: var(--color-text-secondary);
    line-height: 1.7;
    margin-bottom: var(--space-md);
}

/* Tags */
.blueprint__tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
}

.blueprint__tag {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-highlight);
    background: var(--color-highlight-soft);
    padding: 4px 10px;
    border-radius: 4px;
}

/* Metrics Visual */
.blueprint__metrics {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.blueprint__metric-bar {
    height: 32px;
    background: rgba(15, 36, 64, 0.8);
    border: 1px solid var(--color-divider);
    border-radius: 6px;
    position: relative;
    overflow: hidden;
}

.blueprint__metric-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: var(--width, 50%);
    background: linear-gradient(90deg, var(--color-highlight), var(--color-neon));
    border-radius: 6px;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 1s ease-out;
}

.blueprint__metric-bar.animate::before {
    transform: scaleX(1);
}

/* Different colors for each metric bar */
.blueprint__metric-bar:nth-child(1)::before {
    background: linear-gradient(90deg, #a855f7, #c084fc);
}

.blueprint__metric-bar:nth-child(2)::before {
    background: linear-gradient(90deg, #10b981, #34d399);
}

.blueprint__metric-bar:nth-child(3)::before {
    background: linear-gradient(90deg, #ec4899, #f472b6);
}

.blueprint__metric-bar span {
    position: relative;
    z-index: 1;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-text);
    padding: 0 var(--space-sm);
    line-height: 32px;
}

/* Insight Cards */
.blueprint__insights {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
}

.blueprint__insight {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(15, 36, 64, 0.8);
    border: 1px solid var(--color-divider);
    border-radius: 6px;
    font-size: 0.8rem;
    color: var(--color-text-secondary);
    transition: all 0.3s ease;
}

.blueprint__insight:hover {
    border-color: var(--color-highlight);
    background: rgba(74, 158, 255, 0.1);
}

.blueprint__insight-icon {
    color: var(--color-highlight);
    font-weight: 700;
}

/* Activation Flow Visual */
.blueprint__flow-visual {
    display: flex;
    align-items: center;
    gap: 0;
    margin-top: var(--space-sm);
}

.blueprint__flow-dot {
    width: 12px;
    height: 12px;
    background: rgba(30, 58, 95, 0.8);
    border: 1px solid var(--color-divider);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.blueprint__flow-dot--active {
    background: var(--color-neon);
    box-shadow: 0 0 15px var(--color-neon-glow);
    animation: dot-pulse 2s ease-in-out infinite;
}

@keyframes dot-pulse {
    0%, 100% { box-shadow: 0 0 10px var(--color-neon-glow); }
    50% { box-shadow: 0 0 20px var(--color-neon-glow); }
}

.blueprint__flow-line {
    width: 50px;
    height: 2px;
    background: linear-gradient(90deg, rgba(30, 58, 95, 0.8), var(--color-highlight));
}

.blueprint__flow-label {
    font-size: 0.75rem;
    color: var(--color-accent);
    margin-left: var(--space-sm);
}

/* Cycle Visual */
.blueprint__cycle {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-top: var(--space-sm);
}

.blueprint__cycle-svg {
    width: 50px;
    height: 50px;
}

.blueprint__cycle-track {
    fill: none;
    stroke: rgba(30, 58, 95, 0.8);
    stroke-width: 4;
}

.blueprint__cycle-progress {
    fill: none;
    stroke: var(--color-highlight);
    stroke-width: 4;
    stroke-dasharray: 251;
    stroke-dashoffset: 63;
    stroke-linecap: round;
    transform: rotate(-90deg);
    transform-origin: center;
}

.blueprint__cycle-dot {
    fill: var(--color-neon);
}

.blueprint__cycle-label {
    font-size: 0.8rem;
    color: var(--color-accent);
}

/* ----------------------------------------
   RESPONSIVE STYLES
   ---------------------------------------- */

@media (max-width: 1024px) {
    .flow-chart {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
        gap: var(--space-md);
        min-height: auto;
    }

    .flow-column {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: var(--space-sm);
    }

    .flow-column--center {
        flex-direction: column;
        max-width: 400px;
        margin: 0 auto;
    }

    .flow-connectors {
        display: none;
    }

    .flow-column--inputs,
    .flow-column--outcomes {
        position: relative;
        padding-bottom: var(--space-lg);
    }

    .flow-column--inputs::after,
    .flow-column--center::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 50%;
        transform: translateX(-50%);
        width: 2px;
        height: 30px;
        background: linear-gradient(180deg, var(--color-highlight), transparent);
    }

    .flow-column--outcomes::after {
        display: none;
    }

    .flow-node {
        flex: 1;
        min-width: 140px;
        max-width: 200px;
    }

    .flow-column--outcomes {
        flex-direction: column;
        align-items: center;
        width: 100%;
    }

    .flow-outcome {
        width: 100%;
        max-width: 400px;
        flex-direction: row;
        align-items: center;
        gap: var(--space-sm);
    }

    .flow-outcome__label {
        flex: 1;
        text-align: left;
    }

    .flow-outcome__metric {
        text-align: right;
        flex-shrink: 0;
    }

    .flow-highlight {
        width: 100%;
        max-width: 300px;
    }
}

@media (max-width: 640px) {
    .flow-chart {
        gap: var(--space-sm);
    }

    .flow-column--outcomes {
        flex-direction: column;
        align-items: stretch;
        padding: 0 var(--space-sm);
    }

    .flow-node {
        width: 100%;
        max-width: none;
        flex-direction: row;
        text-align: left;
        gap: var(--space-sm);
    }

    .flow-outcome {
        width: 100%;
        max-width: none;
        flex-direction: row;
        align-items: center;
        text-align: left;
        gap: var(--space-sm);
        padding: var(--space-sm) var(--space-md);
    }

    .flow-outcome__label {
        flex: 1;
        font-size: 0.95rem;
    }

    .flow-outcome__metric {
        font-size: 0.75rem;
        white-space: nowrap;
    }

    .flow-node__icon,
    .flow-outcome__icon {
        width: 44px;
        height: 44px;
        min-width: 44px;
    }

    .flow-node__icon svg,
    .flow-outcome__icon svg {
        width: 22px;
        height: 22px;
    }

    .flow-component {
        padding: var(--space-sm);
    }

    .flow-component__icon {
        width: 36px;
        height: 36px;
        min-width: 36px;
    }

    .flow-component__name {
        font-size: 0.85rem;
    }

    .flow-highlight__row {
        gap: var(--space-sm);
    }

    .flow-highlight__number {
        font-size: 1.5rem;
    }

    /* Blueprint mobile */
    .blueprint__step {
        grid-template-columns: 50px 1fr;
        gap: var(--space-sm);
    }

    .blueprint__step-number {
        width: 36px;
        height: 36px;
        font-size: 0.75rem;
    }

    .blueprint__step-title {
        font-size: 1rem;
    }

    .blueprint__step-desc {
        font-size: 0.9rem;
    }

    .blueprint__insights {
        flex-direction: column;
    }

    .blueprint__insight {
        width: 100%;
    }

    .blueprint__flow-visual {
        flex-wrap: wrap;
    }

    .blueprint__flow-line {
        width: 30px;
    }
}
