/* ==========================================================================
   Medan Alert Hub (메단알림) - Premium Desktop Dashboard & Glassmorphism Design
   ========================================================================== */

/* Google Fonts Import */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@300;400;500;600;700;800&display=swap');

/* CSS Custom Properties & Design Tokens */
:root {
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;

  /* Color Palette (Deep Space & Vibrant Neons) */
  --bg-primary: #070913;
  --bg-secondary: #0b0e1d;
  --bg-radial: radial-gradient(circle at 50% 50%, #161e38 0%, #070913 100%);
  
  --glass-bg: rgba(14, 20, 40, 0.65);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-border-glow: rgba(99, 102, 241, 0.25);
  --glass-highlight: rgba(255, 255, 255, 0.03);

  /* Neon Status Colors */
  --color-danger: #ef4444;
  --color-danger-glow: rgba(239, 68, 68, 0.4);
  --color-warning: #f59e0b;
  --color-warning-glow: rgba(245, 158, 11, 0.4);
  --color-info: #10b981;
  --color-info-glow: rgba(16, 185, 129, 0.4);
  --color-accent: #6366f1;
  --color-accent-glow: rgba(99, 102, 241, 0.4);
  --color-cyan: #06b6d4;
  --color-cyan-glow: rgba(6, 182, 212, 0.4);

  /* Typography Colors */
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;

  /* Spacing & Radii */
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 8px;
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-neon: 0 10px 30px rgba(0, 0, 0, 0.4), 0 0 1px 1px var(--glass-border);
}

/* Reset & Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  background-image: var(--bg-radial);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Background Ambient Glows */
body::before, body::after {
  content: '';
  position: absolute;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  filter: blur(160px);
  z-index: -1;
  pointer-events: none;
  opacity: 0.2;
}

body::before {
  background: var(--color-accent);
  top: 5%;
  left: 5%;
  animation: pulse-glow-left 15s infinite alternate;
}

body::after {
  background: var(--color-cyan);
  bottom: 5%;
  right: 5%;
  animation: pulse-glow-right 12s infinite alternate-reverse;
}

@keyframes pulse-glow-left {
  0% { transform: scale(1) translate(0, 0); opacity: 0.15; }
  100% { transform: scale(1.2) translate(80px, 40px); opacity: 0.3; }
}
@keyframes pulse-glow-right {
  0% { transform: scale(1) translate(0, 0); opacity: 0.15; }
  100% { transform: scale(1.2) translate(-80px, -40px); opacity: 0.3; }
}

/* App Wrapper Container */
.app-container {
  width: 100%;
  max-width: 500px; /* Mobile Default */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: rgba(7, 9, 19, 0.85);
  backdrop-filter: blur(16px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
  border-left: 1px solid var(--glass-border);
  border-right: 1px solid var(--glass-border);
  position: relative;
  padding-bottom: 74px; /* Space for mobile bottom bar */
}

/* Header (Mobile Layout) */
header {
  padding: 18px 20px;
  background: rgba(11, 14, 29, 0.4);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-section svg {
  width: 28px;
  height: 28px;
  color: var(--color-accent);
  filter: drop-shadow(0 0 6px var(--color-accent-glow));
}

.logo-title {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #ffffff 40%, #a5b4fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-subtitle {
  font-size: 10px;
  color: var(--color-accent);
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.weather-header-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--glass-highlight);
  border: 1px solid var(--glass-border);
  padding: 6px 12px;
  border-radius: 30px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.weather-header-badge:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Sidebar navigation element (desktop only, hidden on mobile) */
.sidebar-logo-container {
  display: none;
}

/* Navigation Bottom Bar (Mobile Default) */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 500px;
  height: 70px;
  background: rgba(8, 11, 23, 0.94);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 0 10px;
  z-index: 100;
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.5);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  width: 20%;
  height: 100%;
  transition: var(--transition-smooth);
  font-family: var(--font-body);
  position: relative;
}

.nav-item svg {
  width: 20px;
  height: 20px;
  margin-bottom: 4px;
  transition: var(--transition-smooth);
  stroke-width: 2;
}

.nav-item span {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: -0.2px;
  transition: var(--transition-smooth);
}

.nav-item:hover {
  color: var(--text-main);
}

.nav-item.active {
  color: var(--color-accent);
}

.nav-item.active svg {
  color: var(--color-accent);
  filter: drop-shadow(0 0 5px var(--color-accent-glow));
  transform: translateY(-2px);
}

.nav-item.active span {
  color: var(--text-main);
  font-weight: 700;
}

.nav-item.active::after {
  content: '';
  position: absolute;
  top: 0;
  width: 24px;
  height: 3px;
  background: var(--color-accent);
  border-radius: 0 0 4px 4px;
  box-shadow: 0 2px 10px var(--color-accent-glow);
}

/* Main Content Area */
main {
  flex: 1;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}

.tab-content {
  display: none;
  animation: fadeIn 0.4s ease forwards;
}

.tab-content.active {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

/* Typography styles */
h2 {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-desc {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* Premium Glassmorphism Card Style */
.glass-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-neon);
  position: relative;
  overflow: hidden;
  transition: var(--transition-smooth);
}

.glass-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 100%;
  background: linear-gradient(180deg, var(--glass-highlight) 0%, transparent 100%);
  pointer-events: none;
}

.glass-card:hover {
  border-color: var(--glass-border-glow);
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(99, 102, 241, 0.1), 0 0 1px 1px var(--glass-border-glow);
}

/* Summary Safety Widget */
.summary-widget {
  display: flex;
  gap: 14px;
  align-items: center;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(6, 182, 212, 0.05) 100%);
  border: 1px solid rgba(99, 102, 241, 0.25);
}

.summary-icon {
  background: rgba(99, 102, 241, 0.20);
  width: 46px;
  height: 46px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-accent);
  filter: drop-shadow(0 0 6px var(--color-accent-glow));
}

.summary-text p {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
}

.summary-text span {
  font-size: 12px;
  color: var(--text-muted);
}

/* Alert Timelines and timelines items */
.alert-card {
  border-left: 5px solid var(--color-accent);
}
.alert-card.danger {
  border-left-color: var(--color-danger);
}
.alert-card.warning {
  border-left-color: var(--color-warning);
}
.alert-card.info {
  border-left-color: var(--color-info);
}

.alert-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.alert-category-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 20px;
  text-transform: uppercase;
}

.alert-category-badge.danger {
  background: rgba(239, 68, 68, 0.12);
  color: var(--color-danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.alert-category-badge.warning {
  background: rgba(245, 158, 11, 0.12);
  color: var(--color-warning);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.alert-category-badge.info {
  background: rgba(16, 185, 129, 0.12);
  color: var(--color-info);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.alert-time {
  font-size: 11.5px;
  color: var(--text-dim);
  font-weight: 600;
}

.alert-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
  line-height: 1.4;
}

.alert-translation {
  font-size: 14px;
  color: #e5e7eb;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  border-left: 3px solid rgba(255, 255, 255, 0.2);
}

.alert-original {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
  display: none;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  animation: fadeIn 0.3s ease;
}

.alert-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
}

.original-toggle-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: var(--transition-smooth);
}

.original-toggle-btn:hover {
  color: var(--text-main);
}

.original-toggle-btn svg {
  width: 13px;
  height: 13px;
  transition: var(--transition-smooth);
}

.original-toggle-btn.open svg {
  transform: rotate(180deg);
}

.alert-meta-location {
  font-size: 11.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
}

.alert-meta-location svg {
  width: 13px;
  height: 13px;
  color: var(--color-accent);
}

/* Category Filter Chips */
.feed-filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 4px;
}
.feed-filters::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  background: var(--glass-highlight);
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
  padding: 7px 15px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
  white-space: nowrap;
  font-family: var(--font-body);
}

.filter-chip:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text-main);
}

.filter-chip.active {
  background: var(--color-accent);
  color: white;
  border-color: var(--color-accent);
  box-shadow: 0 0 12px var(--color-accent-glow);
}

/* Weather Widget style */
.weather-card {
  background: linear-gradient(135deg, rgba(16, 22, 42, 0.8) 0%, rgba(7, 9, 19, 0.9) 100%);
  border: 1px solid rgba(6, 182, 212, 0.2);
  padding: 22px;
}

.weather-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.weather-info {
  display: flex;
  flex-direction: column;
}

.weather-location {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
}

.weather-temp {
  font-size: 42px;
  font-family: var(--font-heading);
  font-weight: 800;
  line-height: 1;
  background: linear-gradient(135deg, #ffffff 40%, #c7d2fe 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: flex-start;
  margin: 6px 0;
}

.weather-temp span {
  font-size: 22px;
  font-weight: 600;
}

.weather-condition {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}

.weather-big-icon {
  font-size: 46px;
  filter: drop-shadow(0 0 10px rgba(99, 102, 241, 0.4));
  animation: float-icon 4s infinite alternate;
}

@keyframes float-icon {
  0% { transform: translateY(0); }
  100% { transform: translateY(-6px); }
}

.weather-details {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.weather-detail-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.weather-detail-label {
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.weather-detail-value {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 2px;
}

/* Earthquake banners and grids */
.eq-alert-banner {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.15) 0%, rgba(239, 68, 68, 0.04) 100%);
  border: 1px solid rgba(239, 68, 68, 0.35);
  box-shadow: 0 0 25px rgba(239, 68, 68, 0.1);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.eq-alert-header {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--color-danger);
  font-weight: 800;
  font-size: 15.5px;
}

.eq-alert-header svg {
  width: 22px;
  height: 22px;
  animation: pulse-eq 1.5s infinite;
}

@keyframes pulse-eq {
  0% { transform: scale(1); filter: drop-shadow(0 0 0px var(--color-danger)); }
  50% { transform: scale(1.1); filter: drop-shadow(0 0 6px var(--color-danger)); }
  100% { transform: scale(1); filter: drop-shadow(0 0 0px var(--color-danger)); }
}

.eq-alert-details {
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-md);
  padding: 14px;
  border: 1px solid rgba(239, 68, 68, 0.15);
}

.eq-detail-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 6px;
}
.eq-detail-row:last-child { margin-bottom: 0; }
.eq-detail-row .label { color: var(--text-muted); }
.eq-detail-row .value { color: var(--text-main); font-weight: 700; }
.eq-detail-row .value.danger-text { color: var(--color-danger); }

.eq-map-btn {
  background: var(--color-danger);
  border: none;
  color: white;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: var(--transition-smooth);
  width: 100%;
}
.eq-map-btn:hover {
  background: #dc2626;
  box-shadow: 0 0 12px var(--color-danger-glow);
}

/* Earthquake list cards */
.eq-list-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.eq-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
}

.eq-mag-badge {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.eq-mag-badge.danger { background: rgba(239, 68, 68, 0.12); border-color: rgba(239, 68, 68, 0.35); }
.eq-mag-badge.danger .mag-num { color: var(--color-danger); }
.eq-mag-badge.warning { background: rgba(245, 158, 11, 0.12); border-color: rgba(245, 158, 11, 0.35); }
.eq-mag-badge.warning .mag-num { color: var(--color-warning); }
.eq-mag-badge.info { background: rgba(16, 185, 129, 0.12); border-color: rgba(16, 185, 129, 0.35); }
.eq-mag-badge.info .mag-num { color: var(--color-info); }

.mag-num { font-size: 18px; font-weight: 800; font-family: var(--font-heading); }
.mag-label { font-size: 8px; color: var(--text-dim); font-weight: 700; text-transform: uppercase; }

.eq-item-content { flex: 1; min-width: 0; }
.eq-item-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}
.eq-item-meta {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.eq-badge-regional {
  background: rgba(99, 102, 241, 0.15);
  color: var(--color-accent);
  font-size: 9px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid rgba(99, 102, 241, 0.2);
}

/* AI Simulator Interface */
.simulator-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.preset-selector {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.preset-label { font-size: 11.5px; color: var(--text-muted); font-weight: 700; text-transform: uppercase; }
.preset-chips { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.preset-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
  padding: 9px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--font-body);
}
.preset-btn:hover { background: rgba(255, 255, 255, 0.08); color: var(--text-main); }
.preset-btn.active { background: rgba(99, 102, 241, 0.15); border-color: var(--color-accent); color: #a5b4fc; }

.raw-textarea {
  width: 100%;
  height: 120px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 13px;
  resize: none;
  outline: none;
  transition: var(--transition-smooth);
}
.raw-textarea:focus { border-color: var(--color-accent); box-shadow: 0 0 10px rgba(99, 102, 241, 0.15); }

.sim-run-btn {
  background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-cyan) 100%);
  border: none;
  color: white;
  padding: 12px;
  border-radius: var(--radius-md);
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.25);
  transition: var(--transition-smooth);
}
.sim-run-btn:hover { box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45); transform: translateY(-1px); }

/* Loader simulation */
.ai-loader {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px 0;
  gap: 14px;
}
.ai-pulse-sphere {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--color-accent) 0%, transparent 70%);
  position: relative;
  animation: pulse-sphere 1.4s infinite ease-in-out;
}
.ai-pulse-sphere::before {
  content: ''; position: absolute; top: 4px; left: 4px; right: 4px; bottom: 4px;
  border-radius: 50%; border: 2px solid var(--color-cyan); border-top-color: transparent;
  animation: spin 0.8s infinite linear;
}
.loader-status-text { font-size: 12.5px; color: var(--text-muted); font-weight: 600; text-align: center; }

.telegram-mock-toast {
  display: flex;
  gap: 10px;
  background: rgba(14, 165, 233, 0.12);
  border: 1px solid rgba(14, 165, 233, 0.25);
  padding: 12px 14px;
  border-radius: var(--radius-md);
  margin-top: 14px;
  font-size: 12.5px;
  color: #e0f2fe;
}
.telegram-mock-toast svg { width: 18px; height: 18px; color: #38bdf8; flex-shrink: 0; }

/* Emergency Contact Tab */
.search-container { position: relative; }
.search-input {
  width: 100%;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  padding: 12px 16px 12px 42px;
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
  transition: var(--transition-smooth);
}
.search-input:focus { border-color: var(--color-accent); box-shadow: var(--shadow-neon); }
.search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-dim); width: 18px; height: 18px; }

.contact-category-tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.contact-category-tabs::-webkit-scrollbar { display: none; }

.contact-item-card { padding: 18px; }
.contact-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.contact-name { font-size: 15px; font-weight: 700; color: var(--text-main); }
.contact-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.contact-dept-tag { font-size: 9px; font-weight: 800; padding: 2px 7px; border-radius: 4px; text-transform: uppercase; }
.contact-dept-tag.emergency { background: rgba(239, 68, 68, 0.12); color: var(--color-danger); border: 1px solid rgba(239, 68, 68, 0.2); }
.contact-dept-tag.medical { background: rgba(6, 182, 212, 0.12); color: var(--color-cyan); border: 1px solid rgba(6, 182, 212, 0.2); }
.contact-dept-tag.infrastructure { background: rgba(245, 158, 11, 0.12); color: var(--color-warning); border: 1px solid rgba(245, 158, 11, 0.2); }
.contact-dept-tag.community { background: rgba(99, 102, 241, 0.12); color: var(--color-accent); border: 1px solid rgba(99, 102, 241, 0.2); }

.contact-actions { display: flex; gap: 8px; margin-top: 14px; }
.action-btn {
  flex: 1; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--glass-border);
  color: var(--text-main); padding: 8px 10px; border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: var(--transition-smooth); text-decoration: none; font-family: var(--font-body);
}
.action-btn:hover { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.15); }
.action-btn.call-btn { background: rgba(16, 185, 129, 0.1); border-color: rgba(16, 185, 129, 0.2); color: #34d399; }
.action-btn.call-btn:hover { background: rgba(16, 185, 129, 0.18); border-color: var(--color-info); box-shadow: 0 0 8px var(--color-info-glow); }
.action-btn svg { width: 14px; height: 14px; }

/* Telegram Tutorial elements */
.guide-container { display: flex; flex-direction: column; gap: 14px; }
.guide-step { display: flex; gap: 14px; padding: 18px; }
.step-num {
  width: 26px; height: 26px; border-radius: 50%; background: var(--color-accent);
  color: white; font-size: 13px; font-weight: 800; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; box-shadow: 0 0 10px var(--color-accent-glow);
}
.step-title { font-size: 14.5px; font-weight: 700; color: var(--text-main); margin-bottom: 4px; }
.step-desc { font-size: 12.5px; color: var(--text-muted); line-height: 1.5; }

.code-header {
  display: flex; justify-content: space-between; align-items: center; background: rgba(0, 0, 0, 0.5);
  padding: 8px 14px; border-top-left-radius: var(--radius-sm); border-top-right-radius: var(--radius-sm);
  border: 1px solid var(--glass-border); border-bottom: none; font-size: 11px; font-weight: 600; color: var(--text-muted);
}
.copy-code-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; display: flex; align-items: center; gap: 4px; font-size: 11px; transition: var(--transition-smooth); }
.copy-code-btn:hover { color: var(--text-main); }
.copy-code-btn svg { width: 12px; height: 12px; }
.code-box {
  margin: 0; padding: 14px; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--glass-border);
  border-bottom-left-radius: var(--radius-sm); border-bottom-right-radius: var(--radius-sm);
  overflow-x: auto; font-family: 'Courier New', Courier, monospace; font-size: 11px; color: #a5b4fc; max-height: 280px;
}
.code-box::-webkit-scrollbar { height: 6px; }
.code-box::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 4px; }

/* Epistemic detail modal */
.modal-overlay {
  display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(8px); z-index: 200;
  align-items: center; justify-content: center; padding: 20px;
}
.modal-content {
  width: 100%; max-width: 420px; background: rgba(10, 14, 28, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.15); border-radius: var(--radius-lg);
  box-shadow: 0 20px 40px rgba(0,0,0,0.6); padding: 22px; position: relative;
}
.modal-close { position: absolute; top: 14px; right: 14px; background: none; border: none; color: var(--text-dim); cursor: pointer; }
.modal-close:hover { color: var(--text-main); }
.modal-close svg { width: 20px; height: 20px; }
.modal-title { font-family: var(--font-heading); font-size: 18px; font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.modal-body { font-size: 13px; color: var(--text-muted); }
.modal-body table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.modal-body th, .modal-body td { padding: 8px; text-align: left; border-bottom: 1px solid rgba(255,255,255,0.05); }
.modal-body th { color: var(--text-main); font-weight: 700; }

/* Dynamic Layout Grids for Desktop layout */
.desktop-feed-grid, .desktop-sim-grid, .desktop-guide-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ==========================================================================
   🖥️ DESKTOP LAYOUT (Media Query)
   ========================================================================== */
@media (min-width: 769px) {
  body {
    padding: 20px;
    height: 100vh;
    overflow: hidden;
  }

  .app-container {
    max-width: 1280px;
    height: 92vh;
    min-height: auto;
    flex-direction: row;
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
    padding-bottom: 0;
    overflow: hidden;
    background: rgba(8, 11, 22, 0.85);
  }

  /* Morph header into Sidebar Top Logo section */
  header {
    display: none; /* Hide standard top header */
  }

  .sidebar-logo-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 30px 10px 20px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    width: 100%;
    margin-bottom: 10px;
  }

  .sidebar-logo-container svg {
    width: 44px;
    height: 44px;
    color: var(--color-accent);
    filter: drop-shadow(0 0 10px var(--color-accent-glow));
    margin-bottom: 8px;
  }

  .sidebar-logo-container h1 {
    font-family: var(--font-heading);
    font-size: 21px;
    font-weight: 800;
    background: linear-gradient(135deg, #ffffff 40%, #a5b4fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
  }

  .sidebar-logo-container span {
    font-size: 10px;
    color: var(--color-accent);
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-top: 2px;
  }

  /* Morph Bottom Bar into Elegant Left Sidebar */
  .bottom-nav {
    position: relative;
    left: 0;
    transform: none;
    width: 250px;
    height: 100%;
    max-width: none;
    background: rgba(6, 8, 17, 0.6);
    border-top: none;
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: 0;
    gap: 8px;
    z-index: 10;
    box-shadow: none;
    flex-shrink: 0;
  }

  /* Sidebar items */
  .nav-item {
    width: 90%;
    height: 48px;
    flex-direction: row;
    justify-content: flex-start;
    padding: 0 18px;
    margin: 2px auto;
    gap: 12px;
    border-radius: var(--radius-md);
    background: none;
    color: var(--text-muted);
  }

  .nav-item svg {
    width: 20px;
    height: 20px;
    margin-bottom: 0;
    stroke-width: 2;
  }

  .nav-item span {
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: -0.2px;
  }

  .nav-item:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-main);
  }

  .nav-item.active {
    background: rgba(99, 102, 241, 0.12);
    color: #a5b4fc;
    border-color: transparent;
    box-shadow: none;
  }

  .nav-item.active svg {
    color: #818cf8;
    filter: drop-shadow(0 0 6px var(--color-accent-glow));
    transform: none;
  }

  .nav-item.active span {
    color: white;
  }

  .nav-item.active::after {
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 24px;
    background: var(--color-accent);
    border-radius: 0 4px 4px 0;
    box-shadow: 0 0 8px var(--color-accent);
  }

  /* Sidebar Weather Widget at bottom */
  .sidebar-weather-footer {
    margin-top: auto;
    width: 90%;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-smooth);
  }
  .sidebar-weather-footer:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
  }
  .sidebar-weather-footer .icon { font-size: 20px; }
  .sidebar-weather-footer .info { display: flex; flex-direction: column; }
  .sidebar-weather-footer .info .label { font-size: 9px; color: var(--text-dim); text-transform: uppercase; font-weight: 700; }
  .sidebar-weather-footer .info .val { font-size: 13.5px; font-weight: 700; color: var(--text-main); }

  /* Main scroll area on Desktop */
  main {
    padding: 30px;
    overflow-y: auto;
    height: 100%;
  }

  /* --- GRID LAYOUT 1: SAFETY ALERT FEED (Command Center Grid) --- */
  .desktop-feed-grid {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 24px;
    align-items: start;
  }

  .feed-left-column {
    display: flex;
    flex-direction: column;
    gap: 18px;
  }

  .feed-right-column {
    display: flex;
    flex-direction: column;
    gap: 18px;
    position: sticky;
    top: 0;
  }

  /* --- GRID LAYOUT 2: CONTACTS TAB (CSS Grid Layout) --- */
  .contact-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  /* --- GRID LAYOUT 3: AI SIMULATOR TAB (Side-by-Side) --- */
  .desktop-sim-grid {
    display: grid;
    grid-template-columns: 1fr 1.1fr;
    gap: 24px;
    align-items: start;
  }

  /* --- GRID LAYOUT 4: TELEGRAM BUILD GUIDE (Side-by-Side) --- */
  .desktop-guide-grid {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 24px;
    align-items: start;
  }
  .code-box {
    max-height: 480px; /* Expand code height on desktop screen */
  }
}

/* Animations and utility classes */
.new-alert-anim {
  animation: alertPulseIn 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes alertPulseIn {
  0% { opacity: 0; transform: scale(0.95) translateY(-20px); filter: brightness(1.8); }
  50% { filter: brightness(1.3); }
  100% { opacity: 1; transform: scale(1) translateY(0); filter: brightness(1); }
}

.text-danger { color: var(--color-danger); }
.text-warning { color: var(--color-warning); }
.text-info { color: var(--color-info); }
.bold { font-weight: 700; }
.text-center { text-align: center; }

/* CCTV Viewport styling */
.cctv-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 769px) {
  .cctv-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
.cctv-viewport {
  background: #000;
  height: 200px;
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
  border: 1px solid var(--glass-border);
  box-shadow: 0 10px 20px rgba(0,0,0,0.5);
}
.cctv-overlay-rec {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(0,0,0,0.7);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 5px;
  color: white;
  letter-spacing: 0.5px;
  z-index: 5;
}
.cctv-dot {
  width: 7px;
  height: 7px;
  background: var(--color-danger);
  border-radius: 50%;
  animation: blink 1s infinite alternate;
}
@keyframes blink {
  0% { opacity: 0.2; }
  100% { opacity: 1; }
}
.cctv-overlay-title {
  position: absolute;
  bottom: 12px;
  left: 12px;
  color: white;
  font-size: 13.5px;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0,0,0,0.9);
  z-index: 5;
}
.cctv-overlay-time {
  position: absolute;
  top: 12px;
  right: 12px;
  color: #a3e635; /* Neon green */
  font-family: monospace;
  font-size: 11px;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0,0,0,0.9);
  z-index: 5;
}
.cctv-static-lines {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.2) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.03), rgba(0, 255, 0, 0.01), rgba(0, 0, 255, 0.03));
  background-size: 100% 4px, 3px 100%;
  pointer-events: none;
  opacity: 0.45;
  z-index: 2;
}
.cctv-play-btn {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(99, 102, 241, 0.85);
  border: none;
  color: white;
  padding: 10px 18px;
  border-radius: 30px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition-smooth);
  z-index: 3;
  box-shadow: 0 0 15px rgba(99,102,241,0.4);
}
.cctv-play-btn:hover {
  background: var(--color-accent);
  box-shadow: 0 0 20px var(--color-accent-glow);
  transform: translate(-50%, -50%) scale(1.05);
}
.cctv-play-btn svg {
  width: 14px;
  height: 14px;
}

/* Dynamic Safety Action Briefing Card Styles */
.safety-briefing-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 769px) {
  .safety-briefing-grid {
    grid-template-columns: 1fr 1fr;
  }
}
