/* ============================================================================
   Adarsh Gram Village Intelligence Platform - Main CSS Design System
   Government-Grade, Mobile-First, Accessible Theme for MoSJE (PS #94)
   ============================================================================ */

:root {
  /* Brand & Government Palette */
  --primary-900: #0f172a;
  --primary-800: #1e293b;
  --primary-700: #1e3a8a; /* Deep Navy */
  --primary-600: #2563eb;
  --primary-500: #3b82f6;
  --primary-100: #dbeafe;
  --primary-50:  #eff6ff;

  --gov-ashoka: #138808; /* India Green */
  --gov-saffron: #ff9933; /* Saffron */
  --gov-navy: #000080;

  /* Neutral Surface & Grayscale */
  --bg-app: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #ffffff;
  --border-subtle: #e2e8f0;
  --border-medium: #cbd5e1;
  --border-strong: #94a3b8;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-inverse: #ffffff;

  /* Severity & Status Palette */
  --severity-critical-bg: #fee2e2;
  --severity-critical-text: #991b1b;
  --severity-critical-border: #f87171;
  --severity-critical-color: #dc2626;

  --severity-high-bg: #ffedd5;
  --severity-high-text: #9a3412;
  --severity-high-border: #fb923c;
  --severity-high-color: #ea580c;

  --severity-medium-bg: #fef3c7;
  --severity-medium-text: #92400e;
  --severity-medium-border: #fcd34d;
  --severity-medium-color: #d97706;

  --severity-low-bg: #ecfdf5;
  --severity-low-text: #065f46;
  --severity-low-border: #6ee7b7;
  --severity-low-color: #059669;

  --status-conflict-bg: #fdf2f8;
  --status-conflict-text: #831843;
  --status-conflict-border: #f472b6;
  --status-conflict-color: #db2777;

  /* Layout Constants */
  --header-height: 60px;
  --bottom-nav-height: 60px;
  --sidebar-width: 440px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.15), 0 8px 10px -6px rgb(0 0 0 / 0.1);

  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

/* Top App Header */
.app-header {
  height: var(--header-height);
  background-color: var(--primary-900);
  color: var(--text-inverse);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  box-shadow: var(--shadow-md);
  z-index: 100;
  position: relative;
}

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

.gov-emblem {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--gov-saffron) 0%, #ffffff 50%, var(--gov-ashoka) 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.2);
}

.brand-titles h1 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.brand-titles p {
  font-size: 11px;
  color: #94a3b8;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

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

.network-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  background-color: #1e293b;
  border: 1px solid #334155;
  color: #e2e8f0;
}

.network-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #10b981;
}

.network-dot.offline {
  background-color: #f59e0b;
}

.role-badge-select {
  background-color: #1e293b;
  color: #f8fafc;
  border: 1px solid #334155;
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

/* App Main Container */
.app-container {
  display: flex;
  height: calc(100vh - var(--header-height));
  position: relative;
  overflow: hidden;
}

/* Navigation Tabs */
.desktop-nav {
  display: none;
}

@media (min-width: 768px) {
  .desktop-nav {
    display: flex;
    align-items: center;
    gap: 4px;
  }

  .nav-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .nav-btn:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.08);
  }

  .nav-btn.active {
    color: #ffffff;
    background-color: var(--primary-700);
  }
}

/* Mobile Bottom Navigation */
.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background-color: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 1000;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

@media (min-width: 768px) {
  .mobile-bottom-nav {
    display: none;
  }
}

.bottom-tab-btn {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  gap: 3px;
  cursor: pointer;
}

.bottom-tab-btn .tab-icon {
  font-size: 18px;
}

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

/* View Containers */
.view-container {
  display: none;
  width: 100%;
  height: 100%;
  overflow: auto;
}

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

/* Notification Banner */
.toast-container {
  position: fixed;
  top: 70px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 280px;
  max-width: 400px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background-color: var(--primary-900);
  color: #ffffff;
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  line-height: 1.4;
  animation: slideIn 0.2s ease forwards;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border-left: 4px solid var(--primary-500);
}

.toast.success { border-left-color: #10b981; }
.toast.warning { border-left-color: #f59e0b; }
.toast.error { border-left-color: #ef4444; }

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