/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    /* font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; */
    font-family: Arial, sans-serif;
    background: #0c182a;
    color: white;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

/* Navigation Links */
.nav-links {
    margin-top: 15px;
}

.nav-link {
    display: inline-block;
    padding: 8px 16px;
    margin: 0 5px;
    background: #444;
    color: #ffffff;
    text-decoration: none;
    border-radius: 4px;
    transition: background 0.3s;
}

.nav-link:hover {
    background: #555;
}

.nav-link.active {
    background: #007acc;
}

/* Controls Container */
.controls {
    margin-bottom: 30px;
}

.controls-row {
    display: flex;
    align-items: flex-start;
    gap: 40px;
    flex-wrap: wrap;
    justify-content: center;
}

.left-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
    flex-shrink: 0;
    min-width: 200px;
}

/* Visualization Selector */
.visualization-selector {
    text-align: center;
    margin-bottom: 0;
    flex-shrink: 0;
}

.vis-btn {
    background: #1a2a3a;
    color: white;
    border: 2px solid #3a4a5a;
    padding: 12px 24px;
    margin: 0 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
}

.vis-btn:hover {
    background: #2a3a4a;
    border-color: #4a5a6a;
}

.vis-btn.active {
    background: #3a4a5a;
    border-color: #3a4a5a;
    color: white;
}

/* Main Content Layout */
.main-content {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
}

/* Visualization Container */
.visualization-container {
    flex: 1;
    background: #1a2a3a;
    border-radius: 10px;
    padding: 20px;
    min-height: 600px;
    position: relative;
}

.vis-view {
    display: none;
    width: 100%;
    height: 100%;
}

.vis-view.active {
    display: block;
}

/* Product Filter */
.product-filter {
    text-align: center;
    margin-bottom: 0;
    flex-shrink: 0;
}

.product-filter label {
    font-weight: bold;
    margin-right: 10px;
    color: #C8C8C8;
}

.product-filter select {
    background: #1a2a3a;
    color: white;
    border: 2px solid #3a4a5a;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    min-width: 200px;
}

.product-filter select:focus {
    outline: none;
    border-color: #4a5a6a;
}

.product-filter option {
    background: #1a2a3a;
    color: white;
}

/* Bank Filter */
.bank-filter {
    text-align: center;
    margin-bottom: 0;
    flex-shrink: 0;
    min-width: 300px;
}



.bank-filter label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #C8C8C8;
}

.autocomplete-container {
    position: relative;
    display: inline-block;
    margin-right: 10px;
    margin-bottom: 10px;
}

.bank-filter input {
    background: #1a2a3a;
    color: white;
    border: 2px solid #3a4a5a;
    padding: 10px 15px;
    border-radius: 6px;
    font-size: 14px;
    width: 400px;
}

.bank-filter input:focus {
    outline: none;
    border-color: #4a5a6a;
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #1a2a3a;
    border: 2px solid #3a4a5a;
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.autocomplete-item {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid #3a4a5a;
    color: white;
}

.autocomplete-item:hover,
.autocomplete-item.highlighted {
    background: #2a3a4a;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.selected-banks {
    margin-bottom: 10px;
    min-height: 25px;
}

.selected-bank-tag {
    display: inline-block;
    background: #666;
    color: white;
    padding: 5px 10px;
    margin: 2px;
    border-radius: 15px;
    font-size: 12px;
}

.selected-bank-tag .remove-tag {
    margin-left: 5px;
    cursor: pointer;
    font-weight: bold;
    color: #ccc;
}

.selected-bank-tag .remove-tag:hover {
    color: #fff;
}

.bank-filter button {
    background: #1a2a3a;
    color: white;
    border: 2px solid #3a4a5a;
    padding: 10px 15px;
    margin: 0 5px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.bank-filter button:hover {
    background: #2a3a4a;
    border-color: #4a5a6a;
}

/* Depth Control */
.depth-control {
    text-align: center;
    margin-bottom: 0;
    flex-shrink: 0;
}

.depth-control label {
    font-weight: bold;
    margin-right: 10px;
    color: #C8C8C8;
}

.depth-control select {
    background: #1a2a3a;
    color: white;
    border: 2px solid #3a4a5a;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    min-width: 200px;
}

.depth-control select:focus {
    outline: none;
    border-color: #4a5a6a;
}

.depth-control option {
    background: #1a2a3a;
    color: white;
}

#hive-plot, #network-graph, #chord-diagram {
    width: 100%;
    height: 600px;
    background: #1a2a3a;
}

/* Hive Plot Specific */
#hive-plot svg {
    width: 100%;
    height: 100%;
}

/* Network Graph Specific */
#network-graph svg {
    width: 100%;
    height: 100%;
}

/* Chord Diagram Specific */
#chord-diagram svg {
    width: 100%;
    height: 100%;
}

.chord-arc {
    transition: all 0.2s ease;
}

.chord-ribbon {
    transition: all 0.2s ease;
}

.node {
    cursor: pointer;
    transition: all 0.2s ease;
}

.node:hover {
    stroke-width: 4px;
    stroke: #ffff00;
}

.edge {
    transition: all 0.2s ease;
    /* stroke-width is set dynamically by JavaScript */
}

/* Matrix graph edges - allow variable stroke-width */
.matrix-edge {
    stroke-width: 2px; /* Default fallback */
    transition: all 0.2s ease;
}

/* Matrix Info Panel */
.matrix-info-panel {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 300px;
    background: #1a2a3a;
    border: 1px solid #444;
    border-radius: 8px;
    padding: 20px;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    max-height: 400px;
    overflow-y: auto;
    display: flex;
}

.matrix-info-panel .close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    color: #ffffff;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.matrix-info-panel .close-btn:hover {
    color: #ff6b6b;
}

.matrix-info-panel .info-content h3 {
    margin: 0 0 15px 0;
    color: #ffffff;
    font-size: 16px;
    border-bottom: 1px solid #444;
    padding-bottom: 8px;
}

.matrix-info-panel .info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    padding: 4px 0;
}

.matrix-info-panel .info-label {
    color: #cccccc;
    font-weight: 500;
}

.matrix-info-panel .info-value {
    color: #ffffff;
    font-weight: bold;
}

.matrix-info-panel .info-placeholder {
    color: #888;
    font-style: italic;
    margin: 0;
}

/* Popup */
.popup {
    position: absolute;
    background: #1a2a3a;
    border: 2px solid #3a4a5a;
    border-radius: 8px;
    padding: 0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    z-index: 1000;
    max-width: 400px;
    display: none;
}

.popup-header {
    background: #2a3a4a;
    padding: 15px;
    border-radius: 6px 6px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.popup-header h3 {
    margin: 0;
    color: white;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s ease;
}

.close-btn:hover {
    background: rgba(255,255,255,0.2);
}

.popup-content {
    padding: 15px;
    color: white;
}

.popup-content p {
    margin-bottom: 10px;
}

.popup-content strong {
    color: #C8C8C8;
}

.connections-section {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #666;
}

.connections-section h4 {
    color: #4ECDC4;
    margin-bottom: 10px;
}

.connections-section ul {
    list-style: none;
    padding-left: 0;
}

.connections-section li {
    padding: 5px 0;
    border-bottom: 1px solid #3a4a5a;
}

/* Legend */
.legend {
    background: #1a2a3a;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid #3a4a5a;
}

.legend h3 {
    margin-bottom: 15px;
    color: #C8C8C8;
    text-align: center;
}

.legend-items {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    padding: 8px;
    background: #2a3a4a;
    border-radius: 4px;
    border: 1px solid #3a4a5a;
}

.color-box {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    margin-right: 10px;
    border: 2px solid white;
}

.tier-1 { background: #FF0000; }
.tier-2 { background: #ff8000; }
.tier-3 { background: #ffff00; }
.tier-4 { background: #80ff00; }
.tier-5 { background: #00ff00; }
.tier-6 { background: #00ff80; }
.tier-7 { background: #0000ff; }
.tier-8 { background: #0080ff; }
.tier-9 { background: #000080; }
.tier-10 { background: #8000ff; }
.tier-11 { background: #ff00ff; }
.tier-12 { background: #ff0080; }
/* Stats */
.stats {
    background: #1a2a3a;
    border-radius: 8px;
    padding: 20px;
    border: 1px solid #3a4a5a;
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-width: 200px;
    max-width: 250px;
    height: fit-content;
}

.stats-title {
    color: #ffffff;
    font-size: 1.2rem;
    font-weight: bold;
    margin: 0 0 10px 0;
    text-align: center;
    border-bottom: 2px solid #4CAF50;
    padding-bottom: 8px;
}

.stat-item {
    text-align: left;
    padding: 10px;
    background: #2a3a4a;
    border-radius: 6px;
    border: 1px solid #4a5a6a;
}

.stat-label {
    display: block;
    color: #C8C8C8;
    font-weight: bold;
    margin-bottom: 5px;
}

.stat-item span:last-child {
    font-size: 1.8rem;
    font-weight: bold;
    color: #4CAF50;
    display: block;
    margin-top: 5px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .visualization-container {
        padding: 10px;
    }
    
    #hive-plot, #network-graph, #chord-diagram {
        height: 400px;
    }
    
    .legend-items {
        grid-template-columns: 1fr;
    }
    
    .stats {
        flex-direction: column;
        gap: 15px;
    }
    
    .controls-row {
        flex-direction: column;
        gap: 20px;
    }
    
    .left-controls {
        gap: 15px;
    }
}

/* Animation for view transitions */
.vis-view {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.vis-view.active {
    opacity: 1;
    transform: translateY(0);
}

/* Info Panel */
.info-panel {
    width: 350px;
    background: #1a2a3a;
    border-radius: 10px;
    border: 1px solid #3a4a5a;
    display: flex;
    flex-direction: column;
    max-height: 80vh;
    flex-shrink: 0;
}

.info-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #3a4a5a;
    background: #2a3a4a;
    border-radius: 10px 10px 0 0;
}

.info-panel-header h3 {
    margin: 0;
    color: #fff;
    font-size: 16px;
}

.close-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.close-btn:hover {
    background-color: #3a4a5a;
}

.info-panel-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    color: #fff;
}

.info-placeholder {
    color: #888;
    font-style: italic;
    text-align: center;
    margin: 20px 0;
}

.info-content h4 {
    margin: 0 0 15px 0;
    color: #fff;
    border-bottom: 1px solid #555;
    padding-bottom: 8px;
}

.info-content p {
    margin: 8px 0;
    line-height: 1.4;
}

.info-content .info-row {
    display: flex;
    justify-content: space-between;
    margin: 8px 0;
    padding: 8px 0;
    border-bottom: 1px solid #2a3a4a;
}

.info-content .info-label {
    font-weight: bold;
    color: #ccc;
}

.info-content .info-value {
    color: #fff;
}

.info-content .connection-item {
    background: #2a3a4a;
    padding: 12px;
    margin: 8px 0;
    border-radius: 6px;
    border-left: 3px solid #007acc;
}

/* Responsive adjustments for info panel */
@media (max-width: 1200px) {
    .main-content {
        flex-direction: column;
    }
    
    .stats {
        min-width: auto;
        max-width: none;
        width: 100%;
        flex-direction: row;
        justify-content: space-around;
    }
    
    .stat-item {
        flex: 1;
        text-align: center;
    }
    
    .info-panel {
        width: 100%;
        max-height: 300px;
    }
}
