﻿@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@700&display=swap');
:root {
  color-scheme: dark;
  --bg: #0b0c10;
  --panel: rgba(15, 23, 36, 0.65);
  --panel-blur: blur(20px);
  --border: rgba(255, 255, 255, 0.08);
  --text: #e2e8f0;
  --muted: #94a3b8;
  --gold: #38bdf8;
  --gold-2: #7dd3fc;
  --green: #22c55e;
  --red: #ef4444;
  --blue: #3b82f6;
  --shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
  --glow: 0 0 20px rgba(56, 189, 248, 0.15);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  direction: rtl;
  font-family: 'Cairo', sans-serif !important;
  background: var(--bg);
  color: var(--text);
  overflow: hidden; /* Prevent scrolling, let map fill */
}

/* Background Map Layer */
#map {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 0;
  background-color: #0b0c10;
}

/* UI Overlay Layer */
.ui-layer {
  position: relative;
  z-index: 10;
  pointer-events: none; /* Let clicks pass through to map */
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 24px;
}

/* Re-enable pointer events for actual UI panels */
.glass-panel, .floating-widgets, .sidebar {
  pointer-events: auto;
}

/* Glassmorphism Panel Base */
.glass-panel {
  background: var(--panel);
  backdrop-filter: var(--panel-blur);
  -webkit-backdrop-filter: var(--panel-blur);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.hidden { display: none !important; }

/* ----------------LOGIN---------------- */
.login {
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 440px;
  margin: auto;
  padding: 40px;
  box-shadow: var(--shadow), var(--glow);
}

.login-brand { text-align: center; }

form { display: flex; flex-direction: column; gap: 16px; }

.eyebrow {
  margin: 0 0 8px;
  color: var(--gold-2);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }

h1 {
  margin-bottom: 8px;
  font-size: 32px;
  line-height: 1.1;
}

h2 {
  margin-bottom: 12px;
  font-size: 18px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.muted { color: var(--muted); line-height: 1.5; font-size: 14px; }

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
}

input, select {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: 0;
  background: rgba(0,0,0,0.4);
  color: var(--text);
  transition: border 0.2s, box-shadow 0.2s;
}

input:focus, select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}

/* Buttons */
button {
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--gold);
  color: #000;
}

.btn-primary:hover { background: var(--gold-2); }

.btn-outline {
  background: rgba(255,255,255,0.05);
  border-color: var(--border);
  color: var(--text);
}
.btn-outline:hover { background: rgba(255,255,255,0.1); }

.ghost-button {
  background: transparent;
  color: var(--muted);
  min-height: unset;
  padding: 6px 12px;
}
.ghost-button:hover { color: var(--red); background: rgba(239, 68, 68, 0.1); }

.btn-ptt {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--red);
  font-size: 16px;
  padding: 14px;
}
.btn-ptt:hover:not(:disabled) { background: rgba(239, 68, 68, 0.3); }
.btn-ptt:active:not(:disabled) { background: var(--red); color: #fff; }
.btn-ptt:disabled { opacity: 0.5; cursor: not-allowed; }

/* ----------------CONSOLE LAYOUT---------------- */
.console {
  display: flex;
  justify-content: space-between;
  height: 100%;
  gap: 24px;
}

/* Sidebar (Right side natively due to RTL) */
.sidebar {
  width: 380px;
  display: flex;
  flex-direction: column;
  padding: 24px;
  gap: 24px;
  overflow: hidden;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.status {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 12px;
  background: rgba(255,255,255,0.1);
}

.status.online { background: rgba(34, 197, 94, 0.2); color: var(--green); }

/* Radio Controls */
.radio-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.action-buttons {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}
.action-buttons button { flex: 1; }

.meter {
  height: 6px;
  background: rgba(0,0,0,0.5);
  border-radius: 3px;
  overflow: hidden;
}

#micMeter {
  height: 100%;
  width: 0%;
  background: var(--green);
  transition: width 0.05s linear;
}

/* Lists */
.scrollable-lists {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-right: 8px;
}

/* Custom Scrollbar */
.scrollable-lists::-webkit-scrollbar { width: 6px; }
.scrollable-lists::-webkit-scrollbar-track { background: transparent; }
.scrollable-lists::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 3px; }

/* Emergency Panel */
.emergency-panel h2 { color: var(--red); border-color: rgba(239, 68, 68, 0.3); }

/* Floating Widgets (Left Side) */
.floating-widgets {
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 320px;
}

.metrics {
  padding: 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  font-size: 12px;
  color: var(--muted);
}
.metrics strong {
  display: block;
  font-size: 18px;
  color: var(--text);
  margin-top: 4px;
}

.panel-audit {
  flex: 1;
  padding: 20px;
  display: flex;
  flex-direction: column;
}
.audit {
  flex: 1;
  overflow-y: auto;
  font-family: 'Cairo', sans-serif !important;
  font-size: 11px;
  color: var(--muted);
}
.audit div { margin-bottom: 6px; border-bottom: 1px solid rgba(255,255,255,0.05); padding-bottom: 6px;}

/* Map Marker Overrides */
.leaflet-container {
  background: #000;
}
.radio-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: #fff;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.8);
  border: 2px solid #fff;
}
.radio-marker.dispatch { background: var(--gold); }
.radio-marker.mobile { background: var(--green); border-radius: 4px; }
.radio-marker.emergency { background: var(--red); animation: pulse 1s infinite; }

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  background: rgba(255,255,255,0.03);
  border-radius: 6px;
  margin-bottom: 8px;
  font-size: 13px;
}
.list-item:hover { background: rgba(255,255,255,0.08); }
