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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
    background: #111;
}

/* Map: fullscreen base layer */
#map {
    position: fixed;
    top: 0; left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
}

/* Navbar */
#navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 56px;
    background: rgba(12, 13, 17, 0.97);
    border-bottom: 1px solid rgba(0, 212, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 2000;
}

#navbar-left  { display: flex; align-items: baseline; gap: 12px; }
#navbar h1    { font-size: 18px; font-weight: 700; color: #00d4ff; letter-spacing: -0.3px; }
.nav-subtitle { font-size: 12px; color: #555; }

#status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #888;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #00ff64;
    box-shadow: 0 0 8px rgba(0, 255, 100, 0.6);
    flex-shrink: 0;
}

/* Sidebar */
#sidebar {
    position: fixed;
    top: 56px; left: 0;
    width: 300px;
    height: calc(100vh - 56px);
    background: rgba(14, 16, 20, 0.97);
    border-right: 1px solid rgba(255, 255, 255, 0.07);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Tab bar */
.tab-bar {
    display: flex;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.tab-btn {
    flex: 1;
    padding: 13px 4px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: #555;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
    white-space: nowrap;
}
.tab-btn:hover  { color: #bbb; }
.tab-btn.active { color: #00d4ff; border-bottom-color: #00d4ff; }

/* Tab content */
.tab-content {
    display: none;
    flex-direction: column;
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    gap: 10px;
}
.tab-content.active { display: flex; }

.tab-hint {
    font-size: 11px;
    color: #444;
    line-height: 1.5;
    padding: 4px 0;
}

/* Cards */
.info-card,
.result-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    padding: 12px 14px;
}

.card-label {
    font-size: 10px;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 6px;
}

.card-value { font-size: 13px; color: #ddd; font-weight: 500; }
.card-sub   { font-size: 11px; color: #555; margin-top: 3px; }

/* PCI Score */
.pci-row    { display: flex; align-items: baseline; gap: 5px; }
.pci-number { font-size: 44px; font-weight: 700; line-height: 1; }
.pci-denom  { font-size: 18px; color: #333; }

/* Condition pill */
.condition-pill {
    display: inline-block;
    font-size: 16px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
}

/* Condition colors */
.condition-excellent { color: #00ff64; }
.condition-good      { color: #7cfc00; }
.condition-fair      { color: #ffd700; }
.condition-poor      { color: #ff8c00; }
.condition-critical  { color: #ff4444; }

/* Street View thumbnail */
#sv-thumb-wrap {
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: #0a0a0a;
    line-height: 0;
}

#sv-thumbnail {
    width: 100%;
    height: 160px;
    object-fit: cover;
    display: block;
}

/* Loading */
.loading-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: #00d4ff;
    padding: 4px 0;
}
.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(0, 212, 255, 0.25);
    border-top-color: #00d4ff;
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
    flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Sidebar action buttons */
.action-btn {
    width: 100%;
    padding: 10px 14px;
    background: rgba(0, 212, 255, 0.08);
    color: #00d4ff;
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    text-align: center;
}
.action-btn:hover  { background: rgba(0, 212, 255, 0.16); }
.action-btn.active {
    background: rgba(255, 68, 68, 0.12);
    color: #ff7070;
    border-color: rgba(255, 68, 68, 0.25);
}

/* QRL Analysis details */
#analysis-details {
    background: rgba(138, 43, 226, 0.07);
    border: 1px solid rgba(138, 43, 226, 0.18);
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 12px;
}

.risk-indicator   { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.risk-emoji       { font-size: 26px; }

.probability-bar  { height: 5px; background: rgba(255,255,255,0.07); border-radius: 3px; overflow: hidden; margin-top: 3px; }
.probability-fill { height: 100%; border-radius: 3px; transition: width 0.5s ease; }

.distress-list    { list-style: none; padding: 0; margin: 6px 0; }
.distress-list li { padding: 3px 0; color: #ffa500; font-size: 11px; }
.distress-list li::before { content: "! "; }

/* Traffic tab */
.section-title {
    font-size: 10px;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 6px;
    margin-top: 4px;
}

.legend-list { display: flex; flex-direction: column; gap: 5px; }

.legend-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: #aaa;
}

.color-swatch {
    width: 20px;
    height: 5px;
    border-radius: 3px;
    flex-shrink: 0;
}

.emoji-swatch { font-size: 15px; flex-shrink: 0; }

/* Metric rows (shared) */
.metric-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.metric-label { font-size: 11px; color: #666; }
.metric-value { font-size: 11px; color: #ddd; font-weight: 600; }

/* Security tab */
.sec-group {
    border-bottom: 1px solid rgba(255,255,255,0.06);
    padding-bottom: 14px;
    margin-bottom: 14px;
}

.sec-group-title {
    font-size: 10px;
    color: #00b478;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 600;
    margin-bottom: 10px;
}

.sec-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.badge-secure   { background: rgba(0,255,100,0.12); color: #00ff64; border: 1px solid rgba(0,255,100,0.25); }
.badge-warning  { background: rgba(255,200,0,0.12);  color: #ffd700; border: 1px solid rgba(255,200,0,0.25); }
.badge-critical { background: rgba(255,68,68,0.12);  color: #ff4444; border: 1px solid rgba(255,68,68,0.25); }

.mini-bar {
    height: 4px;
    background: rgba(255,255,255,0.07);
    border-radius: 2px;
    overflow: hidden;
    margin: 3px 0 9px;
}
.mini-bar-fill { height: 100%; background: #00b478; border-radius: 2px; transition: width 0.6s ease; }

.node-grid { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.node-dot  { width: 10px; height: 10px; border-radius: 50%; cursor: default; }
.node-online   { background: #00ff64; box-shadow: 0 0 5px rgba(0,255,100,0.4); }
.node-degraded { background: #ffd700; box-shadow: 0 0 5px rgba(255,215,0,0.4); }
.node-offline  { background: #ff4444; box-shadow: 0 0 5px rgba(255,68,68,0.4); }

.threat-log { margin-top: 8px; max-height: 76px; overflow-y: auto; }
.threat-log-entry      { font-size: 10px; color: #555; padding: 2px 0; line-height: 1.4; }
.threat-log-entry.warn { color: #b89300; }
.threat-log-entry.crit { color: #cc3333; }

/* Footer note */
.footer-note {
    font-size: 10px;
    color: #3a3a3a;
    margin-top: auto;
    padding-top: 10px;
}

/* Toast notification */
.toast {
    position: fixed;
    top: 68px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 165, 0, 0.95);
    color: #fff;
    padding: 11px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    z-index: 3000;
    font-size: 13px;
    max-width: 420px;
    text-align: center;
    transition: opacity 0.3s;
}

/* Responsive */
@media (max-width: 600px) {
    #sidebar {
        width: 100vw;
        height: 48vh;
        top: auto;
        bottom: 0;
        border-right: none;
        border-top: 1px solid rgba(255,255,255,0.08);
    }
}
