/**
 * Ecosystem Graph Visualization Styles
 * Dark theme matching Event Trader platform
 */

/* Page Layout */
.ecosystem-page {
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: linear-gradient(135deg, #0a0a0f 0%, #121218 50%, #0d0d12 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.ecosystem-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background: rgba(10, 10, 15, 0.95);
    border-bottom: 1px solid rgba(0, 212, 255, 0.2);
    z-index: 100;
    backdrop-filter: blur(10px);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo-link {
    text-decoration: none;
    display: flex;
    gap: 8px;
}

.logo-event {
    color: #00d4ff;
    font-weight: 700;
    font-size: 18px;
    letter-spacing: 2px;
}

.logo-trader {
    color: #00ff88;
    font-weight: 400;
    font-size: 18px;
    letter-spacing: 2px;
}

.page-title {
    color: #888;
    font-size: 14px;
    padding-left: 20px;
    border-left: 1px solid #333;
}

.header-right {
    display: flex;
    gap: 12px;
}

.header-btn {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: #aaa;
    text-decoration: none;
    font-size: 13px;
    transition: all 0.2s;
}

.header-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
}

.header-btn.primary {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.2), rgba(0, 255, 136, 0.2));
    border-color: rgba(0, 212, 255, 0.4);
    color: #00d4ff;
}

.header-btn.primary:hover {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.3), rgba(0, 255, 136, 0.3));
}

/* Graph Container */
.graph-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

#graphSvg {
    width: 100%;
    height: 100%;
    cursor: grab;
}

#graphSvg:active {
    cursor: grabbing;
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 10, 15, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 200;
    transition: opacity 0.3s;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(0, 212, 255, 0.2);
    border-top-color: #00d4ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay p {
    margin-top: 20px;
    color: #888;
    font-size: 14px;
}

.error-message {
    text-align: center;
    color: #ff6666;
}

.error-message i {
    font-size: 48px;
    margin-bottom: 16px;
}

.error-message button {
    margin-top: 16px;
    padding: 10px 24px;
    background: #00d4ff;
    border: none;
    border-radius: 6px;
    color: #000;
    cursor: pointer;
    font-weight: 600;
}

/* Control Panel */
.control-panel {
    position: absolute;
    top: 80px;
    left: 20px;
    width: 240px;
    background: rgba(15, 15, 20, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 16px;
    z-index: 50;
    backdrop-filter: blur(10px);
    max-height: calc(100vh - 160px);
    overflow-y: auto;
    transition: transform 0.3s;
}

.control-panel.collapsed {
    transform: translateX(-260px);
}

.control-section {
    margin-bottom: 20px;
}

.control-section:last-child {
    margin-bottom: 0;
}

.control-section h4 {
    color: #888;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0 0 10px 0;
}

/* Search Box */
.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box i {
    position: absolute;
    left: 12px;
    color: #666;
    font-size: 14px;
}

.search-box input {
    width: 100%;
    padding: 10px 36px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #fff;
    font-size: 13px;
}

.search-box input:focus {
    outline: none;
    border-color: #00d4ff;
}

.search-box input::placeholder {
    color: #666;
}

.clear-search {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 4px 8px;
}

.clear-search:hover {
    color: #fff;
}

/* Category Filters */
.category-filters {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.category-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.category-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

.category-btn.active {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.category-btn:not(.active) {
    opacity: 0.5;
}

.cat-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.cat-label {
    color: #ccc;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.filter-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.filter-action-btn {
    flex: 1;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: #888;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* Stats */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.stat-item {
    text-align: center;
    padding: 10px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
}

.stat-value {
    display: block;
    font-size: 20px;
    font-weight: 700;
    color: #00d4ff;
}

.stat-label {
    display: block;
    font-size: 10px;
    color: #666;
    text-transform: uppercase;
    margin-top: 4px;
}

/* Zoom Controls */
.zoom-controls {
    display: flex;
    gap: 8px;
}

.zoom-btn {
    flex: 1;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: #888;
    cursor: pointer;
    transition: all 0.2s;
}

.zoom-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* Toggle Panel Button */
.toggle-panel {
    position: absolute;
    right: -30px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 48px;
    background: rgba(15, 15, 20, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-left: none;
    border-radius: 0 6px 6px 0;
    color: #888;
    cursor: pointer;
    display: none;
}

/* Node Detail Sidebar */
.node-detail-sidebar {
    position: absolute;
    top: 80px;
    right: -320px;
    width: 300px;
    max-height: calc(100vh - 160px);
    background: rgba(15, 15, 20, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
    z-index: 60;
    backdrop-filter: blur(10px);
    transition: right 0.3s ease;
    overflow-y: auto;
}

.node-detail-sidebar.open {
    right: 20px;
}

.close-sidebar {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 8px;
    font-size: 16px;
}

.close-sidebar:hover {
    color: #fff;
}

.node-detail-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 16px;
}

.node-detail-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    color: #000;
}

.node-detail-info h3 {
    margin: 0;
    color: #fff;
    font-size: 18px;
}

.node-category-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    margin-top: 6px;
}

.node-description {
    color: #aaa;
    font-size: 14px;
    line-height: 1.5;
    margin: 0 0 16px 0;
}

.node-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.meta-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
}

.meta-label {
    color: #666;
    font-size: 12px;
}

.meta-value {
    color: #fff;
    font-size: 12px;
    font-weight: 500;
}

.meta-value.status-planned {
    color: #888;
}

.meta-value.status-beta {
    color: #ffd700;
}

.node-link-btn {
    display: block;
    text-align: center;
    padding: 12px;
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.2), rgba(0, 255, 136, 0.2));
    border: 1px solid rgba(0, 212, 255, 0.4);
    border-radius: 8px;
    color: #00d4ff;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    margin-bottom: 16px;
}

.node-link-btn:hover {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.3), rgba(0, 255, 136, 0.3));
}

.connected-section h4 {
    color: #888;
    font-size: 12px;
    margin: 0 0 12px 0;
}

.connected-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.connected-tag {
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid;
    border-radius: 4px;
    font-size: 11px;
    color: #ccc;
}

/* Legend Panel */
.legend-panel {
    position: absolute;
    bottom: 80px;
    right: 20px;
    width: 180px;
    background: rgba(15, 15, 20, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    z-index: 40;
    backdrop-filter: blur(10px);
    overflow: hidden;
}

.legend-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.legend-header h4 {
    margin: 0;
    color: #888;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.toggle-legend {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 4px;
    transition: transform 0.2s;
}

.legend-panel.collapsed .toggle-legend {
    transform: rotate(180deg);
}

.legend-content {
    padding: 12px 14px;
    max-height: 300px;
    overflow-y: auto;
    transition: max-height 0.3s;
}

.legend-panel.collapsed .legend-content {
    max-height: 0;
    padding: 0 14px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
}

.legend-color {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.legend-label {
    color: #aaa;
    font-size: 11px;
}

/* Tooltip */
.node-tooltip {
    position: fixed;
    background: rgba(20, 20, 25, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 10px 14px;
    pointer-events: none;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.15s;
    max-width: 220px;
}

.node-tooltip.visible {
    opacity: 1;
}

.node-tooltip strong {
    display: block;
    color: #fff;
    font-size: 13px;
    margin-bottom: 4px;
}

.tooltip-category {
    display: block;
    font-size: 11px;
    margin-bottom: 6px;
}

.tooltip-desc {
    display: block;
    color: #888;
    font-size: 11px;
    line-height: 1.4;
}

/* Footer */
.ecosystem-footer {
    padding: 12px 24px;
    background: rgba(10, 10, 15, 0.95);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.ecosystem-footer p {
    margin: 0;
    color: #666;
    font-size: 12px;
}

.ecosystem-footer a {
    color: #00d4ff;
    text-decoration: none;
}

.ecosystem-footer a:hover {
    text-decoration: underline;
}

/* Graph Elements */
.node {
    cursor: pointer;
    transition: opacity 0.3s;
}

.node:hover .node-circle {
    stroke-width: 3px;
}

.node:hover .node-glow {
    opacity: 0.5;
}

.node.highlighted .node-circle {
    stroke-width: 4px;
}

.node.highlighted .node-glow {
    opacity: 0.6;
}

.node.dimmed {
    opacity: 0.15 !important;
}

.node-label {
    pointer-events: none;
    font-family: 'Space Grotesk', sans-serif;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.edge {
    transition: opacity 0.3s;
}

.edge.dimmed {
    opacity: 0.05 !important;
}

.edge-core {
    stroke: #00d4ff;
}

.edge-chain {
    stroke: #9966ff;
}

.edge-token {
    stroke: #ff6600;
}

.edge-integration {
    stroke: #444;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .ecosystem-header {
        padding: 10px 16px;
    }

    .page-title {
        display: none;
    }

    .header-right {
        gap: 8px;
    }

    .header-btn {
        padding: 6px 12px;
        font-size: 12px;
    }

    .control-panel {
        left: 10px;
        top: 70px;
        width: 200px;
        padding: 12px;
    }

    .toggle-panel {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .node-detail-sidebar {
        width: calc(100% - 20px);
        right: -100%;
        left: 10px;
        max-height: 50vh;
        top: auto;
        bottom: 60px;
        border-radius: 12px 12px 0 0;
    }

    .node-detail-sidebar.open {
        right: auto;
    }

    .legend-panel {
        bottom: 60px;
        right: 10px;
        width: 160px;
    }

    .stat-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .stat-item {
        padding: 8px;
    }

    .stat-value {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .control-panel {
        width: calc(100% - 20px);
        left: 10px;
        right: 10px;
        top: auto;
        bottom: 60px;
        max-height: 40vh;
        border-radius: 12px 12px 0 0;
        transform: translateY(100%);
    }

    .control-panel:not(.collapsed) {
        transform: translateY(0);
    }

    .toggle-panel {
        top: -30px;
        right: 50%;
        transform: translateX(50%);
        width: 48px;
        height: 24px;
        border-radius: 6px 6px 0 0;
        border-bottom: none;
    }

    .toggle-panel i {
        transform: rotate(90deg);
    }

    .legend-panel {
        display: none;
    }
}

/* Scrollbar */
.control-panel::-webkit-scrollbar,
.node-detail-sidebar::-webkit-scrollbar,
.legend-content::-webkit-scrollbar {
    width: 6px;
}

.control-panel::-webkit-scrollbar-track,
.node-detail-sidebar::-webkit-scrollbar-track,
.legend-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.control-panel::-webkit-scrollbar-thumb,
.node-detail-sidebar::-webkit-scrollbar-thumb,
.legend-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.control-panel::-webkit-scrollbar-thumb:hover,
.node-detail-sidebar::-webkit-scrollbar-thumb:hover,
.legend-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}
