

:root {
    --primary: #3498db;
    --secondary: #888c8c;
    --accent: #e74c3c;
    --dark: #0f1b31;
    --darker: #0a1425;
    --light: #ecf0f1;
    --gray: #7f8c8d;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Montserrat', 'Segoe UI', 'Microsoft YaHei', sans-serif;
}

body {
    background: linear-gradient(135deg, var(--darker), var(--dark));
    min-height: 100vh;
    padding: 10px;
    color: var(--light);
    overflow-x: hidden;
}

.header {
    text-align: center;
    padding: 15px 0;
    margin-bottom: 15px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
}

.header h1 {
    font-size: 2.4rem;
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 8px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    letter-spacing: -0.5px;
}

.header p {
    font-size: 1rem;
    color: #bdc3c7;
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.6;
}

.file-upload-container {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.file-upload-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--primary), #2980b9);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.file-upload-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: 0.5s;
    z-index: -1;
}

.file-upload-btn:hover::after {
    left: 100%;
}

.file-upload-btn:hover {
    background: linear-gradient(135deg, #2980b9, #2573a7);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.5);
}

#file-input {
    display: none;
}

.file-name {
    background: rgba(255, 255, 255, 0.1);
    padding: 10px 15px;
    border-radius: 8px;
    min-width: 200px;
    text-align: center;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.dashboard {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 1800px;
    margin: 0 auto;
    height: calc(100vh - 150px);
}

.chart-container {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    padding: 20px;
    transition: all 0.4s ease;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.chart-container:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.main-panel {
    display: flex;
    gap: 20px;
    height: calc(100% - 40px);
}

.network-chart {
    flex: 1;
    height: 90%;
    min-width: 0; 
}

.tree-chart {
    flex: 1;
    height: 90%;
    min-width: 0; 
}

.main-panel.only-network .network-chart {
    flex: 1; 
    max-width: 100%;
}
.main-panel.only-network .tree-chart {
    flex: 0; 
    display: none; 
}

.main-panel.only-tree .network-chart {
    flex: 0;
    display: none; 
}
.main-panel.only-tree .tree-chart {
    flex: 1; 
    max-width: 100%;
}

.chart-title {
    font-size: 1.2rem;
    color: var(--primary);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.controls {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.btn {
    padding: 7px 14px;
    border-radius: 8px;
    border: none;
    background: linear-gradient(135deg, var(--primary), #2980b9);
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 5px;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
    font-size: 0.8rem;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(52, 152, 219, 0.5);
}

.btn.secondary {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    box-shadow: 0 4px 12px rgba(44, 62, 80, 0.3);
}

.btn.secondary:hover {
    box-shadow: 0 6px 15px rgba(44, 62, 80, 0.5);
}

.btn.accent {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
}

.btn.accent:hover {
    background: linear-gradient(135deg, #c0392b, #a02a1b);
    box-shadow: 0 6px 15px rgba(231, 76, 60, 0.5);
}

#layout-select {
    padding: 7px 14px;
    color: white; 
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23ecf0f1'><polygon points='0,0 12,0 6,12'/></svg>");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 10px;
    padding-right: 30px; 
    border-radius: 8px;
    border: none;
    background: linear-gradient(135deg, #2c3e50, #34495e);
    box-shadow: 0 4px 12px rgba(44, 62, 80, 0.3);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.8rem;
}

#layout-select:hover {
    box-shadow: 0 6px 15px rgba(44, 62, 80, 0.5);
    transform: translateY(-3px);
}

#layout-select option {
    background-color: var(--darker);
    color: var(--light);
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 27, 49, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 999;
    transition: opacity 0.4s;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(52, 152, 219, 0.3);
    border-top: 5px solid var(--primary);
    border-radius: 50%;
    animation: spin 1.2s linear infinite;
    margin-bottom: 20px;
}

.loading-text {
    font-size: 1.4rem;
    color: var(--light);
    font-weight: 500;
    text-align: center;
    margin-bottom: 12px;
}

.loading-subtext {
    color: #bdc3c7;
    max-width: 500px;
    text-align: center;
    line-height: 1.6;
    font-size: 0.95rem;
}

.progress-bar {
    width: 350px;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    margin-top: 20px;
    overflow: hidden;
}

.progress {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    width: 0%;
    transition: width 0.6s ease;
    border-radius: 4px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.dashboard {
    animation: fadeIn 0.8s ease-out;
}

.footer {
    text-align: center;
    margin-top: 20px;
    padding: 15px;
    color: var(--gray);
    font-size: 0.85rem;
}

.legend {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 5px 10px;
    border-radius: 20px;
}

.legend-color {
    width: 14px;
    height: 14px;
    border-radius: 50%;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--gray);
    text-align: center;
    padding: 15px;
}

.empty-state i {
    font-size: 2.8rem;
    margin-bottom: 12px;
    color: var(--primary);
}

.empty-state h3 {
    font-size: 1.4rem;
    margin-bottom: 8px;
    color: var(--light);
}

.empty-state p {
    max-width: 500px;
    line-height: 1.6;
    font-size: 0.95rem;
}

.search-panel {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 15px;
    display: flex;
    gap: 12px;
}

.search-box {
    flex: 1;
    display: flex;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    overflow: hidden;
    min-width: 200px;
}

.search-box input {
    flex: 1;
    padding: 10px 12px;
    border: none;
    background: transparent;
    color: var(--light);
    font-size: 0.9rem;
}

.search-box input::placeholder {
    color: #95a5a6;
}

.search-box button {
    padding: 0 16px;
    background: var(--primary);
    color: white;
    border: none;
    cursor: pointer;
    transition: background 0.3s;
}

.search-box button:hover {
    background: #2980b9;
}

.stats-container {
    display: flex;
    gap: 12px;
    margin-bottom: 15px;
}

.stat-card {
    flex: 1;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.stat-card h3 {
    color: var(--primary);
    font-size: 1rem;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.stat-sub {
    font-size: 0.85rem;
    color: #bdc3c7;
    margin-top: 4px;
}

.node-detail-panel {
    position: absolute;
    top: 450px;
    left: 15px;
    width: 280px;
    background: rgba(10, 15, 30, 0.9);
    border-radius: 10px;
    padding: 15px;
    border: 1px solid rgba(52, 152, 219, 0.5);
    box-shadow: 0 0 25px rgba(52, 152, 219, 0.3);
    z-index: 100;
    display: none;
}

.node-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.node-detail-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--light);
}

.close-detail {
    background: none;
    border: none;
    color: var(--gray);
    font-size: 1.1rem;
    cursor: pointer;
}

.node-detail-thumb {
    width: 100%;
    height: 180px;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.05); 
}

.node-detail-thumb img {
    height: 180px; 
    width: auto; 
    max-width: 100%; 
}

.node-stats {
    display: flex;
    justify-content: space-between;
    margin: 12px 0;
}

.node-stat {
    text-align: center;
}

.node-stat-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
}

.node-stat-label {
    font-size: 0.75rem;
    color: #bdc3c7;
}

.node-detail-footer {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.node-detail-btn {
    flex: 1;
    padding: 7px;
    background: rgba(52, 152, 219, 0.2);
    border: none;
    border-radius: 6px;
    color: var(--primary);
    cursor: pointer;
    transition: background 0.3s;
    font-size: 0.8rem;
}

.node-detail-btn:hover {
    background: rgba(52, 152, 219, 0.4);
}

#main-network {
    width: 100%;
    height: calc(100% - 40px);
}

#detail-tree {
    width: 100%;
    height: calc(100% - 40px);
}

@media (max-width: 1200px) {
    .main-panel {
        flex-direction: column;
        height: auto;
    }
    
    .network-chart, .tree-chart {
        height: 500px;
    }
    
    .stats-container {
        flex-direction: column;
    }
    
    .main-panel.only-network .network-chart,
    .main-panel.only-tree .tree-chart {
        flex: 1;
        max-width: 100%;
        display: block;
    }
    .main-panel.only-network .tree-chart,
    .main-panel.only-tree .network-chart {
        display: none;
    }
}

@media (max-width: 768px) {
    .file-upload-container {
        flex-direction: column;
        align-items: center;
    }
    
    .header h1 {
        font-size: 1.8rem;
    }
    
    .search-panel {
        flex-direction: column;
    }
    
    #layout-select {
        width: 100%;
    }
    
    .dashboard {
        height: calc(100vh - 130px);
    }
}

