/**
 * Palanpur AI Smart Environment & Safety Monitoring System
 * Cyber-Eco Glassmorphic Design System
 */

:root {
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.85);
  --bg-card-hover: rgba(24, 33, 53, 0.95);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(16, 185, 129, 0.2);

  /* Brand Accents */
  --brand-primary: #0ea5e9;    /* Palanpur Cyan */
  --brand-secondary: #10b981;  /* Eco Emerald */
  --brand-accent: #6366f1;     /* Smart Indigo */

  /* Environmental Status Colors */
  --status-normal: #10b981;    /* Green Level 0 */
  --status-attention: #eab308; /* Yellow Level 1 */
  --status-warning: #f97316;   /* Orange Level 2 */
  --status-high: #ef4444;      /* High Risk Level 3 */
  --status-critical: #dc2626;  /* Critical Red Level 4 */

  /* Text */
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-sub: #64748b;

  --sidebar-width: 260px;
  --header-height: 70px;
  --bottom-nav-height: 65px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(at 0% 0%, rgba(14, 165, 233, 0.08) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.08) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Glassmorphism Panel */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  transition: all 0.25s ease-in-out;
}

.glass-panel:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

/* App Header & Navbar */
.app-navbar {
  height: var(--header-height);
  background: rgba(10, 14, 23, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 1020;
}

.navbar-brand-title {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #38bdf8 0%, #34d399 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.navbar-brand-subtitle {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Metric / Stat Card */
.stat-card {
  padding: 1.25rem 1.5rem;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--brand-primary);
  border-radius: 4px 0 0 4px;
}

.stat-card.stat-green::before { background: var(--status-normal); }
.stat-card.stat-yellow::before { background: var(--status-attention); }
.stat-card.stat-orange::before { background: var(--status-warning); }
.stat-card.stat-red::before { background: var(--status-critical); }

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.stat-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Zone Card */
.zone-card {
  border-radius: 16px;
  padding: 1.5rem;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  border-left: 4px solid var(--status-normal);
}

.zone-card.risk-0 { border-left-color: var(--status-normal); }
.zone-card.risk-1 { border-left-color: var(--status-attention); }
.zone-card.risk-2 { border-left-color: var(--status-warning); }
.zone-card.risk-3 { border-left-color: var(--status-high); }
.zone-card.risk-4 { border-left-color: var(--status-critical); }

.zone-metric-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  text-align: center;
}

.zone-metric-val {
  font-size: 1.4rem;
  font-weight: 700;
}

.zone-metric-title {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* Status Badges */
.badge-status-normal { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-status-attention { background: rgba(234, 179, 8, 0.15); color: #fde047; border: 1px solid rgba(234, 179, 8, 0.3); }
.badge-status-warning { background: rgba(249, 115, 22, 0.15); color: #fb923c; border: 1px solid rgba(249, 115, 22, 0.3); }
.badge-status-high { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }
.badge-status-critical { background: rgba(220, 38, 38, 0.25); color: #fca5a5; border: 1px solid rgba(220, 38, 38, 0.4); animation: pulseAlert 2s infinite; }

@keyframes pulseAlert {
  0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4); }
  70% { box-shadow: 0 0 0 8px rgba(220, 38, 38, 0); }
  100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}

/* Online/Offline indicator dot */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}
.status-dot.online { background: #10b981; box-shadow: 0 0 8px #10b981; }
.status-dot.offline { background: #ef4444; }

/* AI Recommendation Quote Box */
.ai-recommendation-box {
  background: rgba(14, 165, 233, 0.06);
  border: 1px solid rgba(14, 165, 233, 0.2);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  font-size: 0.85rem;
  line-height: 1.5;
  color: #bae6fd;
  position: relative;
}

.ai-recommendation-box::before {
  content: '⚡ AI ADVISORY:';
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #38bdf8;
  margin-bottom: 4px;
}

/* Map Container */
#cityMap {
  width: 100%;
  height: 480px;
  border-radius: 16px;
  z-index: 1;
}

.leaflet-popup-content-wrapper {
  background: rgba(17, 24, 39, 0.95) !important;
  color: var(--text-main) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  backdrop-filter: blur(12px) !important;
  border-radius: 12px !important;
}
.leaflet-popup-tip {
  background: rgba(17, 24, 39, 0.95) !important;
}

/* Chart Canvas styling */
.chart-container {
  position: relative;
  height: 320px;
  width: 100%;
}

/* Demo Data Banner */
.demo-banner {
  background: linear-gradient(90deg, #d97706, #b45309);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 12px;
  text-align: center;
  letter-spacing: 0.04em;
}

/* Safety Disclaimer Banner */
.disclaimer-box {
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.75rem;
  color: var(--text-sub);
}

/* Nav links */
.nav-link {
  color: var(--text-muted) !important;
  font-weight: 500;
  padding: 0.5rem 0.85rem !important;
  border-radius: 8px;
  transition: all 0.2s;
}

.nav-link:hover, .nav-link.active {
  color: var(--text-main) !important;
  background: rgba(255, 255, 255, 0.06);
}

/* Floating AI Assistant Button */
.chat-fab {
  position: fixed;
  bottom: 25px;
  right: 25px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0ea5e9 0%, #10b981 100%);
  color: white;
  border: none;
  box-shadow: 0 8px 25px rgba(14, 165, 233, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  z-index: 1030;
  transition: transform 0.2s ease;
}

.chat-fab:hover {
  transform: scale(1.08);
}

/* Chat Modal Drawer */
.chat-drawer {
  position: fixed;
  bottom: 95px;
  right: 25px;
  width: 380px;
  max-width: calc(100vw - 30px);
  height: 520px;
  background: rgba(17, 24, 39, 0.98);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 18px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.6);
  z-index: 1030;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.chat-drawer.open {
  display: flex;
}

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

.chat-bubble {
  padding: 0.75rem 1rem;
  border-radius: 14px;
  font-size: 0.86rem;
  line-height: 1.45;
  max-width: 85%;
}

.chat-bubble.bot {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  align-self: flex-start;
  color: #e2e8f0;
}

.chat-bubble.user {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: white;
  align-self: flex-end;
}
