/* 
  TerraPulse - Core CSS Design System
  Theme: Liquid Glass over Midnight Blue
*/

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

:root {
  /* Colors */
  --bg-darker: #070b13;
  --bg-dark: #0d1527;
  --bg-card: rgba(18, 28, 51, 0.5);
  --bg-card-hover: rgba(26, 39, 71, 0.7);
  --bg-glass: rgba(10, 18, 36, 0.65);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-glass-active: rgba(255, 255, 255, 0.18);
  
  --primary: #2a86ff;
  --primary-glow: rgba(42, 134, 255, 0.35);
  --accent: #7b2cbf;
  --accent-glow: rgba(123, 44, 191, 0.3);
  
  --text-primary: #f8f9fa;
  --text-secondary: #a0aec0;
  --text-muted: #64748b;
  
  /* Magnitude Colors */
  --mag-1: #0df2c9; /* <3.0 Turquoise */
  --mag-2: #c9e218; /* 3.0-4.0 Yellow-Green */
  --mag-3: #fca311; /* 4.0-5.0 Yellow/Orange */
  --mag-4: #ff5722; /* 5.0-6.0 Orange-Red */
  --mag-5: #e63946; /* >6.0 Crimson Red */
  
  --success: #2ec4b6;
  --warning: #ff9f1c;
  --danger: #e63946;
  
  /* Fonts */
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  
  /* Shadows */
  --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --shadow-glow: 0 0 15px rgba(42, 134, 255, 0.2);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-darker);
  background-image: 
    radial-gradient(at 10% 20%, rgba(42, 134, 255, 0.12) 0px, transparent 50%),
    radial-gradient(at 90% 80%, rgba(123, 44, 191, 0.1) 0px, transparent 50%),
    linear-gradient(180deg, var(--bg-darker) 0%, var(--bg-dark) 100%);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-darker);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Layout */
.app-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

/* Sidebar Navigation */
.app-sidebar {
  width: 260px;
  background: var(--bg-glass);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border-right: 1px solid var(--border-glass);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px 16px;
  z-index: 100;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  flex-shrink: 0;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  margin-bottom: 24px;
}

.app-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.logo-text h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, #ffffff 30%, #a0c4ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-text p {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.nav-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-grow: 1;
  overflow-y: auto;
  padding-right: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.nav-item i {
  font-size: 1.1rem;
  transition: transform 0.2s ease;
}

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

.nav-item:hover i {
  transform: scale(1.1);
}

.nav-item.active {
  background: rgba(42, 134, 255, 0.15);
  color: var(--primary);
  border-color: rgba(42, 134, 255, 0.25);
  box-shadow: var(--shadow-glow);
}

.sidebar-footer {
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-legal {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.sidebar-legal a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.2s ease;
  font-weight: 500;
}

.sidebar-legal a:hover {
  color: var(--primary);
  text-shadow: 0 0 8px rgba(42, 134, 255, 0.4);
}

.pro-badge-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, #7b2cbf 0%, #3a0ca3 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #ffffff;
  padding: 12px;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(123, 44, 191, 0.3);
}

.pro-badge-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(123, 44, 191, 0.5);
}

.pro-badge-btn.unlocked {
  background: linear-gradient(135deg, #00b4d8 0%, #0077b6 100%);
  box-shadow: 0 4px 15px rgba(0, 180, 216, 0.3);
}

/* Mobile Navigation (Tab Bar) */
.mobile-nav-bar {
  display: none;
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 64px;
  background: rgba(10, 18, 36, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-glass);
  z-index: 100;
  justify-content: space-around;
  align-items: center;
  padding-bottom: env(safe-area-inset-bottom);
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.65rem;
  font-weight: 600;
  flex: 1;
  height: 100%;
  cursor: pointer;
  transition: color 0.2s ease;
}

.mobile-nav-item i {
  font-size: 1.2rem;
}

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

/* Main Content Area */
.main-content {
  flex-grow: 1;
  height: 100%;
  overflow-y: auto;
  position: relative;
  display: flex;
  flex-direction: column;
  padding-bottom: 80px; /* offset for mobile bar height */
}

.screen-view {
  display: none;
  flex-direction: column;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px;
  animation: fadeIn 0.4s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
}

.screen-view.active {
  display: flex;
}

/* Header UI */
.screen-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
}

.screen-title h2 {
  font-size: 1.85rem;
  font-weight: 700;
  background: linear-gradient(135deg, #ffffff 40%, #c3daff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.screen-title p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Connection Status Badge */
.connection-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(46, 196, 182, 0.1);
  border: 1px solid rgba(46, 196, 182, 0.3);
  color: var(--success);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 20px;
}

.connection-badge.offline {
  background: rgba(230, 57, 70, 0.1);
  border-color: rgba(230, 57, 70, 0.3);
  color: var(--danger);
}

.connection-badge.live-websocket {
  background: rgba(46, 196, 182, 0.15);
  border-color: rgba(46, 196, 182, 0.6);
  box-shadow: 0 0 10px rgba(46, 196, 182, 0.25);
  animation: pulse-border-live 2s infinite alternate;
}

@keyframes pulse-border-live {
  0% { border-color: rgba(46, 196, 182, 0.4); box-shadow: 0 0 5px rgba(46, 196, 182, 0.1); }
  100% { border-color: rgba(46, 196, 182, 0.8); box-shadow: 0 0 15px rgba(46, 196, 182, 0.4); }
}

.connection-badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 6px currentColor;
  animation: connection-glow 2s infinite alternate;
}

@keyframes connection-glow {
  0% { opacity: 0.4; }
  100% { opacity: 1; }
}

/* Glass Card Component */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow-glass);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  position: relative;
  overflow: hidden;
}

.glass-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-glass-active);
}

.glass-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.15) 0%, transparent 80%);
  pointer-events: none;
}

/* Buttons */
.btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--border-glass-active);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: var(--primary);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
  background: #3e94ff;
  box-shadow: 0 0 20px rgba(42, 134, 255, 0.4);
}

.btn-danger {
  background: var(--danger);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 10px rgba(230, 57, 70, 0.2);
}

.btn-danger:hover {
  background: #ff4d5a;
  box-shadow: 0 0 20px rgba(230, 57, 70, 0.4);
}

.btn-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

/* Dashboard Layout */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 24px;
  margin-bottom: 24px;
}

.dashboard-left {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.dashboard-right {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Pulse Animation Waves */
.pulse-container {
  position: relative;
  width: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pulse-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  animation: pulse-ring-anim 3s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
  opacity: 0;
  border: 2px solid;
}

.pulse-center {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 2;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  font-weight: 800;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.pulse-center .mag-val {
  font-size: 1.8rem;
  line-height: 1.1;
}

.pulse-center .mag-lbl {
  font-size: 0.65rem;
  opacity: 0.8;
  font-weight: 500;
  text-transform: uppercase;
}

/* Magnitude Colored Items */
.m-color-1 { background-color: var(--mag-1) !important; box-shadow: 0 0 15px rgba(13, 242, 201, 0.3); color: var(--bg-darker) !important; }
.m-color-2 { background-color: var(--mag-2) !important; box-shadow: 0 0 15px rgba(201, 226, 24, 0.3); color: var(--bg-darker) !important; }
.m-color-3 { background-color: var(--mag-3) !important; box-shadow: 0 0 15px rgba(252, 163, 17, 0.3); color: var(--bg-darker) !important; }
.m-color-4 { background-color: var(--mag-4) !important; box-shadow: 0 0 15px rgba(255, 87, 34, 0.3); color: #fff !important; }
.m-color-5 { background-color: var(--mag-5) !important; box-shadow: 0 0 15px rgba(230, 57, 70, 0.3); color: #fff !important; }

.m-border-1 { border-color: var(--mag-1) !important; }
.m-border-2 { border-color: var(--mag-2) !important; }
.m-border-3 { border-color: var(--mag-3) !important; }
.m-border-4 { border-color: var(--mag-4) !important; }
.m-border-5 { border-color: var(--mag-5) !important; }

.m-text-1 { color: var(--mag-1) !important; }
.m-text-2 { color: var(--mag-2) !important; }
.m-text-3 { color: var(--mag-3) !important; }
.m-text-4 { color: var(--mag-4) !important; }
.m-text-5 { color: var(--mag-5) !important; }

/* Pulse animations */
@keyframes pulse-ring-anim {
  0% {
    transform: scale(0.35);
    opacity: 0.8;
  }
  50% {
    opacity: 0.4;
  }
  100% {
    transform: scale(1.2);
    opacity: 0;
  }
}

/* Latest Earthquake Card */
.latest-quake-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.latest-quake-info {
  flex-grow: 1;
}

.latest-quake-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--primary);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.latest-quake-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.latest-quake-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 10px;
}

.latest-quake-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.latest-quake-meta span i {
  font-size: 0.95rem;
  color: var(--primary);
}

/* Metric mini cards row */
.metric-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.metric-mini-card {
  padding: 16px;
  border-radius: 14px;
  text-align: center;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border-glass);
}

.metric-mini-card h4 {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.8px;
  margin-bottom: 6px;
}

.metric-mini-card .val {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
}

.metric-mini-card .sub-val {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

/* Mini map wrapper */
.minimap-wrapper {
  height: 250px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border-glass);
  position: relative;
}

.map-container-el {
  width: 100%;
  height: 100%;
  background: var(--bg-darker);
}

/* Map Screen Layout */
.map-screen-layout {
  position: relative;
  width: 100%;
  height: 580px;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--border-glass);
  box-shadow: var(--shadow-glass);
}

.fullscreen-map {
  width: 100%;
  height: 100%;
}

.map-floating-panel {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 1000;
  background: rgba(10, 18, 36, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 12px 16px;
  pointer-events: auto;
}

.map-legend {
  position: absolute;
  bottom: 24px;
  left: 24px;
  z-index: 1000;
  background: rgba(10, 18, 36, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.8rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.map-controls-panel {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Event List Card */
.event-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-glass);
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.event-list-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-glass-active);
  transform: translateX(3px);
}

.event-list-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-grow: 1;
  min-width: 0;
}

.event-list-mag {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.15rem;
  flex-shrink: 0;
}

.event-list-details {
  min-width: 0;
}

.event-list-details h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.event-list-details p {
  font-size: 0.75rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.event-list-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Detail View Sheet Specs */
.detail-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
  align-items: start;
}

.detail-map-panel {
  height: 240px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border-glass);
  position: relative;
}

.tech-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

.tech-table tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.tech-table tr:last-child {
  border-bottom: none;
}

.tech-table td {
  padding: 10px 0;
  font-size: 0.85rem;
}

.tech-table td.label {
  color: var(--text-secondary);
  font-weight: 500;
  width: 40%;
}

.tech-table td.value {
  color: var(--text-primary);
  font-weight: 600;
  text-align: right;
}

.tsunami-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 159, 28, 0.12);
  border: 1px solid var(--warning);
  color: var(--warning);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  margin-top: 8px;
}

/* AI Assistant Chat UI */
.ai-assistant-wrapper {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
  height: 520px;
}

.ai-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  padding-right: 20px;
}

.selected-quake-brief {
  padding: 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
}

.selected-quake-brief .brief-header {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 8px;
}

.ai-chat-area {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 400px;
}

.chat-messages {
  flex-grow: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-right: 10px;
  margin-bottom: 16px;
}

.chat-bubble {
  max-width: 80%;
  padding: 12px 18px;
  border-radius: 16px;
  font-size: 0.9rem;
  line-height: 1.5;
  animation: messageIn 0.3s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
}

.chat-bubble.assistant {
  background: rgba(42, 134, 255, 0.08);
  border: 1px solid rgba(42, 134, 255, 0.15);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}

.chat-bubble.user {
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
  box-shadow: var(--shadow-glow);
}

.assistant-typing {
  display: flex;
  gap: 4px;
  align-items: center;
  justify-content: center;
  height: 20px;
  width: 40px;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background: var(--text-secondary);
  border-radius: 50%;
  animation: typing-dot-anim 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-dot-anim {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  45% { transform: scale(1.1); opacity: 1; }
}

.suggestions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.suggestion-chip {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.suggestion-chip:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border-color: var(--border-glass-active);
}

.chat-input-wrapper {
  display: flex;
  gap: 10px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-glass);
  border-radius: 14px;
  padding: 6px 6px 6px 16px;
}

.chat-input {
  flex-grow: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  outline: none;
}

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

/* Alert System Layout */
.alerts-tab-buttons {
  display: flex;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 12px;
  margin-bottom: 20px;
}

.alert-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  padding: 6px 12px;
  transition: color 0.2s ease;
}

.alert-tab-btn.active {
  color: var(--primary);
}

.alert-tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -13px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--primary);
}

.alerts-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.alert-config-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

/* Custom sliders */
.range-slider-container {
  display: flex;
  align-items: center;
  gap: 16px;
}

.range-slider {
  -webkit-appearance: none;
  flex-grow: 1;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: 0 0 10px rgba(42, 134, 255, 0.5);
  transition: transform 0.1s ease;
}

.range-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.slider-val {
  min-width: 50px;
  font-weight: 700;
  font-size: 0.95rem;
  text-align: right;
  color: var(--primary);
}

/* Regions selection list */
.regions-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  max-height: 180px;
  overflow-y: auto;
  padding-right: 6px;
  border: 1px solid var(--border-glass);
  border-radius: 8px;
  padding: 8px;
  background: rgba(0, 0, 0, 0.15);
}

.region-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  padding: 4px;
  border-radius: 6px;
  transition: background 0.2s ease;
}

.region-checkbox-label:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.region-checkbox-label input {
  accent-color: var(--primary);
}

/* Toggle Switch */
.toggle-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.15);
  transition: .3s;
  border-radius: 24px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

input:checked + .toggle-slider {
  background-color: var(--primary);
}

input:checked + .toggle-slider:before {
  transform: translateX(22px);
}

/* Stats UI */
.stats-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.period-pills {
  display: flex;
  background: rgba(255, 255, 255, 0.05);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--border-glass);
}

.period-pill {
  padding: 6px 16px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.period-pill.active {
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-glow);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-bottom: 24px;
}

.chart-box {
  height: 240px;
  width: 100%;
  position: relative;
}

.bar-rank-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bar-rank-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.bar-rank-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 500;
}

.bar-rank-bar-bg {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  overflow: hidden;
}

.bar-rank-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  transition: width 0.4s ease;
}

/* Timeline Vertical Line */
.timeline-list {
  position: relative;
  padding-left: 28px;
  margin-top: 10px;
}

.timeline-list::before {
  content: '';
  position: absolute;
  top: 4px;
  left: 10px;
  bottom: 4px;
  width: 2px;
  background: rgba(255, 255, 255, 0.1);
}

.timeline-node {
  position: relative;
  margin-bottom: 24px;
}

.timeline-node:last-child {
  margin-bottom: 0;
}

.timeline-dot {
  position: absolute;
  left: -24px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--bg-dark);
  z-index: 2;
}

.timeline-content-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.2s ease;
}

.timeline-content-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-glass-active);
  transform: translateX(4px);
}

.timeline-content-card.main-event {
  border-left: 4px solid var(--danger);
  background: rgba(230, 57, 70, 0.04);
}

.timeline-node-info h4 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.timeline-node-info p {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.timeline-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 8px;
  vertical-align: middle;
}

.badge-main { background: var(--danger); color: white; }
.badge-replica { background: rgba(255, 255, 255, 0.1); color: var(--text-secondary); }
.badge-premonitor { background: var(--primary); color: white; }

/* Family Safe Cities Grid */
.family-cities-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 16px;
}

.family-city-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
}

.family-city-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  margin-top: 4px;
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-indicator.secure { background-color: var(--success); box-shadow: 0 0 8px var(--success); }
.status-indicator.warning { background-color: var(--warning); box-shadow: 0 0 8px var(--warning); }
.status-indicator.danger { background-color: var(--danger); box-shadow: 0 0 8px var(--danger); }

/* Global Notice Banner */
.notice-banner {
  background: rgba(46, 196, 182, 0.1);
  border: 1px solid var(--success);
  border-radius: 12px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-primary);
  margin-bottom: 24px;
  font-size: 0.9rem;
}

.notice-banner.warning-active {
  background: rgba(255, 159, 28, 0.12);
  border-color: var(--warning);
}

.notice-banner i {
  font-size: 1.3rem;
}

/* My Location Screen */
.location-metric-circle-box {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  padding: 30px 0;
}

.intensity-badge-large {
  font-size: 2.2rem;
  font-weight: 800;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255,255,255,0.1);
  margin-bottom: 12px;
  box-shadow: 0 0 25px rgba(255,255,255,0.08);
}

/* Emergency Center Layout */
.emergency-tabs {
  display: flex;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 3px;
  margin-bottom: 20px;
}

.emergency-tab-btn {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  padding: 8px;
  font-weight: 600;
  font-size: 0.85rem;
  border-radius: 8px;
  cursor: pointer;
}

.emergency-tab-btn.active {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.emergency-guide-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.guide-item {
  display: flex;
  gap: 14px;
  padding: 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-glass);
}

.guide-item i {
  font-size: 1.4rem;
  color: var(--primary);
}

.guide-text h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.guide-text p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.backpack-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.backpack-item:last-child {
  border-bottom: none;
}

.backpack-item input {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
}

.backpack-item.checked {
  text-decoration: line-through;
  color: var(--text-muted);
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(5, 8, 15, 0.8);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal-overlay.open {
  display: flex;
}

.modal-box {
  width: 90%;
  max-width: 500px;
  background: var(--bg-dark);
  border: 1px solid var(--border-glass);
  border-radius: 20px;
  padding: 32px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.6);
  position: relative;
  animation: modalIn 0.3s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
}

/* Onboarding slide css */
.onboarding-slide {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.onboarding-slide.active {
  display: flex;
}

.onboarding-icon {
  font-size: 3.5rem;
  color: var(--primary);
  margin-bottom: 24px;
  filter: drop-shadow(0 0 15px var(--primary-glow));
}

.onboarding-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.onboarding-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 30px;
}

.slide-dots {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  justify-content: center;
}

.slide-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
}

.slide-dot.active {
  background: var(--primary);
  width: 16px;
  border-radius: 4px;
}

/* Tsunami alert view */
.tsunami-bulletin-card {
  padding: 16px;
  border-radius: 12px;
  background: rgba(255, 159, 28, 0.05);
  border: 1px solid rgba(255, 159, 28, 0.25);
  margin-bottom: 12px;
}

.bulletin-header {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--warning);
  margin-bottom: 8px;
}

.bulletin-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* History search table */
.explorer-search-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.search-input-container {
  flex-grow: 1;
  position: relative;
}

.search-input-container i {
  position: absolute;
  left: 14px;
  top: 14px;
  color: var(--text-muted);
}

.search-input-container input {
  width: 100%;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 12px 16px 12px 42px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  outline: none;
  transition: all 0.2s ease;
}

.search-input-container input:focus {
  border-color: var(--primary);
  background: rgba(255,255,255,0.05);
}

/* Companion Panel (Right Drawer) */
.companion-panel {
  width: 320px;
  background: rgba(6, 10, 19, 0.95);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border-left: 1px solid var(--border-glass);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  z-index: 95;
  transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  overflow-y: auto;
  flex-shrink: 0;
}

.companion-header {
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  padding-bottom: 12px;
}

.companion-header h3 {
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-secondary);
}

.companion-header p {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Device Preview Containers */
.device-preview-box {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 24px;
}

/* iPhone Widget Simulation */
.widget-simulation {
  width: 100%;
  background: #000000;
  border-radius: 20px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.15);
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  position: relative;
}

.widget-title {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  color: rgba(255,255,255,0.6);
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.widget-content-medium {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, #0d1527 0%, #070b13 100%);
  border-radius: 12px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.05);
}

.widget-left {
  flex-grow: 1;
  min-width: 0;
}

.widget-mag-badge {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
  margin-bottom: 4px;
}

.widget-place {
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

.widget-time {
  font-size: 0.6rem;
  color: var(--text-secondary);
}

.widget-right-wave {
  width: 80px;
  height: 60px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.widget-right-wave::before {
  content: '';
  position: absolute;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1.5px dashed rgba(255, 255, 255, 0.15);
  animation: widget-pulse 2s linear infinite;
}

@keyframes widget-pulse {
  0% { transform: scale(0.6); opacity: 0.8; }
  100% { transform: scale(1.4); opacity: 0; }
}

/* Apple Watch App Simulation */
.watch-simulation {
  width: 160px;
  height: 196px;
  background: #000;
  border-radius: 28px;
  border: 5px solid #1a1a1a;
  box-shadow: 0 8px 25px rgba(0,0,0,0.8), inset 0 0 10px rgba(255,255,255,0.1);
  margin: 0 auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.watch-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.55rem;
  color: var(--text-muted);
  font-weight: 700;
  padding: 0 4px;
}

.watch-body {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 4px;
  min-width: 0;
}

.watch-mag {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 2px;
}

.watch-place {
  font-size: 0.6rem;
  color: #fff;
  font-weight: 600;
  max-width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.watch-depth {
  font-size: 0.5rem;
  color: var(--text-secondary);
}

.watch-btn {
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  border-radius: 8px;
  padding: 4px;
  font-size: 0.55rem;
  font-weight: 600;
  width: 100%;
  cursor: pointer;
  text-align: center;
}

/* Notification Toast Banner */
.notification-banner {
  position: fixed;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 420px;
  background: rgba(10, 18, 36, 0.95);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border: 1px solid var(--border-glass-active);
  box-shadow: 0 10px 30px rgba(0,0,0,0.5), 0 0 15px rgba(42, 134, 255, 0.1);
  border-radius: 16px;
  padding: 16px;
  z-index: 3000;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: top 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.notification-banner.show {
  top: 24px;
}

.notif-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.15rem;
  flex-shrink: 0;
}

.notif-details {
  flex-grow: 1;
}

.notif-details h5 {
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
}

.notif-details p {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.notif-details span {
  font-size: 0.65rem;
  color: var(--text-muted);
  display: block;
  margin-top: 2px;
}

.notif-close {
  color: var(--text-muted);
  cursor: pointer;
  background: transparent;
  border: none;
  font-size: 1.1rem;
  padding: 4px;
}

.notif-close:hover {
  color: #fff;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

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

/* Leaflet dark theme override helper */
.leaflet-container {
  background: var(--bg-darker) !important;
}

/* Responsive Rules */
@media (max-width: 1024px) {
  .app-sidebar {
    width: 220px;
  }
  .companion-panel {
    display: none; /* Hide device simulator on standard tablets to conserve space */
  }
}

@media (max-width: 768px) {
  body {
    flex-direction: column;
  }
  
  .app-container {
    flex-direction: column;
  }
  
  .app-sidebar {
    display: none; /* Show mobile bottom tabs instead */
  }
  
  .mobile-nav-bar {
    display: flex;
  }
  
  .main-content {
    height: calc(100vh - 64px);
    padding-bottom: 80px;
  }
  
  .screen-view {
    padding: 16px;
  }
  
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  
  .detail-grid {
    grid-template-columns: 1fr;
  }
  
  .ai-assistant-wrapper {
    grid-template-columns: 1fr;
    height: auto;
  }
  
  .ai-sidebar {
    border-right: none;
    padding-right: 0;
    margin-bottom: 16px;
  }
  
  .alerts-layout {
    grid-template-columns: 1fr;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .family-cities-grid {
    grid-template-columns: 1fr;
  }
}

.app-dashboard-footer {
  margin-top: 40px;
  padding: 24px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.app-dashboard-footer p {
  margin-bottom: 6px;
}

.app-dashboard-footer .footer-links {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.app-dashboard-footer .footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.app-dashboard-footer .footer-links a:hover {
  color: var(--primary);
  text-decoration: underline;
}
