/* public/css/style.css */
:root {
    --bg-dark: #0f172a;
    --panel-bg: rgba(15, 23, 42, 0.65);
    --primary: #3b82f6;
    --accent: #10b981;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.1);
    
    /* Heatmap colors */
    --heat-low: #10b981;
    --heat-med: #f59e0b;
    --heat-high: #ef4444;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background: radial-gradient(circle at top center, #1e1b4b, var(--bg-dark));
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0;
}

.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    height: 70px;
    z-index: 100;
}

h1 { font-weight: 600; font-size: 1.5rem; letter-spacing: 0.5px; text-shadow: 0 0 10px rgba(255,255,255,0.2); }

.controls select {
    background: rgba(30, 41, 59, 0.8);
    color: var(--text-main);
    border: 1px solid var(--border);
    padding: 0.6rem 1rem;
    border-radius: 8px;
    margin-left: 1rem;
    font-family: inherit;
    outline: none;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
}

.controls select:focus { border-color: var(--primary); box-shadow: 0 0 10px rgba(59, 130, 246, 0.5); }

.dashboard {
    display: flex;
    flex: 1;
    gap: 1.5rem;
    padding: 1.5rem;
    height: calc(100vh - 70px);
}

/* Glassmorphism Panels */
.left-panel, .right-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.1);
}

.left-panel {
    flex: 2;
    padding: 1rem;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.map-container {
    width: 100%;
    height: 90%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.legend {
    display: flex;
    gap: 1.5rem;
    margin-top: 1rem;
    font-size: 0.9rem;
    background: rgba(0,0,0,0.3);
    padding: 0.5rem 1.5rem;
    border-radius: 20px;
    border: 1px solid var(--border);
}

.legend-item { display: flex; align-items: center; gap: 0.5rem; font-weight: 500; }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.dot.green { background: var(--heat-low); box-shadow: 0 0 12px var(--heat-low); }
.dot.yellow { background: var(--heat-med); box-shadow: 0 0 12px var(--heat-med); }
.dot.red { background: var(--heat-high); box-shadow: 0 0 12px var(--heat-high); animation: ui-pulse 1.5s infinite; }

/* Tooltip */
.map-tooltip {
    position: absolute;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 10px 15px;
    pointer-events: none;
    color: #fff;
    font-size: 0.9rem;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.2s, transform 0.2s;
    z-index: 50;
    min-width: 150px;
}
.map-tooltip.visible {
    opacity: 1;
    transform: translateY(-5px);
}
.map-tooltip-title { font-weight: 600; margin-bottom: 5px; font-size: 1rem; color: #fff;}
.map-tooltip-metric { display: flex; justify-content: space-between; margin-bottom: 2px;}

/* Right Panel / GUI */
.right-panel {
    flex: 1;
    min-width: 380px;
}

.chat-window {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.message {
    max-width: 90%;
    padding: 1.2rem;
    border-radius: 12px;
    animation: fadeIn 0.3s ease-out forwards;
    line-height: 1.6;
    font-size: 0.95rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message.ai {
    background: rgba(30, 58, 138, 0.2);
    border: 1px solid rgba(59, 130, 246, 0.3);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.message.ai.emergency {
    background: rgba(153, 27, 27, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
    color: #fca5a5;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.2);
}

.message.user {
    background: rgba(255, 255, 255, 0.1);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

/* Rich Response Formatting in Chat */
.dest-highlight {
    color: #60a5fa;
    font-weight: 600;
    text-shadow: 0 0 8px rgba(96, 165, 250, 0.4);
}

.crowd-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    background: rgba(0,0,0,0.3);
}
.crowd-pill.low { color: var(--heat-low); border: 1px solid var(--heat-low); box-shadow: 0 0 5px var(--heat-low);}
.crowd-pill.med { color: var(--heat-med); border: 1px solid var(--heat-med); box-shadow: 0 0 5px var(--heat-med);}
.crowd-pill.high { color: var(--heat-high); border: 1px solid var(--heat-high); box-shadow: 0 0 5px var(--heat-high); animation: ui-pulse 1.5s infinite;}

.ai-reasoning {
    display: block;
    margin-top: 10px;
    margin-bottom: 10px;
    font-style: italic;
    color: var(--text-muted);
    border-left: 2px solid var(--primary);
    padding-left: 10px;
}

.ai-alt-option {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px dashed rgba(255,255,255,0.1);
    font-size: 0.85rem;
    color: #cbd5e1;
}

.chat-input {
    display: flex;
    padding: 1rem;
    border-top: 1px solid rgba(255,255,255,0.05);
    background: rgba(0,0,0,0.3);
    border-bottom-left-radius: 16px;
    border-bottom-right-radius: 16px;
}

.chat-input input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    padding: 0.5rem;
    outline: none;
}

.chat-input input::placeholder { color: var(--text-muted); }

.chat-input button {
    background: linear-gradient(135deg, var(--primary), #1e40af);
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.4);
}

.chat-input button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 15px rgba(59, 130, 246, 0.6);
}

/* Base SVG Animations */
@keyframes high-congest-pulse {
    0% { transform: scale(1); filter: brightness(1); }
    50% { transform: scale(1.02); filter: brightness(1.3); }
    100% { transform: scale(1); filter: brightness(1); }
}

@keyframes ui-pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

@keyframes dash-flow {
    from { stroke-dashoffset: 20; }
    to { stroke-dashoffset: 0; }
}

@keyframes beacon-pulse {
    0% { r: 5; opacity: 1; }
    100% { r: 25; opacity: 0; }
}
