/* W5 Signals Management — Dark Glassmorphism Theme */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: #0a0a0f;
    color: #e0e0e0;
    overflow: hidden;
}

/* Nav bar */
#nav-bar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 44px;
    z-index: 2000;
    background: rgba(10, 10, 18, 0.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 24px;
}

.nav-brand {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    text-decoration: none;
    letter-spacing: -0.3px;
}
.nav-brand span { color: #64b5f6; font-weight: 400; }

.nav-links { display: flex; gap: 4px; margin-left: auto; }
.nav-links a {
    color: #888;
    text-decoration: none;
    font-size: 13px;
    padding: 6px 14px;
    border-radius: 6px;
    transition: all 0.15s;
}
.nav-links a:hover { color: #ccc; background: rgba(255,255,255,0.05); }
.nav-links a.active { color: #64b5f6; background: rgba(100,181,246,0.1); }

/* App container */
#app-container {
    position: absolute;
    top: 44px; left: 0; right: 0; bottom: 0;
    display: flex;
}

/* Left Panel */
#panel {
    width: 380px;
    min-width: 380px;
    background: rgba(15, 15, 25, 0.92);
    backdrop-filter: blur(12px);
    border-right: 1px solid rgba(255,255,255,0.06);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    z-index: 1000;
}
#panel::-webkit-scrollbar { width: 4px; }
#panel::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

.panel-section {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

/* Summary chips */
.summary-row {
    display: flex;
    gap: 8px;
}
.summary-chip {
    flex: 1;
    background: rgba(255,255,255,0.04);
    border-radius: 8px;
    padding: 10px 8px;
    text-align: center;
}
.chip-val {
    font-size: 20px;
    font-weight: 600;
    color: #fff;
    display: block;
}
.chip-val.has-data { color: #66bb6a; }
.chip-label {
    font-size: 10px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

/* Filters */
.filter-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}
.filter-row select, #filter-search {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    color: #e0e0e0;
    font-size: 12px;
    padding: 7px 10px;
    border-radius: 6px;
    outline: none;
    transition: border-color 0.15s;
}
.filter-row select { flex: 1; cursor: pointer; }
.filter-row select option { background: #1a1a2e; }
#filter-search {
    width: 100%;
    font-size: 12px;
}
.filter-row select:focus, #filter-search:focus {
    border-color: rgba(100,181,246,0.4);
}

/* Site List */
.site-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px !important;
    min-height: 200px;
}
.site-list::-webkit-scrollbar { width: 3px; }
.site-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.site-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
    margin-bottom: 2px;
}
.site-card:hover { background: rgba(255,255,255,0.05); }
.site-card.selected { background: rgba(100,181,246,0.12); }

.site-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-top: 4px;
    flex-shrink: 0;
}
.site-dot.has-data { background: #66bb6a; }
.site-dot.no-data { background: #555; }

.site-info { flex: 1; min-width: 0; }
.site-ref {
    font-size: 13px;
    font-weight: 500;
    color: #e0e0e0;
}
.site-name {
    font-size: 11px;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.site-tags {
    display: flex;
    gap: 4px;
    margin-top: 3px;
}
.site-tag {
    font-size: 9px;
    padding: 1px 6px;
    border-radius: 3px;
    background: rgba(255,255,255,0.06);
    color: #999;
}
.site-tag.route { color: #64b5f6; background: rgba(100,181,246,0.1); }
.site-tag.data-tag { color: #66bb6a; background: rgba(102,187,106,0.1); }

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

/* Detail Panel */
.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}
.detail-header h3 {
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    line-height: 1.3;
    flex: 1;
}
.close-btn {
    background: none;
    border: none;
    color: #888;
    font-size: 20px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}
.close-btn:hover { color: #e53935; }

.detail-meta { margin-bottom: 12px; }
.meta-row {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    padding: 4px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.meta-row span:first-child { color: #888; }
.meta-row span:last-child { color: #e0e0e0; font-weight: 500; }

/* File list in detail */
.detail-files { margin-bottom: 12px; }
.file-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    background: rgba(255,255,255,0.03);
    border-radius: 6px;
    margin-bottom: 4px;
    font-size: 12px;
}
.file-info { flex: 1; }
.file-name { color: #e0e0e0; font-weight: 500; }
.file-meta { color: #666; font-size: 10px; margin-top: 1px; }
.file-actions { display: flex; gap: 4px; }
.file-btn {
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.04);
    color: #aaa;
    cursor: pointer;
    transition: all 0.15s;
}
.file-btn:hover { background: rgba(100,181,246,0.15); color: #64b5f6; border-color: rgba(100,181,246,0.3); }
.file-btn.delete:hover { background: rgba(239,83,80,0.15); color: #ef5350; border-color: rgba(239,83,80,0.3); }

/* Upload */
.upload-area { text-align: center; }
.upload-btn {
    display: inline-block;
    padding: 8px 20px;
    background: rgba(100,181,246,0.12);
    border: 1px solid rgba(100,181,246,0.25);
    color: #64b5f6;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
}
.upload-btn:hover { background: rgba(100,181,246,0.2); }

/* WRI Viewer */
#wri-content {
    max-height: 400px;
    overflow-y: auto;
    font-size: 11px;
}
#wri-content::-webkit-scrollbar { width: 3px; }
#wri-content::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.wri-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}
.wri-table th {
    text-align: left;
    padding: 5px 8px;
    color: #888;
    font-weight: 500;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    position: sticky;
    top: 0;
    background: rgba(15,15,25,0.98);
}
.wri-table td {
    padding: 4px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    color: #ccc;
}
.wri-table tr:hover td { background: rgba(255,255,255,0.03); }

.wri-chart-container {
    height: 180px;
    margin-bottom: 10px;
}

/* Map */
#map {
    flex: 1;
    z-index: 1;
}

/* Leaflet popup overrides */
.leaflet-popup-content-wrapper {
    background: rgba(20, 20, 35, 0.95) !important;
    color: #e0e0e0 !important;
    border-radius: 8px !important;
    border: 1px solid rgba(255,255,255,0.1) !important;
    backdrop-filter: blur(8px) !important;
}
.leaflet-popup-tip { background: rgba(20, 20, 35, 0.95) !important; }
.leaflet-popup-content { font-size: 12px !important; }

/* No results */
.no-results {
    text-align: center;
    padding: 30px 10px;
    color: #555;
    font-size: 12px;
}
