:root {
    --lab-palette-primary-main: #14315F; /* Navy */
    --lab-palette-primary-light: #24549C; /* Brand */
    --lab-palette-accent-pink: #1FA2D6; /* Sky - using for Einstein/AI nodes */
    --lab-palette-accent-orange: #FFC83D; /* Yellow - using for integrations/metrics */
    --lab-palette-accent-green: #1FA2D6; /* Sky - using for successes */
    --lab-text-primary: #1e293b;
    --lab-text-secondary: #475569;
    --lab-text-muted: #64748b;
    --lab-text-subtle: #94a3b8;
    --lab-bg-white: #ffffff;
    --lab-border-light: #e2e8f0;
    --radius-card: 1.5rem;
    --card-gap-lg: 2rem;
    --card-gap-md: 1rem;
    --shadow-card: 0 10px 30px -5px rgba(20, 49, 95, 0.1);
}

/* Ecosystem Dashboard Card Styles */
.ecosystem-card {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(15px);
    border-radius: var(--radius-card);
    padding: var(--card-gap-lg);
    border: 1px solid rgba(51, 96, 173, 0.12);
    box-shadow: var(--shadow-card);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    overflow: hidden;
    min-height: 650px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
}

.ecosystem-card:hover {
    box-shadow: 0 15px 40px rgba(51, 96, 173, 0.15);
    border-color: rgba(51, 96, 173, 0.25);
}

.ecosystem-header {
    margin-bottom: 4px;
}

.ecosystem-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(51, 96, 173, 0.08);
    color: var(--lab-palette-primary-main);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.ecosystem-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--lab-text-primary);
    margin: 0 0 2px 0;
    letter-spacing: -0.01em;
}

.ecosystem-subtitle {
    font-size: 0.85rem;
    color: var(--lab-text-muted);
    margin: 0;
}

/* SVG Overlays for Line Connections */
.ecosystem-svg-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.ecosystem-connections-svg {
    width: 100%;
    height: 100%;
}

.connection-path {
    fill: none;
    stroke: rgba(51, 96, 173, 0.1);
    stroke-width: 2.5px;
    transition: stroke 0.3s, stroke-width 0.3s, filter 0.3s;
}

.connection-path.flow-anim {
    stroke-dasharray: 6, 6;
    animation: flow-dash 30s linear infinite;
}

.connection-path.active {
    stroke: var(--lab-palette-primary-main);
    stroke-width: 3.5px;
    filter: drop-shadow(0 0 5px rgba(51, 96, 173, 0.6));
}

@keyframes flow-dash {
    to {
        stroke-dashoffset: -1000;
    }
}

/* Flow Grid Layout */
.ecosystem-flow-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    position: relative;
    z-index: 2;
    margin-top: 10px;
}

.ecosystem-column {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 12px;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    transition: all 0.3s ease;
}

.ecosystem-column:hover {
    background: rgba(255, 255, 255, 0.6);
}

.column-title {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--lab-text-primary);
    margin: 0 0 6px 0;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    display: flex;
    align-items: center;
    gap: 6px;
    border-bottom: 1px solid rgba(51, 96, 173, 0.08);
    padding-bottom: 6px;
}

.nodes-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Nodes Styling */
.ecosystem-node {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: var(--lab-bg-white);
    border: 1px solid var(--lab-border-light);
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--lab-text-secondary);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    min-height: 44px;
    user-select: none;
    position: relative;
    z-index: 2;
}

.ecosystem-node:hover {
    transform: translateY(-2px);
    border-color: var(--lab-palette-primary-light);
    box-shadow: 0 4px 10px rgba(51, 96, 173, 0.08);
    color: var(--lab-palette-primary-main);
}

.ecosystem-node.active {
    background: rgba(51, 96, 173, 0.06) !important;
    border-color: var(--lab-palette-primary-main) !important;
    color: var(--lab-palette-primary-main) !important;
    box-shadow: 0 0 10px rgba(51, 96, 173, 0.15) !important;
}

/* Node Category Variations */
.ecosystem-column[data-stage="lead-sources"] .column-title {
    color: var(--lab-palette-accent-pink);
    border-bottom-color: rgba(234, 23, 99, 0.1);
}
.ecosystem-column[data-stage="lead-sources"] .ecosystem-node:hover {
    border-color: var(--lab-palette-accent-pink);
    color: var(--lab-palette-accent-pink);
    box-shadow: 0 4px 12px rgba(234, 23, 99, 0.08);
}
.ecosystem-column[data-stage="lead-sources"] .ecosystem-node.active {
    border-color: var(--lab-palette-accent-pink) !important;
    color: var(--lab-palette-accent-pink) !important;
    background: rgba(234, 23, 99, 0.04) !important;
    box-shadow: 0 0 10px rgba(234, 23, 99, 0.15) !important;
}

.ecosystem-column[data-stage="salesforce-core"] .ecosystem-node:hover {
    border-color: var(--lab-palette-primary-main);
    color: var(--lab-palette-primary-main);
    box-shadow: 0 4px 12px rgba(51, 96, 173, 0.08);
}

.ecosystem-column[data-stage="ai-automation"] .column-title {
    color: var(--lab-palette-accent-orange);
    border-bottom-color: rgba(242, 133, 32, 0.1);
}
.ecosystem-column[data-stage="ai-automation"] .ecosystem-node:hover {
    border-color: var(--lab-palette-accent-orange);
    color: var(--lab-palette-accent-orange);
    box-shadow: 0 4px 12px rgba(242, 133, 32, 0.08);
}
.ecosystem-column[data-stage="ai-automation"] .ecosystem-node.active {
    border-color: var(--lab-palette-accent-orange) !important;
    color: var(--lab-palette-accent-orange) !important;
    background: rgba(242, 133, 32, 0.04) !important;
    box-shadow: 0 0 10px rgba(242, 133, 32, 0.15) !important;
}

.ecosystem-column[data-stage="integrations"] .column-title {
    color: var(--lab-palette-accent-green);
    border-bottom-color: rgba(32, 140, 114, 0.1);
}
.ecosystem-column[data-stage="integrations"] .ecosystem-node:hover {
    border-color: var(--lab-palette-accent-green);
    color: var(--lab-palette-accent-green);
    box-shadow: 0 4px 12px rgba(32, 140, 114, 0.08);
}
.ecosystem-column[data-stage="integrations"] .ecosystem-node.active {
    border-color: var(--lab-palette-accent-green) !important;
    color: var(--lab-palette-accent-green) !important;
    background: rgba(32, 140, 114, 0.04) !important;
    box-shadow: 0 0 10px rgba(32, 140, 114, 0.15) !important;
}

.node-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    font-size: 1rem;
}

.node-icon svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
    display: block;
}

/* Horizontal Journey Timeline Styles */
.journey-timeline-wrapper {
    margin-top: 12px;
    border-top: 1px solid rgba(51, 96, 173, 0.1);
    padding-top: 12px;
    position: relative;
    z-index: 2;
}

.timeline-title {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--lab-text-primary);
    margin: 0 0 10px 0;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.timeline-title-text {
    display: flex;
    align-items: center;
    gap: 6px;
}

.autoplay-toggle-btn {
    background: none;
    border: none;
    padding: 0;
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--lab-text-subtle);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid var(--lab-border-light);
    background: var(--lab-bg-white);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.autoplay-toggle-btn:hover {
    color: var(--lab-palette-primary-main);
    border-color: var(--lab-palette-primary-light);
    background: rgba(51, 96, 173, 0.05);
    transform: scale(1.05);
}

.autoplay-toggle-btn.active {
    color: var(--lab-palette-accent-green);
    border-color: rgba(32, 140, 114, 0.2);
    background: rgba(32, 140, 114, 0.05);
}

.journey-scroll-container {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 6px;
    scrollbar-width: thin;
}

.journey-timeline {
    display: flex;
    justify-content: space-between;
    min-width: 600px;
    position: relative;
    padding: 10px 0;
}

.journey-timeline::before {
    content: '';
    position: absolute;
    top: 15px;
    left: 5%;
    width: 90%;
    height: 2px;
    background: rgba(51, 96, 173, 0.1);
    z-index: 1;
}

.journey-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    position: relative;
    z-index: 2;
    cursor: pointer;
    width: calc(100% / 9);
    transition: all 0.3s ease;
}

.step-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--lab-bg-white);
    border: 2px solid rgba(51, 96, 173, 0.3);
    transition: all 0.3s ease;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.05);
}

.step-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--lab-text-muted);
    text-align: center;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.journey-step:hover .step-dot {
    background: var(--lab-palette-primary-light);
    border-color: var(--lab-palette-primary-main);
    transform: scale(1.2);
}

.journey-step.active .step-dot {
    background: var(--lab-palette-primary-main);
    border-color: var(--lab-palette-primary-main);
    transform: scale(1.3);
    box-shadow: 0 0 8px rgba(51, 96, 173, 0.5);
}

.journey-step.active .step-label {
    color: var(--lab-palette-primary-main);
    font-weight: 800;
}

/* Analytics section */
.ecosystem-analytics-section {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 12px;
    margin-top: 4px;
    position: relative;
    z-index: 2;
}

.mini-widget {
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(51, 96, 173, 0.08);
    border-radius: 10px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.widget-title {
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--lab-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    display: flex;
    align-items: center;
    gap: 4px;
}

.widget-value {
    font-size: 1.1rem;
    font-weight: 800;
}

.text-green {
    color: var(--lab-palette-accent-green);
}

.widget-progress {
    width: 100%;
    height: 6px;
    background: rgba(51, 96, 173, 0.08);
    border-radius: 3px;
    overflow: hidden;
}

.widget-progress .progress-bar {
    height: 100%;
    background: var(--lab-palette-accent-green);
    border-radius: 3px;
    transition: width 1s ease;
}

.insights-ticker-container {
    height: 24px;
    overflow: hidden;
    position: relative;
}

.insights-ticker-list {
    list-style: none;
    padding: 0;
    margin: 0;
    position: relative;
}

.ticker-item {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--lab-text-primary);
    line-height: 24px;
    height: 24px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: none;
}

.ticker-item.active {
    display: block;
    animation: slide-up-fade 0.5s ease-out;
}

@keyframes slide-up-fade {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Ecosystem Console panel */
.ecosystem-console {
    background: #0d111b; /* Rich dark navy terminal background */
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    padding: 14px 16px;
    position: relative;
    z-index: 2;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25), inset 0 2px 8px rgba(0, 0, 0, 0.2);
}

.console-tab-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 8px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.console-tab-header::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ff5f56;
    box-shadow: 14px 0 0 #ffbd2e, 28px 0 0 #27c93f;
    margin-right: 36px;
}

.console-title {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--lab-palette-accent-orange);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 6px;
}

.console-body {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.5;
    min-height: 48px;
}

/* Tab filters for mobile */
.ecosystem-mobile-tabs {
    display: none; /* Desktop hidden */
    gap: 8px;
    margin-bottom: 12px;
    width: 100%;
    position: relative;
    z-index: 5;
}

.mobile-tab-btn {
    flex: 1;
    background: var(--lab-bg-white);
    border: 1px solid var(--lab-border-light);
    border-radius: 8px;
    padding: 8px 4px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--lab-text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.mobile-tab-btn.active {
    background: var(--lab-palette-primary-main);
    color: white;
    border-color: var(--lab-palette-primary-main);
}

@media (max-width: 1024px) {
    /* Reflow Ecosystem Grid to 2 columns on Tablet */
    .ecosystem-flow-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .ecosystem-card {
        max-width: 800px;
        margin-left: auto;
        margin-right: auto;
        width: 100%;
    }
}

/* Tablet/Mobile Specific Ecosystem overrides */
@media (max-width: 991px) {
    .ecosystem-card {
        padding: var(--card-gap-md);
        min-height: auto;
    }
    .ecosystem-analytics-section {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .ecosystem-svg-container {
        display: none !important; /* Hide SVG paths to prevent layout mess */
    }
    
    .ecosystem-flow-grid {
        grid-template-columns: 1fr !important;
    }
    
    .ecosystem-column {
        display: none !important;
        animation: slide-up-fade 0.3s ease-out;
    }
    
    .ecosystem-column.active {
        display: flex !important;
    }
    
    .ecosystem-mobile-tabs {
        display: flex !important;
    }
}
