/* Base Styles */
:root {
    --primary: #2e7d32;
    --primary-dark: #1b5e20;
    --primary-light: #a5d6a7;
    --secondary: #388e3c;
    --accent: #7cb342;
    --danger: #d32f2f;
    --danger-light: #ef9a9a;
    --warning: #ffa000;
    --warning-light: #ffe082;
    --info: #1976d2;
    --info-light: #90caf9;
    --dark: #263238;
    --dark-light: #546e7a;
    --light: #f5f5f5;
    --text: #333;
    --text-light: #757575;
    --white: #ffffff;
    --success: #388e3c;
    --border-radius: 8px;
    --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --transition: all 0.3s ease;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f5f7f6;
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
    min-width: 1200px; /* Ensures proper desktop display at 100% zoom */
}

/* Layout */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: relative;
    width: 100%;
    overflow: hidden;
}

/* Navigation */
.navbar {
    background-color: var(--white);
    color: var(--dark);
    padding: 0.75rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 600;
}

.nav-brand i {
    color: var(--primary);
    font-size: 1.5rem;
}

.status-indicator {
    font-size: 0.64rem;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-weight: 600;
    margin-left: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-indicator.live {
    background-color: var(--success);
    color: white;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    margin-left: 2rem;
}

.nav-links a {
    color: var(--text-light);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    padding: 0.75rem 0;
    border-bottom: 2px solid transparent;
    transition: var(--transition);
    white-space: nowrap;
}

.nav-links a.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.nav-links a:hover {
    color: var(--primary);
}

.user-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.alert-btn {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 1.25rem;
    cursor: pointer;
    position: relative;
}

.alert-btn::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 8px;
    height: 8px;
    background-color: var(--danger);
    border-radius: 50%;
    border: 2px solid var(--white);
}

.user-profile img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 1.5rem;
    cursor: pointer;
}
.evac-left-btn {
  position: fixed;
  bottom: 32px;
  left: 32px;
  background: #1976d2;
  color: #fff;
  border-radius: 28px;
  padding: 12px 26px;
  font-size: 1.17rem;
  font-weight: 600;
  box-shadow: 0 5px 18px rgba(25,118,210,0.14);
  cursor: pointer;
  z-index: 1202;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: filter 0.15s;
}
.evac-left-btn:hover { filter: brightness(1.10); }

.evac-panel-drag {
  display: none;
  position: fixed;
  top: 110px;
  left: 52px;
  width: 370px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 16px 52px rgba(33,43,67,0.13);
  z-index: 1203;
  padding-bottom: 12px;
  min-height: 240px;
}

.evac-drag-header {
  cursor: move;
  background: #1976d2;
  color: #fff;
  padding: 14px 19px 12px 17px;
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}

.evac-drag-header button {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.22rem;
  cursor: pointer;
}

.evac-content {
  padding: 17px;
}

.evac-howto {
  font-size: 0.95rem;
  background: #f3f8fa;
  border-radius: 6px;
  margin-bottom: 14px;
  padding: 11px 12px;
  color: #245247;
  line-height: 1.5;
}

.evac-content form {
  margin-bottom: 11px;
}

.evac-content label {
  margin-top: 7px;
  display: block;
  font-weight: 500;
  color: #15405f;
}

.evac-content select {
  padding: 0.47rem;
  border-radius: 6px;
  border: 1px solid #dadada;
  font-size: 1rem;
  width: 100%;
  margin-bottom: 3px;
}

.evac-content button[type="button"] {
  margin-top: 14px;
  padding: 0.53rem 1.1rem;
  background: #1976d2;
  color: #fff;
  border: none;
  border-radius: 7px;
  font-size: 1rem;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.17s;
}

.evac-content button[type="button"]:hover {
  background: #0d47a1;
}

.evac-route-info {
  margin-top: 7px;
  font-size: 0.97rem;
  background: #eef3ed;
  border-radius: 5px;
  padding: 0.7rem;
  color: #263238;
  min-height: 26px;
  box-shadow: 0 0 2px 0 #aaa3;
}

/* Reduce panel width on medium screens */
@media (max-width: 1200px) {
  .evac-panel-drag {
    width: 300px !important; /* Smaller fixed width */
  }
}

/* Adapt panel and button sizes for small screens/mobile */
@media (max-width: 768px) {
  .evac-panel-drag {
    width: 90vw !important;    /* Use 90% of viewport width */
    left: 5vw !important;      /* Center horizontally with margins */
    top: 80px !important;      /* Adjust top position */
  }
  .evac-left-btn {
    bottom: 16px !important;   /* Smaller bottom margin */
    left: 16px !important;     /* More consistent left margin */
    padding: 10px 20px !important;  /* Smaller button padding */
    font-size: 1rem !important;      /* Slightly smaller font */
  }
}


/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem;
    display: grid;
    grid-template-columns: 300px 1fr 300px;
    gap: 2rem;
    max-width: 1800px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

.card {
    background-color: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 1.5rem;
    margin-bottom: 2rem;
    width: 100%;
    box-sizing: border-box;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-header h2 {
    color: var(--dark);
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    white-space: nowrap;
}

/* Alerts Section */
.alert-filters {
    display: flex;
    gap: 0.5rem;
    background-color: var(--light);
    padding: 0.25rem;
    border-radius: 20px;
}

.filter-btn {
    padding: 0.25rem 0.75rem;
    border-radius: 16px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
}

.filter-btn.active {
    background-color: var(--primary);
    color: white;
}

.alerts-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.alert-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    border-radius: var(--border-radius);
    transition: var(--transition);
    cursor: pointer;
    width: 100%;
    box-sizing: border-box;
}

.alert-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.alert-item.critical {
    background-color: var(--danger-light);
    border-left: 4px solid var(--danger);
}

.alert-item.warning {
    background-color: var(--warning-light);
    border-left: 4px solid var(--warning);
}

.alert-icon {
    width: 40px;
    height: 40px;
    background-color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    flex-shrink: 0;
}

.alert-icon i {
    color: var(--danger);
    font-size: 1.25rem;
}

.alert-item.warning .alert-icon i {
    color: var(--warning);
}

.alert-content {
    flex: 1;
    min-width: 0;
}

.alert-content h3 {
    font-size: 1rem;
    color: var(--dark);
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.alert-content p {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-bottom: 0.25rem;
}

.alert-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.75rem;
    color: var(--text-light);
    flex-wrap: wrap;
}

.alert-meta span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    white-space: nowrap;
}

.alert-action {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 1rem;
    cursor: pointer;
    margin-left: 0.5rem;
}

/* Map Section */
.map-section {
    grid-column: span 1;
}

.map-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.map-header h2 {
    margin-bottom: 0;
}

.map-controls {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.control-group label {
    font-size: 0.875rem;
    color: var(--text-light);
    font-weight: 500;
}

#time-selector {
    padding: 0.5rem;
    border-radius: 4px;
    border: 1px solid #ddd;
    background-color: var(--white);
    font-size: 0.875rem;
    min-width: 120px;
}

.download-btn {
    padding: 0.5rem 1rem;
    background-color: var(--info);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.875rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.download-btn:hover {
    background-color: #1565c0;
}

#map {
    height: 600px;
    width: 100%;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05);
}

.map-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.legend {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    white-space: nowrap;
}

.color-box {
    width: 16px;
    height: 16px;
    border-radius: 2px;
}

.color-box.high-risk {
    background-color: var(--danger);
}

.color-box.moderate-risk {
    background-color: var(--warning);
}

.color-box.low-risk {
    background-color: var(--accent);
}

.timeline-control {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.play-btn {
    padding: 0.5rem 1rem;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.875rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.timeline-slider {
    width: 200px;
    min-width: 150px;
}

.timeline-value {
    font-size: 0.875rem;
    min-width: 30px;
    text-align: center;
}

/* Insights Section */
.time-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: 4px;
    background-color: var(--light);
    font-size: 0.875rem;
    cursor: pointer;
    white-space: nowrap;
}

.insights-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.metric-card {
    background-color: var(--light);
    padding: 1rem;
    border-radius: var(--border-radius);
    position: relative;
    overflow: hidden;
}

.metric-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background-color: var(--primary-light);
}

.metric-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 0.25rem;
}

.metric-label {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.metric-trend {
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.metric-trend.up {
    color: var(--danger);
}

.metric-trend.down {
    color: var(--success);
}

.risk-factors {
    margin-top: 1.5rem;
}

.risk-factors h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--dark);
}

.factor-item {
    margin-bottom: 1rem;
}

.factor-label {
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
    color: var(--text-light);
}

.factor-bar {
    height: 6px;
    background-color: #e0e0e0;
    border-radius: 3px;
    margin-bottom: 0.25rem;
}

.factor-progress {
    height: 100%;
    border-radius: 3px;
    background-color: var(--primary);
    transition: width 0.5s ease;
}

.factor-value {
    font-size: 0.75rem;
    color: var(--text-light);
    text-align: right;
}

/* Data Sources Upload */
.data-sources-upload {
    grid-column: span 3;
}

.sources-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.source-card {
    background-color: var(--light);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.source-icon {
    margin-bottom: 1rem;
}

.source-icon i {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.source-icon h3 {
    font-size: 1rem;
    color: var(--dark);
}

.file-upload {
    position: relative;
    overflow: hidden;
    display: inline-block;
    width: 100%;
    margin-bottom: 0.5rem;
}

.file-upload input[type="file"] {
    position: absolute;
    left: 0;
    top: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.file-upload-label {
    display: block;
    padding: 0.5rem 1rem;
    background-color: var(--white);
    border: 1px dashed var(--text-light);
    border-radius: 4px;
    text-align: center;
    font-size: 0.875rem;
    transition: var(--transition);
    cursor: pointer;
}

.file-upload:hover .file-upload-label {
    background-color: #f0f0f0;
}

.upload-status {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 0.25rem;
}

.submit-all-btn {
    width: 100%;
    padding: 0.75rem;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.submit-all-btn:hover {
    background-color: var(--primary-dark);
}

/* AI Assistant */
.ai-assistant {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 350px;
    background-color: var(--white);
    border-radius: var(--border-radius);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transform: translateY(100%);
    opacity: 0;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    max-height: 70vh;
}

.ai-assistant.active {
    transform: translateY(0);
    opacity: 1;
}

.ai-header {
    padding: 1rem;
    background-color: var(--primary);
    color: white;
    border-top-left-radius: var(--border-radius);
    border-top-right-radius: var(--border-radius);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.ai-avatar {
    width: 36px;
    height: 36px;
    background-color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-avatar i {
    color: var(--primary);
    font-size: 1.25rem;
}

.ai-header h3 {
    flex: 1;
    font-size: 1rem;
    font-weight: 500;
}

.ai-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
}

.ai-messages {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.ai-message {
    max-width: 80%;
    padding: 0.75rem 1rem;
    border-radius: 18px;
    font-size: 0.875rem;
    line-height: 1.4;
}

.ai-message.user {
    align-self: flex-end;
    background-color: var(--primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.ai-message.bot {
    align-self: flex-start;
    background-color: var(--light);
    color: var(--text);
    border-bottom-left-radius: 4px;
}

.welcome-message {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.quick-questions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.quick-question {
    background-color: var(--white);
    border: 1px solid var(--primary-light);
    color: var(--primary);
    padding: 0.5rem 1rem;
    border-radius: 18px;
    font-size: 0.875rem;
    cursor: pointer;
    text-align: left;
    transition: var(--transition);
}

.quick-question:hover {
    background-color: var(--primary-light);
}

.ai-input {
    display: flex;
    padding: 0.75rem;
    border-top: 1px solid #eee;
}

.ai-input input {
    flex: 1;
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 0.875rem;
    outline: none;
}

.ai-input button {
    background-color: var(--primary);
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    margin-left: 0.5rem;
    cursor: pointer;
}

/* AI Notification */
.ai-notification {
    position: fixed;
    bottom: 8rem;
    right: 2rem;
    background-color: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    z-index: 999;
    transform: translateX(150%);
    transition: transform 0.3s ease;
    max-width: 250px;
}

.ai-notification.visible {
    transform: translateX(0);
}

.notification-bot {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.notification-text {
    font-size: 0.875rem;
    color: var(--text);
}

.ai-toggle {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: var(--transition);
}

.ai-toggle:hover {
    transform: scale(1.1);
}

/* Footer */
.footer {
    background-color: var(--dark);
    color: white;
    padding: 2rem;
    width: 100%;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    max-width: 1800px;
    margin: 0 auto;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    gap: 2rem;
}

.footer-left {
    max-width: 300px;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
}

.footer-left p {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.6;
}

.footer-right {
    display: flex;
    gap: 3rem;
    flex-wrap: wrap;
}

.system-status {
    min-width: 200px;
}

.system-status h4 {
    font-size: 0.875rem;
    margin-bottom: 1rem;
    color: rgba(255, 255, 255, 0.9);
}

.status-detail {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.status-dot.operational {
    background-color: var(--success);
}

.status-dot.backend {
    background-color: var(--info);
}

.footer-links {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.footer-links a {
    color: white;
    font-size: 1.25rem;
    opacity: 0.7;
    transition: var(--transition);
}

.footer-links a:hover {
    opacity: 1;
}

.footer-bottom {
    max-width: 1800px;
    margin: 1.5rem auto 0;
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-meta {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.footer-meta span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Responsive Design */
@media (max-width: 1400px) {
    .main-content {
        grid-template-columns: 280px 1fr;
    }
    
    .insights-section {
        grid-column: span 2;
    }
    
    .sources-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 1200px) {
    .main-content {
        padding: 1.5rem;
    }
    
    .navbar {
        padding: 0.75rem 1.5rem;
    }
}

@media (max-width: 992px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .navbar {
        padding: 0.75rem 1rem;
    }
    
    .nav-links {
        display: none;
    }
    
    .mobile-menu-btn {
        display: block;
    }
    
    .ai-assistant {
        width: 300px;
        right: 1rem;
    }
    
    .ai-toggle {
        right: 1rem;
    }
    
    .ai-notification {
        right: 1rem;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 1rem;
    }
    
    .insights-grid {
        grid-template-columns: 1fr;
    }
    
    .map-controls {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }
    
    .map-footer {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .sources-grid {
        grid-template-columns: 1fr;
    }
    
    .ai-assistant {
        width: calc(100% - 2rem);
        right: 1rem;
        bottom: 1rem;
    }
    
    .ai-toggle {
        right: 1rem;
        bottom: 1rem;
        width: 50px;
        height: 50px;
    }
    
    .ai-notification {
        right: 1rem;
        bottom: 6rem;
    }
}

@media (max-width: 480px) {
    .footer-content {
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .footer-right {
        flex-direction: column;
        gap: 1.5rem;
    }
}

const evacBtnLeft = document.getElementById('evac-left-btn');
const evacPanelLeft = document.getElementById('evac-panel-drag');
const evacClose = document.getElementById('evac-close-btn');

// Show panel, hide button
evacBtnLeft.onclick = () => {
  evacPanelLeft.style.display = 'block';
  evacBtnLeft.style.display = 'none';
};

// Close panel, show button
evacClose.onclick = () => {
  evacPanelLeft.style.display = 'none';
  evacBtnLeft.style.display = 'flex';
};

// Draggable panel logic
let isEvacDown = false, evacOffsetX, evacOffsetY;
const evacHeader = evacPanelLeft.querySelector('.evac-drag-header');

evacHeader.addEventListener('mousedown', function(e) {
  isEvacDown = true;
  evacOffsetX = e.clientX - evacPanelLeft.offsetLeft;
  evacOffsetY = e.clientY - evacPanelLeft.offsetTop;
  document.body.style.userSelect = 'none';
});
document.addEventListener('mousemove', function(e) {
  if (!isEvacDown) return;
  evacPanelLeft.style.left = (e.clientX - evacOffsetX) + 'px';
  evacPanelLeft.style.top = (e.clientY - evacOffsetY) + 'px';
  evacPanelLeft.style.right = 'unset';
});
document.addEventListener('mouseup', function() {
  isEvacDown = false;
  document.body.style.userSelect = '';
});

// Touch for mobile
evacHeader.addEventListener('touchstart', function(e) {
  isEvacDown = true;
  var touch = e.touches[0];
  evacOffsetX = touch.clientX - evacPanelLeft.offsetLeft;
  evacOffsetY = touch.clientY - evacPanelLeft.offsetTop;
}, {passive: false});
document.addEventListener('touchmove', function(e) {
  if (!isEvacDown) return;
  var touch = e.touches[0];
  evacPanelLeft.style.left = (touch.clientX - evacOffsetX) + 'px';
  evacPanelLeft.style.top = (touch.clientY - evacOffsetY) + 'px';
  evacPanelLeft.style.right = 'unset';
}, {passive: false});
document.addEventListener('touchend', function() {
  isEvacDown = false;
});
