/* ============================================================
   Kızılbey panel teması — koyu kırmızı (#5C0606 markası)
   ============================================================ */
:root {
  --bg: #120606;
  --bg-2: #1c0a0a;
  --card: #241010;
  --card-2: #2e1414;
  --line: #3a1b1b;
  --red: #5c0606;
  --red-bright: #930808;
  --red-glow: #c21f1f;
  --text: #f4e9e9;
  --muted: #b08a8a;
  --ok: #2ecc71;
  --off: #8a8a8a;
  --warn: #e0a500;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 80% -10%, #2a0d0d 0%, transparent 60%),
    radial-gradient(900px 500px at -10% 110%, #2a0d0d 0%, transparent 55%),
    var(--bg);
}

button { font-family: inherit; cursor: pointer; }
h1, h2 { margin: 0; }

/* ---------- Butonlar ---------- */
.primary {
  background: linear-gradient(180deg, var(--red-bright), var(--red));
  color: #fff;
  border: 1px solid #6e0a0a;
  padding: 12px 18px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 15px;
  transition: filter 0.15s, transform 0.05s;
}
.primary:hover { filter: brightness(1.12); }
.primary:active { transform: translateY(1px); }
.primary:disabled { filter: grayscale(0.4) brightness(0.8); cursor: default; }

.ghost {
  background: var(--card-2);
  color: var(--text);
  border: 1px solid var(--line);
  padding: 11px 14px;
  border-radius: 12px;
  font-size: 14px;
  transition: background 0.15s, border-color 0.15s;
}
.ghost:hover { background: #3a1818; border-color: #5a2626; }
.ghost.small { padding: 7px 12px; font-size: 13px; }
.ghost.active { background: var(--red); border-color: var(--red-glow); color: #fff; }

/* ============================================================
   LOGIN
   ============================================================ */
.login-bg {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 360px;
  background: linear-gradient(180deg, var(--card), var(--bg-2));
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 34px 28px 24px;
  box-shadow: var(--shadow);
  text-align: center;
}
.login-logo {
  width: 92px;
  height: 92px;
  border-radius: 22px;
  object-fit: cover;
  background: var(--red);
  box-shadow: 0 6px 22px rgba(146, 8, 8, 0.45);
}
.login-card h1 { margin-top: 16px; font-size: 27px; letter-spacing: 0.5px; }
.login-card .sub { margin: 4px 0 22px; color: var(--muted); font-size: 14px; }
.login-card label {
  display: block;
  text-align: left;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 7px;
}
.pw-row { display: flex; gap: 8px; margin-bottom: 16px; }
.pw-row input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 12px;
  padding: 13px 14px;
  font-size: 16px;
  outline: none;
}
.pw-row input:focus { border-color: var(--red-glow); }
.pw-row .ghost { padding: 0 14px; font-size: 18px; }
.login-card .primary { width: 100%; }
.err {
  color: #ff8a8a;
  background: rgba(146, 8, 8, 0.18);
  border: 1px solid #6e0a0a;
  border-radius: 10px;
  padding: 9px 12px;
  margin: 14px 0 0;
  font-size: 13.5px;
}
.login-foot { margin-top: 22px; color: #7a5a5a; font-size: 12px; }

/* ============================================================
   PANEL
   ============================================================ */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: linear-gradient(180deg, var(--bg-2), transparent);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand-logo {
  width: 38px; height: 38px;
  border-radius: 11px;
  object-fit: cover;
  background: var(--red);
}
.brand-name { font-size: 19px; font-weight: 700; letter-spacing: 0.5px; }
.status-group { display: flex; align-items: center; gap: 9px; }

.badge {
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge-ok { background: rgba(46, 204, 113, 0.14); color: var(--ok); border-color: rgba(46, 204, 113, 0.4); }
.badge-off { background: rgba(138, 138, 138, 0.14); color: #c9c9c9; border-color: rgba(138, 138, 138, 0.35); }
.badge-wait { background: rgba(224, 165, 0, 0.14); color: var(--warn); border-color: rgba(224, 165, 0, 0.4); }
.badge-alarm { background: rgba(194, 31, 31, 0.2); color: #ff6b6b; border-color: #c21f1f; }

.layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 16px;
  padding: 16px;
  height: calc(100vh - 63px);
}
.map-wrap {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
#map { width: 100%; height: 100%; background: #0c0c0c; }
.map-fab {
  position: absolute;
  right: 14px; bottom: 14px;
  z-index: 500;
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 1px solid #6e0a0a;
  background: linear-gradient(180deg, var(--red-bright), var(--red));
  color: #fff;
  font-size: 22px;
  line-height: 1;
  box-shadow: var(--shadow);
}
.map-fab:hover { filter: brightness(1.12); }

.panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  padding-right: 4px;
}
.card {
  background: linear-gradient(180deg, var(--card), var(--bg-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 16px 18px;
  box-shadow: var(--shadow);
}
.card h2 { font-size: 15px; margin-bottom: 10px; color: #f0dada; }

/* Hız + istatistik */
.stat-card { padding-top: 18px; }
.stat-speed {
  display: flex;
  align-items: baseline;
  gap: 8px;
  justify-content: center;
  margin-bottom: 14px;
}
.speed-val {
  font-size: 58px;
  font-weight: 800;
  line-height: 1;
  color: #fff;
  text-shadow: 0 0 24px rgba(194, 31, 31, 0.5);
}
.speed-unit { font-size: 16px; color: var(--muted); }
.stat-rows { display: flex; flex-direction: column; gap: 1px; }
.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 9px 2px;
  border-top: 1px solid var(--line);
  font-size: 14px;
}
.stat-row span { color: var(--muted); }
.stat-row b { font-variant-numeric: tabular-nums; }

/* Form alanları */
.hint { color: var(--muted); font-size: 12.5px; margin: 0 0 12px; line-height: 1.5; }
.field-row { margin-bottom: 12px; }
.field-row label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.field-row input[type="number"] {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 15px;
  outline: none;
}
.field-row input[type="number"]:focus { border-color: var(--red-glow); }
.radius-row { display: flex; align-items: center; gap: 12px; }
.radius-val { font-size: 14px; min-width: 64px; text-align: right; font-variant-numeric: tabular-nums; }
input[type="range"] {
  flex: 1;
  accent-color: var(--red-bright);
}
.btn-row { display: flex; gap: 10px; margin-top: 4px; }
.btn-row .ghost { flex: 1; }
.btn-row .primary { flex: 1; }
.btn-row .ghost.active { background: var(--red); border-color: var(--red-glow); color: #fff; }

/* Alarm */
.alarm-head { display: flex; align-items: center; justify-content: space-between; }
.alarm-head h2 { margin: 0; }
.switch { position: relative; display: inline-block; width: 50px; height: 28px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  inset: 0;
  background: #4a2222;
  border-radius: 999px;
  transition: 0.2s;
}
.slider::before {
  content: "";
  position: absolute;
  height: 22px; width: 22px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.2s;
}
.switch input:checked + .slider { background: var(--red-bright); }
.switch input:checked + .slider::before { transform: translateX(22px); }
.alarm-card .hint { margin-top: 10px; margin-bottom: 0; }

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  background: var(--card-2);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 12px 20px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  font-size: 14px;
  z-index: 1000;
}
.toast.ok { border-color: rgba(46, 204, 113, 0.5); }
.toast.bad { border-color: #6e0a0a; color: #ff9a9a; }

/* Leaflet karanlık dokunuş */
.leaflet-control-attribution { background: rgba(0,0,0,0.5) !important; color: #999 !important; }
.leaflet-control-attribution a { color: #bbb !important; }
.leaflet-bar a { background: var(--card) !important; color: var(--text) !important; border-color: var(--line) !important; }
.leaflet-bar a:hover { background: var(--card-2) !important; }

/* ---------- Responsive ---------- */
@media (max-width: 880px) {
  .layout {
    grid-template-columns: 1fr;
    grid-template-rows: 46vh auto;
    height: auto;
  }
  .panel { overflow: visible; }
  .map-wrap { min-height: 300px; }
}
