/* ═══════════════════════════════════════════════════
   ALERTATLAS BASE STYLES v1.0
   Shared across all 20 modules
   ═══════════════════════════════════════════════════ */

/* DESIGN TOKENS */
:root {
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-card: #151d2e;
  --bg-card-hover: #1a2540;
  --bg-glass: rgba(17, 24, 39, 0.75);
  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.12);
  --text-primary: #e8ecf4;
  --text-secondary: #8892a8;
  --text-muted: #5a6478;
  --accent-red: #ef4444;
  --accent-red-glow: rgba(239, 68, 68, 0.3);
  --accent-orange: #f97316;
  --accent-yellow: #eab308;
  --accent-green: #22c55e;
  --accent-blue: #3b82f6;
  --accent-blue-glow: rgba(59, 130, 246, 0.25);
  --accent-cyan: #06b6d4;
  --accent-purple: #a855f7;
  --font-mono: 'JetBrains Mono', monospace;
  --font-sans: 'Space Grotesk', sans-serif;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --header-height: 52px;
}

/* RESET */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  padding-top: var(--header-height);
}
a { color: inherit; text-decoration: none; }
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 3px; }

/* ═══════════════════════════════════════
   MODULE HEADER
   ═══════════════════════════════════════ */
.aa-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 900;
  height: var(--header-height);
  background: rgba(10, 14, 23, 0.92);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 20px; gap: 12px;
}
.aa-header-back {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: transparent;
  color: var(--text-secondary); cursor: pointer;
  transition: var(--transition); flex-shrink: 0;
}
.aa-header-back:hover { border-color: var(--border-hover); color: var(--text-primary); background: rgba(255,255,255,0.03); }
.aa-header-brand {
  display: flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 0.9rem; letter-spacing: -0.02em;
  color: var(--text-muted); flex-shrink: 0;
}
.aa-header-brand span { color: var(--accent-red); }
.aa-header-divider { width: 1px; height: 22px; background: var(--border); flex-shrink: 0; }
.aa-header-icon { display: flex; color: var(--text-secondary); flex-shrink: 0; }
.aa-header-title { font-weight: 600; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.aa-header-spacer { flex: 1; }
.aa-header-tags { display: flex; gap: 4px; flex-shrink: 0; }
.aa-header-tag {
  font-family: var(--font-mono); font-size: 0.62rem; padding: 2px 7px;
  border-radius: 3px; background: rgba(59,130,246,0.1);
  color: var(--accent-blue); border: 1px solid rgba(59,130,246,0.15);
}
.aa-header-actions { display: flex; gap: 6px; flex-shrink: 0; }
.aa-header-btn {
  padding: 6px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: transparent;
  color: var(--text-secondary); font-family: var(--font-sans);
  font-size: 0.76rem; cursor: pointer; transition: var(--transition);
  display: flex; align-items: center; gap: 5px;
}
.aa-header-btn:hover { border-color: var(--border-hover); color: var(--text-primary); background: rgba(255,255,255,0.03); }

/* ═══════════════════════════════════════
   LAYOUT CONTAINERS
   ═══════════════════════════════════════ */
.aa-container { max-width: 1200px; margin: 0 auto; padding: 24px 20px; }
.aa-container-wide { max-width: 1400px; margin: 0 auto; padding: 24px 20px; }
.aa-container-full { padding: 24px 20px; }

/* ═══════════════════════════════════════
   CARDS
   ═══════════════════════════════════════ */
.aa-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 20px;
  transition: var(--transition);
}
.aa-card:hover { border-color: var(--border-hover); }
.aa-card-title {
  font-weight: 600; font-size: 0.95rem; margin-bottom: 4px;
}
.aa-card-subtitle {
  font-size: 0.78rem; color: var(--text-muted); font-family: var(--font-mono);
}

/* ═══════════════════════════════════════
   SKELETON LOADERS
   ═══════════════════════════════════════ */
.aa-skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: aa-shimmer 1.8s ease-in-out infinite;
  border-radius: var(--radius-sm);
}
@keyframes aa-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.aa-skeleton-text { height: 14px; margin-bottom: 8px; width: 70%; }
.aa-skeleton-text-sm { height: 10px; margin-bottom: 6px; width: 50%; }
.aa-skeleton-box { height: 120px; border-radius: var(--radius-md); border: 1px solid var(--border); }
.aa-skeleton-map { height: 400px; border-radius: var(--radius-md); border: 1px solid var(--border); }
.aa-skeleton-row { height: 52px; border-radius: var(--radius-sm); margin-bottom: 6px; border: 1px solid var(--border); }

/* ═══════════════════════════════════════
   FORM CONTROLS
   ═══════════════════════════════════════ */
.aa-input {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 14px;
  color: var(--text-primary); font-family: var(--font-sans);
  font-size: 0.9rem; outline: none; transition: var(--transition);
  width: 100%;
}
.aa-input:focus { border-color: var(--accent-blue); box-shadow: 0 0 0 3px var(--accent-blue-glow); }
.aa-input::placeholder { color: var(--text-muted); }

.aa-search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 4px 4px 4px 16px;
  transition: var(--transition);
}
.aa-search-box:focus-within { border-color: var(--accent-blue); box-shadow: 0 0 0 3px var(--accent-blue-glow); }
.aa-search-box svg { color: var(--text-muted); flex-shrink: 0; }
.aa-search-box input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text-primary); font-family: var(--font-sans); font-size: 0.9rem; padding: 10px 0;
}
.aa-search-box input::placeholder { color: var(--text-muted); }
.aa-search-btn {
  padding: 10px 20px; background: var(--accent-blue); color: #fff;
  border: none; border-radius: var(--radius-sm); font-family: var(--font-sans);
  font-weight: 600; font-size: 0.85rem; cursor: pointer; transition: var(--transition);
  white-space: nowrap;
}
.aa-search-btn:hover { background: #2563eb; }

.aa-select {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 12px;
  color: var(--text-primary); font-family: var(--font-sans);
  font-size: 0.85rem; outline: none; cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235a6478' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
  padding-right: 30px;
}

/* ═══════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════ */
.aa-btn {
  padding: 8px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: transparent;
  color: var(--text-secondary); font-family: var(--font-sans);
  font-size: 0.85rem; cursor: pointer; transition: var(--transition);
  display: inline-flex; align-items: center; gap: 6px;
}
.aa-btn:hover { border-color: var(--border-hover); color: var(--text-primary); background: rgba(255,255,255,0.03); }
.aa-btn-primary { background: var(--accent-blue); color: #fff; border-color: var(--accent-blue); }
.aa-btn-primary:hover { background: #2563eb; border-color: #2563eb; color: #fff; }

/* ═══════════════════════════════════════
   TABS
   ═══════════════════════════════════════ */
.aa-tabs {
  display: flex; gap: 2px; border-bottom: 1px solid var(--border);
  margin-bottom: 20px; overflow-x: auto;
}
.aa-tab {
  padding: 10px 18px; font-size: 0.85rem; font-weight: 500;
  color: var(--text-muted); cursor: pointer; transition: var(--transition);
  border-bottom: 2px solid transparent; white-space: nowrap;
  background: none; border-top: none; border-left: none; border-right: none;
  font-family: var(--font-sans);
}
.aa-tab:hover { color: var(--text-secondary); }
.aa-tab.active { color: var(--text-primary); border-bottom-color: var(--accent-blue); }

/* ═══════════════════════════════════════
   TABLES
   ═══════════════════════════════════════ */
.aa-table { width: 100%; border-collapse: collapse; }
.aa-table th {
  text-align: left; padding: 10px 14px; font-size: 0.72rem;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted); font-family: var(--font-mono);
  border-bottom: 1px solid var(--border); font-weight: 600;
}
.aa-table td {
  padding: 12px 14px; font-size: 0.88rem;
  border-bottom: 1px solid var(--border);
}
.aa-table tr:hover td { background: rgba(255,255,255,0.02); }

/* ═══════════════════════════════════════
   BADGES & LABELS
   ═══════════════════════════════════════ */
.aa-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--font-mono); font-size: 0.68rem; padding: 3px 8px;
  border-radius: var(--radius-sm); font-weight: 500;
}
.aa-badge-red { background: rgba(239,68,68,0.12); color: var(--accent-red); }
.aa-badge-orange { background: rgba(249,115,22,0.12); color: var(--accent-orange); }
.aa-badge-yellow { background: rgba(234,179,8,0.12); color: var(--accent-yellow); }
.aa-badge-green { background: rgba(34,197,94,0.12); color: var(--accent-green); }
.aa-badge-blue { background: rgba(59,130,246,0.12); color: var(--accent-blue); }
.aa-badge-cyan { background: rgba(6,182,212,0.12); color: var(--accent-cyan); }
.aa-badge-purple { background: rgba(168,85,247,0.12); color: var(--accent-purple); }

/* ═══════════════════════════════════════
   SECTION LABELS
   ═══════════════════════════════════════ */
.aa-section-title {
  font-size: 1.2rem; font-weight: 600; letter-spacing: -0.02em; margin-bottom: 16px;
}
.aa-section-sub {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted); font-family: var(--font-mono); font-weight: 600;
  margin-bottom: 12px;
}
.aa-label { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 6px; }

/* ═══════════════════════════════════════
   STAT BOXES
   ═══════════════════════════════════════ */
.aa-stats { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.aa-stat {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 16px 20px;
  flex: 1; min-width: 140px;
}
.aa-stat-value { font-size: 1.6rem; font-weight: 700; font-family: var(--font-mono); line-height: 1.2; }
.aa-stat-label { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

/* ═══════════════════════════════════════
   GRID LAYOUTS
   ═══════════════════════════════════════ */
.aa-grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.aa-grid-3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.aa-grid-4 { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }

/* ═══════════════════════════════════════
   MAP CONTAINERS
   ═══════════════════════════════════════ */
.aa-map { width: 100%; height: 500px; border-radius: var(--radius-md); border: 1px solid var(--border); overflow: hidden; }
.aa-map-full { width: 100%; height: calc(100vh - var(--header-height) - 80px); border-radius: var(--radius-md); border: 1px solid var(--border); overflow: hidden; }

/* ═══════════════════════════════════════
   TOOLTIPS & POPUPS
   ═══════════════════════════════════════ */
.aa-tooltip {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 12px 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5); font-size: 0.85rem;
}

/* ═══════════════════════════════════════
   LEAFLET OVERRIDES
   ═══════════════════════════════════════ */
.leaflet-control-attribution { display: none !important; }
.leaflet-control-zoom { border: none !important; }
.leaflet-control-zoom a {
  background: var(--bg-glass) !important; backdrop-filter: blur(8px);
  color: var(--text-primary) !important; border: 1px solid var(--border) !important;
  width: 34px !important; height: 34px !important; line-height: 34px !important; font-size: 16px !important;
}
.leaflet-control-zoom a:hover { background: var(--bg-card-hover) !important; }
.leaflet-popup-content-wrapper {
  background: var(--bg-card) !important; color: var(--text-primary) !important;
  border: 1px solid var(--border) !important; border-radius: var(--radius-md) !important;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5) !important; font-family: var(--font-sans) !important;
}
.leaflet-popup-tip { background: var(--bg-card) !important; }
.leaflet-popup-content { margin: 12px 16px !important; font-size: 0.85rem !important; }

/* ═══════════════════════════════════════
   CHART.JS OVERRIDES
   ═══════════════════════════════════════ */
.aa-chart-container { position: relative; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 20px; }

/* ═══════════════════════════════════════
   AUTOCOMPLETE
   ═══════════════════════════════════════ */
.aa-autocomplete {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); max-height: 260px; overflow-y: auto;
  display: none; box-shadow: 0 16px 48px rgba(0,0,0,0.5); z-index: 50;
}
.aa-autocomplete.visible { display: block; }
.aa-autocomplete-item {
  padding: 10px 16px; cursor: pointer; font-size: 0.88rem;
  border-bottom: 1px solid var(--border); transition: var(--transition);
  display: flex; align-items: center; gap: 10px;
}
.aa-autocomplete-item:last-child { border-bottom: none; }
.aa-autocomplete-item:hover { background: var(--bg-card-hover); }

/* ═══════════════════════════════════════
   EMPTY STATES
   ═══════════════════════════════════════ */
.aa-empty {
  text-align: center; padding: 60px 20px; color: var(--text-muted);
}
.aa-empty-icon { margin-bottom: 16px; opacity: 0.4; }
.aa-empty-text { font-size: 0.95rem; margin-bottom: 8px; }
.aa-empty-sub { font-size: 0.8rem; color: var(--text-muted); }

/* ═══════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════ */
@media (max-width: 768px) {
  .aa-container { padding: 16px 14px; }
  .aa-header-tags { display: none; }
  .aa-header-brand { display: none; }
  .aa-header-divider { display: none; }
  .aa-stats { gap: 8px; }
  .aa-stat { min-width: 100px; padding: 12px 14px; }
  .aa-stat-value { font-size: 1.3rem; }
  .aa-grid-2, .aa-grid-3, .aa-grid-4 { grid-template-columns: 1fr; }
  .aa-map { height: 350px; }
  .aa-map-full { height: calc(100vh - var(--header-height) - 60px); }
}

@media (max-width: 480px) {
  .aa-header-actions { display: none; }
}
