/* ========================================
   TREASURY FLOW - Interactive Visualization
   Shows how funds flow through the ecosystem
   ======================================== */

/* === SECTION CONTAINER === */
.treasury-flow {
    padding: var(--space-3xl) 0;
    position: relative;
    overflow: hidden;
}

.tf-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

.tf-header {
    text-align: center;
    margin-bottom: var(--space-2xl);
}

.tf-title {
    font-size: clamp(var(--font-2xl), 4vw, var(--font-3xl));
    font-weight: 800;
    margin-bottom: var(--space-sm);
}

.tf-subtitle {
    font-size: var(--font-md);
    color: var(--color-text-muted);
    max-width: 600px;
    margin: 0 auto;
}

/* === MAIN DIAGRAM WRAPPER === */
.tf-diagram {
    position: relative;
    min-height: 400px;
}

/* === DESKTOP LAYOUT === */
.tf-layout {
    display: grid;
    grid-template-columns: 200px 1fr 200px;
    gap: var(--space-xl);
    align-items: center;
    position: relative;
}

/* === PLAYER CARDS COLUMN === */
.tf-players {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.tf-player-card {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.tf-player-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(153, 69, 255, 0.1) 0%, rgba(20, 241, 149, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tf-player-card:hover {
    border-color: rgba(153, 69, 255, 0.3);
    transform: translateX(4px);
}

.tf-player-card:hover::before {
    opacity: 1;
}

.tf-player-card.active {
    border-color: var(--color-primary);
    background: rgba(153, 69, 255, 0.1);
    box-shadow: 0 0 20px rgba(153, 69, 255, 0.2);
}

.tf-player-card.active::before {
    opacity: 1;
}

.tf-player-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-xs);
    font-weight: 700;
    color: white;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.tf-player-name {
    font-size: var(--font-sm);
    font-weight: 600;
    color: var(--color-text);
    position: relative;
    z-index: 1;
}

/* Special styling for Player 5000 */
.tf-player-card--special {
    margin-top: var(--space-sm);
    border-style: dashed;
}

.tf-player-card--special .tf-player-avatar {
    background: linear-gradient(135deg, var(--color-secondary), var(--color-primary));
}

/* Connected players count */
.tf-players-count {
    text-align: center;
    padding: var(--space-sm);
    font-size: var(--font-xs);
    color: var(--color-text-muted);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    margin-top: var(--space-sm);
}

.tf-players-count strong {
    color: var(--color-secondary);
    font-weight: 700;
}

/* === TREASURY CENTER === */
.tf-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 300px;
}

.tf-treasury {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(153, 69, 255, 0.15) 0%, rgba(20, 241, 149, 0.1) 100%);
    border: 2px solid rgba(153, 69, 255, 0.4);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
    transition: all 0.4s ease;
}

.tf-treasury.active {
    border-color: var(--color-primary);
    box-shadow:
        0 0 30px rgba(153, 69, 255, 0.4),
        0 0 60px rgba(153, 69, 255, 0.2);
    transform: scale(1.05);
}

.tf-treasury__icon {
    width: 48px;
    height: 48px;
    margin-bottom: var(--space-xs);
    color: var(--color-primary);
}

.tf-treasury__label {
    font-size: var(--font-sm);
    font-weight: 700;
    color: var(--color-text);
    text-align: center;
}

.tf-treasury__sublabel {
    font-size: var(--font-xs);
    color: var(--color-text-muted);
}

/* Treasury glow effect */
.tf-treasury__glow {
    position: absolute;
    width: 200%;
    height: 200%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(153, 69, 255, 0.15) 0%, transparent 70%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.tf-treasury.active .tf-treasury__glow {
    opacity: 1;
    animation: treasury-pulse 2s ease-in-out infinite;
}

@keyframes treasury-pulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 1; }
}

/* === DESTINATION NODES === */
.tf-destinations {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.tf-destination {
    padding: var(--space-lg);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    text-align: center;
    transition: all 0.4s ease;
    position: relative;
    overflow: hidden;
}

.tf-destination::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.tf-destination--payout::before {
    background: linear-gradient(135deg, rgba(20, 241, 149, 0.1) 0%, transparent 100%);
}

.tf-destination--airdrop::before {
    background: linear-gradient(135deg, rgba(153, 69, 255, 0.1) 0%, transparent 100%);
}

.tf-destination.active {
    transform: translateX(-4px);
}

.tf-destination--payout.active {
    border-color: var(--color-secondary);
    box-shadow: 0 0 20px rgba(20, 241, 149, 0.2);
}

.tf-destination--airdrop.active {
    border-color: var(--color-primary);
    box-shadow: 0 0 20px rgba(153, 69, 255, 0.2);
}

.tf-destination.active::before {
    opacity: 1;
}

.tf-destination__icon {
    width: 40px;
    height: 40px;
    margin: 0 auto var(--space-sm);
    position: relative;
    z-index: 1;
}

.tf-destination--payout .tf-destination__icon {
    color: var(--color-secondary);
}

.tf-destination--airdrop .tf-destination__icon {
    color: var(--color-primary);
}

.tf-destination__title {
    font-size: var(--font-md);
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: var(--space-xs);
    position: relative;
    z-index: 1;
}

.tf-destination__desc {
    font-size: var(--font-xs);
    color: var(--color-text-muted);
    position: relative;
    z-index: 1;
}

/* === SVG FLOW OVERLAY === */
.tf-svg-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: visible;
}

/* Flow paths - default state */
.tf-path {
    fill: none;
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 2;
    stroke-linecap: round;
    transition: stroke 0.3s ease;
}

/* Flow paths - active/glowing state */
.tf-path.active {
    stroke: url(#tf-gradient-flow);
    stroke-width: 3;
    filter: drop-shadow(0 0 6px rgba(153, 69, 255, 0.6));
}

.tf-path--payout.active {
    stroke: url(#tf-gradient-payout);
    filter: drop-shadow(0 0 6px rgba(20, 241, 149, 0.6));
}

.tf-path--airdrop.active {
    stroke: url(#tf-gradient-airdrop);
    filter: drop-shadow(0 0 6px rgba(153, 69, 255, 0.6));
}

/* Moving dots */
.tf-dot {
    fill: var(--color-primary);
    opacity: 0;
    filter: drop-shadow(0 0 4px var(--color-primary));
    transition: opacity 0.2s ease;
}

.tf-dot.active {
    opacity: 1;
}

.tf-dot--payout {
    fill: var(--color-secondary);
    filter: drop-shadow(0 0 4px var(--color-secondary));
}

.tf-dot--airdrop {
    fill: var(--color-primary);
    filter: drop-shadow(0 0 4px var(--color-primary));
}

/* === MOBILE LAYOUT === */
.tf-layout-mobile {
    display: none;
    flex-direction: column;
    gap: var(--space-xl);
}

/* Mobile Players Row - Horizontal Scroll */
.tf-players-row {
    display: flex;
    gap: var(--space-sm);
    overflow-x: auto;
    padding: var(--space-sm) 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.tf-players-row::-webkit-scrollbar {
    display: none;
}

.tf-players-row .tf-player-card {
    flex-shrink: 0;
    min-width: 120px;
}

/* Mobile Treasury */
.tf-mobile-treasury {
    display: flex;
    justify-content: center;
}

/* Mobile Destinations */
.tf-mobile-destinations {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
}

/* Mobile SVG */
.tf-svg-mobile {
    display: none;
}

/* === RESPONSIVE === */
@media (max-width: 900px) {
    /* Hide desktop layout */
    .tf-layout {
        display: none;
    }

    /* Show mobile layout */
    .tf-layout-mobile {
        display: flex;
    }

    .tf-svg-overlay {
        display: none;
    }

    .tf-svg-mobile {
        display: block;
        width: 100%;
        height: 200px;
        margin: calc(-1 * var(--space-lg)) 0;
    }

    .tf-treasury {
        width: 120px;
        height: 120px;
    }

    .tf-treasury__icon {
        width: 36px;
        height: 36px;
    }

    .tf-destination {
        padding: var(--space-md);
    }
}

@media (max-width: 480px) {
    .tf-header {
        margin-bottom: var(--space-xl);
    }

    .tf-mobile-destinations {
        grid-template-columns: 1fr;
    }

    .tf-treasury {
        width: 100px;
        height: 100px;
    }

    .tf-treasury__icon {
        width: 32px;
        height: 32px;
    }

    .tf-treasury__label {
        font-size: var(--font-xs);
    }
}

/* === ANIMATION INSTRUCTION TEXT === */
.tf-instruction {
    text-align: center;
    margin-top: var(--space-xl);
    padding: var(--space-md);
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-md);
    border: 1px dashed rgba(255, 255, 255, 0.1);
}

.tf-instruction__text {
    font-size: var(--font-sm);
    color: var(--color-text-dim);
}

.tf-instruction__text span {
    color: var(--color-primary);
    font-weight: 600;
}

/* === REDUCED MOTION === */
@media (prefers-reduced-motion: reduce) {
    .tf-dot,
    .tf-path,
    .tf-treasury,
    .tf-destination,
    .tf-player-card {
        transition: none;
    }

    .tf-treasury__glow {
        animation: none;
    }
}
