* { box-sizing: border-box; }

body {
  font-family: -apple-system, system-ui, sans-serif;
  margin: 0; background: #f4f5f7; color: #1a1a1a;
}

/* ---- Topbar ---- */
.topbar {
  background: #1e293b; color: #fff;
  padding: 12px 16px;
  display: flex; justify-content: space-between; align-items: center;
  position: sticky; top: 0; z-index: 1000;
}
.topbar a {
  color: #cbd5e1; text-decoration: none;
  margin-left: 12px; font-size: 14px;
}
.topbar a:hover { color: #fff; }
.topbar-title { font-weight: 600; font-size: 15px; }

/* ---- Layout ---- */
.container {
  max-width: 960px; margin: 16px auto; padding: 0 12px;
}

/* ---- Card ---- */
.card {
  background: #fff; border-radius: 10px; padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08); margin-bottom: 14px;
}

/* ---- Typography ---- */
h1 { font-size: 20px; margin: 0 0 6px; }
h2 { font-size: 16px; margin: 0 0 12px; }

/* ---- Login ---- */
.login-wrap {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 16px;
}
.login-box { width: 100%; max-width: 340px; }

/* ---- Form elements ---- */
label {
  display: block; font-size: 13px; font-weight: 600;
  margin-top: 12px; color: #444;
}
input, select {
  width: 100%; padding: 9px; margin-top: 4px;
  border: 1px solid #ccc; border-radius: 6px; font-size: 14px;
}

/* ---- Buttons ---- */
button, .btn {
  margin-top: 10px; padding: 10px 14px;
  background: #2563eb; color: #fff;
  border: none; border-radius: 6px;
  font-size: 14px; cursor: pointer;
  touch-action: manipulation; /* mobilde daha iyi dokunma */
}
button:active { opacity: 0.85; }
button.danger   { background: #dc2626; }
button.secondary { background: #64748b; }

/* ---- Flash mesaji ---- */
.flash {
  background: #fef3c7; border: 1px solid #f59e0b;
  padding: 10px 14px; border-radius: 6px;
  margin-bottom: 14px; font-size: 14px;
}

/* ---- Tablo ---- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 7px 5px; border-bottom: 1px solid #eee; }
.badge {
  background: #fee2e2; color: #b91c1c;
  border-radius: 10px; padding: 2px 8px;
  font-size: 12px; font-weight: 600;
}
.pending-row { background: #fffbeb; }

/* ---- Harita ---- */
#map {
  height: 340px; border-radius: 8px; margin-top: 8px;
  width: 100%;
}

/* ---- Araç listesi ---- */
.device-list { display: flex; flex-direction: column; gap: 8px; }
.device-list a {
  display: block; padding: 12px; border-radius: 8px;
  text-decoration: none; color: #1a1a1a;
  border: 1px solid #eee; font-size: 15px;
}
.device-list a:hover  { background: #f4f5f7; }
.device-list a.active { border-color: #2563eb; background: #eff6ff; }

/* ---- Bilgi cubugu ---- */
#infoBar {
  display: flex; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px; background: #f8fafc;
  border: 1px solid #e2e8f0; border-radius: 8px;
  margin-top: 8px; font-size: 13px;
}
#infoBar span { color: #334155; }
#infoBar b { color: #1e293b; }

/* ---- Rota istatistikleri ---- */
#routeStats {
  display: none; padding: 10px 12px;
  background: #eff6ff; border: 1px solid #bfdbfe;
  border-radius: 8px; margin-top: 8px; font-size: 13px;
}

/* ---- Gecmis form ---- */
.history-form {
  display: flex; flex-wrap: wrap; gap: 8px;
  align-items: flex-end; margin-top: 10px;
}
.history-form label { margin-top: 0; }
.history-form input { margin-top: 4px; min-width: 160px; }
.history-form button { margin-top: 0; }

/* ---- Komutlar ---- */
.komut-grid {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 12px;
}
.komut-grid button { margin-top: 0; flex: 1 1 auto; min-width: 100px; }
.mod-row {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
}
.mod-row button { margin-top: 0; }

/* ---- Hiz renk etiketi ---- */
.speed-label {
  background: white; border: 1px solid #ccc;
  border-radius: 4px; padding: 2px 6px; font-size: 12px;
}

/* ---- Admin bekleyen cihaz formu ---- */
.approve-form {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
}
.approve-form input  { min-width: 120px; margin-top: 0; flex: 1 1 auto; }
.approve-form select { min-width: 130px; margin-top: 0; flex: 1 1 auto; }
.approve-form button { margin-top: 0; }

/* ======== MOBİL MEDYA SORGULARI ======== */
@media (max-width: 600px) {

  .topbar { padding: 10px 12px; }
  .topbar-title { font-size: 14px; }
  .topbar a { margin-left: 8px; font-size: 13px; }

  .container { margin: 10px auto; padding: 0 8px; }
  .card { padding: 12px; border-radius: 8px; }

  h2 { font-size: 15px; }

  #map { height: 260px; } /* telefonda daha kisa harita */

  button, .btn { font-size: 13px; padding: 9px 11px; }

  /* Tablo mobilde yatay kaydir */
  .table-wrap { overflow-x: auto; }
  table { font-size: 12px; }
  th, td { padding: 6px 4px; }

  /* Gecmis form dikey */
  .history-form { flex-direction: column; }
  .history-form input { min-width: 100%; }
  .history-form button { width: 100%; }

  /* Komut butonlari tam genislik */
  .komut-grid button { min-width: 80px; }

  /* Admin onay formu dikey */
  .approve-form { flex-direction: column; }
  .approve-form input,
  .approve-form select { width: 100%; }
  .approve-form button { width: 100%; }

  #infoBar { font-size: 12px; gap: 6px; }
  #routeStats { font-size: 12px; }
}

/* ---- Sekmeler ---- */
.tabs {
  display: flex; gap: 4px;
  border-bottom: 2px solid #e2e8f0;
  margin-bottom: 4px;
}
.tab-btn {
  margin-top: 0; padding: 8px 14px;
  background: none; color: #64748b;
  border: none; border-bottom: 2px solid transparent;
  border-radius: 0; font-size: 14px; cursor: pointer;
  margin-bottom: -2px;
}
.tab-btn:hover { color: #1e293b; }
.tab-btn.active {
  color: #2563eb; font-weight: 600;
  border-bottom-color: #2563eb;
  background: none;
}
@media (max-width: 600px) {
  .tab-btn { padding: 8px 10px; font-size: 13px; }
}
