/* FLOWS - Flood Level Online Warning System
   Dark Tech EWS theme */

:root {
  --bg: #0a1628;
  --sidebar: #0d1f3c;
  --card: #112240;
  --card-2: #16305c;
  --accent: #00d4ff;
  --accent-2: #0066cc;
  --normal: #00ff88;
  --alert: #ffdd00;
  --warning: #ffaa00;
  --flood: #ff6600;
  --danger: #ff3333;
  --text: #e6f1ff;
  --text-muted: #8892b0;
  --border: #1e3a5f;
}

* { box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Roboto', 'Segoe UI', system-ui, -apple-system, sans-serif;
  margin: 0;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: #fff; }

/* ---------- Layout ---------- */
.flows-wrapper { display: flex; min-height: 100vh; }

.sidebar {
  width: 260px;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  z-index: 1030;
  transition: transform .25s ease;
}

.sidebar-brand {
  padding: 18px 16px;
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.sidebar-brand img { max-width: 180px; height: auto; }

.sidebar-menu {
  list-style: none;
  padding: 12px 0;
  margin: 0;
}

.sidebar-menu .menu-label {
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 14px 20px 6px;
}

.sidebar-menu a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  color: var(--text-muted);
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all .15s;
}

.sidebar-menu a i {
  width: 20px;
  text-align: center;
  font-size: 16px;
}

.sidebar-menu a:hover {
  background: rgba(0,212,255,.07);
  color: var(--text);
}

.sidebar-menu a.active {
  background: rgba(0,212,255,.12);
  color: var(--accent);
  border-left-color: var(--accent);
}

.sidebar-menu .badge-count {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 11px;
}

.main-content {
  margin-left: 260px;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ---------- Topbar ---------- */
.topbar {
  height: 62px;
  background: var(--sidebar);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 1020;
}

.topbar .page-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
}

.topbar .spacer { flex: 1; }

.topbar .top-item {
  margin-left: 14px;
  position: relative;
}

.topbar .btn-icon {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 7px 11px;
  cursor: pointer;
}

.topbar .btn-icon:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.lang-toggle a {
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 13px;
  margin-left: 4px;
}

.lang-toggle a.active {
  background: var(--accent);
  color: #06263b;
  border-color: var(--accent);
  font-weight: 700;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 30px;
  padding: 5px 6px 5px 14px;
}

.user-chip .avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #06263b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.user-chip .u-name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.1;
}

.user-chip .u-role {
  font-size: 11px;
  color: var(--text-muted);
}

.content-body {
  padding: 22px;
  flex: 1;
}

/* ---------- Cards ---------- */
.card-flows {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 20px;
}

.card-flows .card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.card-flows .card-head h5 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.card-flows .card-head i { color: var(--accent); }

/* Stat cards */
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 100%;
}

.stat-card .stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-card .stat-value {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.1;
}

.stat-card .stat-label {
  color: var(--text-muted);
  font-size: 13px;
}

.stat-card .stat-sub {
  font-size: 12px;
  color: var(--text-muted);
}

/* ---------- EWS main status ---------- */
.ews-banner {
  border-radius: 14px;
  padding: 26px;
  text-align: center;
  position: relative;
  overflow: hidden;
  border: 2px solid;
}

.ews-banner .ews-label {
  font-size: 13px;
  letter-spacing: 2px;
  text-transform: uppercase;
  opacity: .8;
}

.ews-banner .ews-status {
  font-size: 46px;
  font-weight: 800;
  letter-spacing: 2px;
  margin: 6px 0;
}

.ews-banner .ews-desc {
  font-size: 14px;
  opacity: .9;
}

.pulse { animation: pulse 1.6s infinite; }

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255,51,51,.5); }
  70% { box-shadow: 0 0 0 18px rgba(255,51,51,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,51,51,0); }
}

.glow-critical {
  box-shadow: 0 0 25px rgba(255,51,51,.55);
}

/* ---------- Badges ---------- */
.badge-flows {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .5px;
}

/* ---------- Tables ---------- */
.table-flows {
  width: 100%;
  border-collapse: collapse;
}

.table-flows th,
.table-flows td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}

.table-flows th {
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: .5px;
}

.table-flows tbody tr:hover {
  background: rgba(0,212,255,.04);
}

/* ---------- Forms ---------- */
.form-flows label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.form-flows input,
.form-flows select,
.form-flows textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 10px 12px;
  margin-bottom: 14px;
  font-size: 14px;
}

.form-flows input:focus,
.form-flows select:focus,
.form-flows textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(0,212,255,.15);
}

.btn-flows {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none;
  color: #06263b;
  font-weight: 700;
  border-radius: 8px;
  padding: 10px 18px;
  cursor: pointer;
  transition: opacity .15s;
}

.btn-flows:hover {
  opacity: .88;
  color: #06263b;
}

.btn-outline-flows {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 8px;
  padding: 8px 16px;
  cursor: pointer;
  font-weight: 600;
}

.btn-outline-flows:hover {
  background: rgba(0,212,255,.1);
}

.btn-danger-flows {
  background: var(--danger);
  border: none;
  color: #fff;
  border-radius: 8px;
  padding: 8px 16px;
  cursor: pointer;
  font-weight: 600;
}

.btn-sm-flows {
  padding: 5px 12px;
  font-size: 12.5px;
}

/* ---------- Map ---------- */

/* Default map used by dashboard pages */
/*#flows-map,*/
/*.flows-map {*/
/*  height: 340px;*/
/*  border-radius: 12px;*/
/*  border: 1px solid var(--border);*/
/*  overflow: hidden;*/
/*  position: relative;*/
/*}*/

#flows-map,
.flows-map {
  width: 100%;
  height: 620px;
  min-height: 500px;
  border-radius: 14px;
  border: 1px solid var(--border);
  overflow: hidden;
  background: #0f172a;
  position: relative;
}

#flows-map .leaflet-container {
  width: 100%;
  height: 100%;
}

/* Public monitoring map: full width and larger */
.public-container #flows-map {
  width: 100%;
  height: 600px;
  min-height: 500px;
  border-radius: 0 0 12px 12px;
  border: 0;
}

/* Leaflet must have a real height */
#flows-map.leaflet-container,
.flows-map.leaflet-container {
  background: #0f172a;
}

/* Leaflet popup follows FLOWS dark theme */
.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: var(--card);
  color: var(--text);
}

.leaflet-popup-content-wrapper {
  border: 1px solid var(--border);
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
}

.leaflet-popup-content {
  margin: 13px 15px;
  font-size: 13px;
}

.leaflet-popup-close-button {
  color: var(--text-muted) !important;
}

.leaflet-popup-close-button:hover {
  color: var(--accent) !important;
}

/* ---------- Map Theme Selector ---------- */

.map-theme-control {
  background: rgba(15, 23, 42, .96);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 10px;
  padding: 8px;
  box-shadow: 0 5px 20px rgba(0,0,0,.25);
  color: #fff;
  z-index: 1000;
}

.map-theme-control select {
  min-width: 180px;
  border: 1px solid rgba(255,255,255,.18);
  background: #1e293b;
  color: #fff;
  border-radius: 7px;
  padding: 7px 10px;
  outline: none;
  font-size: 12px;
  cursor: pointer;
}

.map-theme-control select:hover {
  border-color: var(--accent);
}

.map-theme-control select:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 2px rgba(56,189,248,.12);
}

.map-theme-control option {
  background: #1e293b;
  color: #fff;
}

.map-theme-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 5px;
  opacity: .7;
}

/* Map toolbar */
.map-toolbar {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Public map legend */
.map-legend {
  position: absolute;
  left: 15px;
  bottom: 20px;
  z-index: 500;
  background: rgba(15,23,42,.94);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px;
  padding: 10px 12px;
  color: #fff;
  font-size: 12px;
  box-shadow: 0 5px 20px rgba(0,0,0,.25);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 4px 0;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

/* Device popup */
.device-popup {
  min-width: 220px;
  font-family: 'Roboto', 'Segoe UI', system-ui, sans-serif;
}

.device-popup-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 2px;
}

.device-popup-code {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.device-popup-location {
  font-size: 12px;
  margin-bottom: 8px;
}

.device-popup-level {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

.device-popup-status {
  display: inline-block;
  padding: 4px 9px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
}

.device-popup-time {
  margin-top: 7px;
  font-size: 10px;
  color: var(--text-muted);
}

/* ---------- Alert list ---------- */
.alert-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
  margin-bottom: 10px;
  background: var(--bg);
  border-left: 4px solid var(--accent);
}

.alert-item .a-icon {
  font-size: 18px;
  margin-top: 2px;
}

.alert-item .a-msg {
  font-weight: 600;
  font-size: 14px;
}

.alert-item .a-meta {
  font-size: 12px;
  color: var(--text-muted);
}

/* ---------- Login ---------- */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  background: radial-gradient(circle at 50% 0%, #12315e 0%, #0a1628 60%);
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 34px 30px;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}

.login-card .login-logo {
  text-align: center;
  margin-bottom: 8px;
}

.login-card .login-logo img {
  max-width: 250px;
}

.login-unis {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin: 18px 0;
}

.login-unis img {
  width: 52px;
  height: 52px;
}

/* ---------- Public ---------- */
.public-header {
  background: var(--sidebar);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.public-hero {
  text-align: center;
  padding: 30px 20px 10px;
}

/* Public page full-width content */
.public-container {
  width: 100%;
  max-width: 1500px;
  margin: 0 auto;
  padding: 24px 30px 40px;
}

.map-card {
  width: 100%;
  margin-top: 20px;
}

/* ---------- Utilities ---------- */
.text-muted-flows { color: var(--text-muted); }

.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

.grid-gap { gap: 20px; }

/* ---------- Sidebar toggle (mobile) ---------- */
.sidebar-backdrop { display: none; }

.menu-toggle {
  display: none;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 22px;
  margin-right: 14px;
  cursor: pointer;
}

@media (max-width: 991px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  .menu-toggle {
    display: block;
  }

  .sidebar-backdrop.show {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 1025;
  }

  .user-chip .u-name,
  .user-chip .u-role {
    display: none;
  }

  .public-container {
    padding: 16px 12px 30px;
  }

  .public-container #flows-map {
    height: 500px;
    min-height: 430px;
  }

  .map-theme-control select {
    min-width: 150px;
  }
}

@media (max-width: 575px) {
  .public-header {
    padding: 12px 14px;
    gap: 8px;
  }

  .public-header img {
    height: 36px !important;
  }

  .public-header .lang-toggle {
    display: none;
  }

  .public-container #flows-map {
    height: 440px;
    min-height: 400px;
  }

  .map-theme-control {
    padding: 6px;
  }

  .map-theme-control select {
    min-width: 145px;
    max-width: 180px;
    padding: 6px 8px;
    font-size: 11px;
  }

  .map-theme-label {
    font-size: 9px;
  }

  .map-legend {
    left: 8px;
    bottom: 10px;
    padding: 8px 9px;
    font-size: 10px;
  }
}

@media (min-width: 1600px) {
  .public-container {
    max-width: 1600px;
  }

  .public-container #flows-map {
    height: 680px;
  }
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-2);
}


/* =========================================================
   DASHBOARD INTERACTIVE MAP
   ========================================================= */

.dashboard-map-card {
  padding-bottom: 0;
  overflow: hidden;
}

.dashboard-map-card .card-head {
  padding: 0 0 14px;
}

.dashboard-map-wrap {
  position: relative;
  width: 100%;
  height: 560px;
  overflow: hidden;
  border-radius: 10px;
  background: #0f172a;
}

.dashboard-map-wrap #flows-map {
  width: 100%;
  height: 100%;
  min-height: 560px;
  border: 0;
  border-radius: 10px;
}

.map-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Status panel */

.map-status-panel {
  position: absolute;
  z-index: 800;
  left: 15px;
  top: 15px;
  width: 155px;
  padding: 11px 12px;
  background: rgba(10,22,40,.94);
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 10px;
  color: var(--text);
  box-shadow: 0 8px 25px rgba(0,0,0,.35);
  backdrop-filter: blur(8px);
}

.map-status-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--accent);
  margin-bottom: 7px;
}

.map-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 0;
  font-size: 11px;
}

.map-status-row strong {
  font-size: 12px;
}

.map-status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 5px;
  border-radius: 50%;
  box-shadow: 0 0 7px currentColor;
}

/* Device marker */

.flows-device-marker {
  background: transparent !important;
  border: 0 !important;
}

.flows-marker-ring {
  width: 42px;
  height: 42px;
  border: 2px solid;
  border-radius: 50%;
  background: rgba(10,22,40,.75);
  display: flex;
  align-items: center;
  justify-content: center;
  transform: rotate(0deg);
}

.flows-marker-core {
  width: 27px;
  height: 27px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #06121f;
  font-size: 13px;
}

.marker-danger-pulse .flows-marker-ring {
  animation: flowsMarkerPulse 1.4s infinite;
}

@keyframes flowsMarkerPulse {
  0% {
    transform: scale(1);
    opacity: 1;
  }

  70% {
    transform: scale(1.18);
    opacity: .7;
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Map loading */

.map-loading {
  position: absolute;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 10px;
  background: #0f172a;
  color: var(--accent);
  font-size: 13px;
  transition: opacity .25s ease, visibility .25s ease;
}

.map-loading.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Fullscreen */

.dashboard-map-wrap:fullscreen {
  width: 100vw;
  height: 100vh;
  border-radius: 0;
}

.dashboard-map-wrap:fullscreen #flows-map {
  height: 100vh;
  min-height: 100vh;
  border-radius: 0;
}

/* Leaflet controls */

#flows-map .leaflet-control-zoom {
  border: 0;
  box-shadow: 0 5px 18px rgba(0,0,0,.3);
}

#flows-map .leaflet-control-zoom a {
  background: rgba(15,23,42,.95);
  color: var(--text);
  border-color: rgba(255,255,255,.1);
}

#flows-map .leaflet-control-zoom a:hover {
  background: var(--card-2);
  color: var(--accent);
}

#flows-map .leaflet-control-attribution {
  background: rgba(10,22,40,.85);
  color: var(--text-muted);
}

#flows-map .leaflet-control-attribution a {
  color: var(--accent);
}

/* Mobile */

@media (max-width: 991px) {

  .dashboard-map-wrap {
    height: 500px;
  }

  .dashboard-map-wrap #flows-map {
    min-height: 500px;
  }

  .map-status-panel {
    width: 145px;
    left: 10px;
    top: 10px;
  }

  .map-toolbar {
    flex-wrap: wrap;
  }
}

@media (max-width: 575px) {

  .dashboard-map-wrap {
    height: 430px;
  }

  .dashboard-map-wrap #flows-map {
    min-height: 430px;
  }

  .map-status-panel {
    width: 135px;
    padding: 8px 9px;
  }

  .map-status-row {
    font-size: 10px;
  }

  .map-status-title {
    font-size: 9px;
  }

  .map-toolbar .btn-sm-flows {
    padding: 4px 7px;
  }
}

