* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Segoe UI', Tahoma, sans-serif; display: flex; height: 100vh; overflow: hidden; }

#sidebar {
    width: 330px;
    background: #1a1a2e;
    color: #eee;
    padding: 20px;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0,0,0,0.3);
    flex-shrink: 0;
}

#map { flex: 1; height: 100vh; }

h1 { font-size: 1.3em; margin-bottom: 4px; color: #3498db; }
.subtitle { color: #888; font-size: 0.8em; margin-bottom: 18px; }

.input-group { margin-bottom: 14px; }
.input-group label { display: block; font-size: 0.85em; color: #aaa; margin-bottom: 4px; }
.input-group input {
    width: 100%; padding: 8px 10px; border: 1px solid #333; border-radius: 5px;
    background: #16213e; color: #fff; font-size: 0.9em;
}
.input-group input:focus { border-color: #3498db; outline: none; }
.coords-display { font-size: 0.75em; color: #2ecc71; margin-top: 3px; min-height: 14px; }

button {
    width: 100%; padding: 10px; margin-top: 6px; border: none; border-radius: 5px;
    font-size: 0.95em; font-weight: bold; cursor: pointer; transition: opacity 0.2s;
}
#find-route-btn { background: #3498db; color: #fff; }
#find-route-btn:hover { background: #2980b9; }
#clear-btn { background: #444; color: #ccc; }
#clear-btn:hover { background: #555; }

.results-panel { margin-top: 16px; }
.result-card {
    background: #16213e; border-radius: 8px; padding: 14px; margin-top: 10px;
    border-left: 4px solid #3498db;
}
.result-card h3 { font-size: 1.1em; margin-bottom: 10px; }
.result-stat { display: flex; justify-content: space-between; font-size: 0.85em; margin: 4px 0; color: #ccc; }
.result-stat b { color: #fff; }
.error { color: #e74c3c; padding: 10px; }

.legend { margin-top: 20px; padding-top: 14px; border-top: 1px solid #333; }
.legend h3 { font-size: 0.9em; color: #aaa; margin-bottom: 8px; }
.legend-item { font-size: 0.8em; margin: 4px 0; display: flex; align-items: center; }
.export-section {
    margin-top: 12px; padding: 10px;
    background: rgba(52, 152, 219, 0.08); border-radius: 8px;
}
.export-section h3 { font-size: 14px; margin: 0 0 8px 0; color: #3498db; }
.export-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.export-btn {
    display: inline-block; padding: 6px 12px; font-size: 12px;
    color: #fff; background: #3498db; border: none; border-radius: 4px;
    cursor: pointer; text-decoration: none; text-align: center;
}
.export-btn:hover { background: #2980b9; }
.export-btn.gmaps { background: #e67e22; }
.export-btn.gmaps:hover { background: #d35400; }
.export-btn.apple { background: #555; }
.export-btn.apple:hover { background: #333; }
.dot.src-epa { background: #9b59b6; }
.dot.src-noaa { background: #00bfff; }
.dot.src-usgs { background: #2980b9; }
.dot.src-ncdot { background: #e74c3c; }
.dot.src-ncgs { background: #e67e22; }
.dot.src-ncem { background: #16a085; }
.dot.src-irwin { background: #c0392b; }

.data-status {
    font-size: 11px; color: #888; margin: 4px 0 10px; display: flex; align-items: center; gap: 6px;
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.status-dot.live { background: #2ecc71; box-shadow: 0 0 4px #2ecc71; animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }
.refresh-btn {
    background: #2c3e50; color: #ecf0f1; border: 1px solid #34495e;
    padding: 8px 14px; border-radius: 6px; cursor: pointer; font-size: 13px;
}
.refresh-btn:hover { background: #34495e; }
.toggle-btn {
    background: #2c3e50; color: #ecf0f1; border: 1px solid #34495e;
    padding: 8px 14px; border-radius: 6px; cursor: pointer; font-size: 13px;
    width: 100%; margin-top: 6px;
}
.toggle-btn:hover { background: #34495e; }
.toggle-btn.active { background: #e67e22; border-color: #e67e22; }
.data-count { font-size: 11px; color: #888; display: block; margin-top: 4px; }

/* Chat widget */
#chat-widget { position: fixed; bottom: 20px; right: 20px; z-index: 1000; }
#chat-toggle {
    width: 56px; height: 56px; border-radius: 50%; background: #3498db;
    color: #fff; font-size: 28px; text-align: center; line-height: 56px;
    cursor: pointer; box-shadow: 0 4px 12px rgba(0,0,0,0.3); transition: transform 0.2s;
}
#chat-toggle:hover { transform: scale(1.1); }
#chat-panel {
    display: none; position: absolute; bottom: 70px; right: 0; width: 350px;
    max-height: 500px; background: #1a1a2e; border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4); overflow: hidden;
    flex-direction: column;
}
#chat-panel.open { display: flex; }
#chat-header {
    padding: 12px 16px; background: #16213e; color: #fff; font-weight: 600;
    display: flex; justify-content: space-between; align-items: center;
}
#chat-header button { background: none; border: none; color: #fff; font-size: 18px; cursor: pointer; }
#chat-messages { flex: 1; overflow-y: auto; padding: 12px; max-height: 380px; }
.chat-msg { padding: 8px 12px; margin-bottom: 8px; border-radius: 8px; font-size: 13px; line-height: 1.4; max-width: 85%; }
.chat-msg.bot { background: #2a2a4e; color: #e0e0e0; }
.chat-msg.user { background: #3498db; color: #fff; margin-left: auto; text-align: right; }
#chat-input-group { display: flex; padding: 8px; background: #16213e; }
#chat-input {
    flex: 1; padding: 8px 12px; border: 1px solid #2a2a4e; border-radius: 6px;
    background: #0f0f23; color: #fff; font-size: 13px;
}
#chat-send {
    padding: 8px 16px; margin-left: 8px; background: #3498db; color: #fff;
    border: none; border-radius: 6px; cursor: pointer; font-weight: 600;
}
#chat-send:hover { background: #2980b9; }

.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; margin-right: 8px; }
.line { width: 24px; height: 4px; display: inline-block; margin-right: 8px; border-radius: 2px; }
.line.safe { background: #3498db; }
.line.direct { background: #e74c3c; border-top: 2px dashed #e74c3c; height: 0; border-bottom: none; border-left: none; border-right: none; }
.dot.benign { background: #2ecc71; }
.dot.mild { background: #f1c40f; }
.dot.moderate { background: #e67e22; }
.dot.severe { background: #e74c3c; }
.dot.extreme { background: #8e44ad; }
.dot.alert-tornado { background: #e74c3c; }
.dot.alert-tstorm { background: #e67e22; }
.dot.alert-flash-flood { background: #8e44ad; }
.dot.alert-flood { background: #f1c40f; }
.dot.alert-winter { background: #3498db; }
.dot.alert-other { background: #95a5a6; }

.instructions { margin-top: 16px; padding-top: 14px; border-top: 1px solid #333; }
.instructions p { font-size: 0.75em; color: #888; margin-bottom: 8px; line-height: 1.4; }

.leaflet-popup-content { font-size: 0.85em; }
