/* ============================================================================
   Hafriyat Sistemi — Ana Stil Dosyası (Design System)

   Tasarım: Light Professional Admin Panel
   Font: Helvetica Neue / Inter
   Renk Paleti: Beyaz/gri arka plan, mavi aksan (#2f6df6)
   ============================================================================ */

/* ============================================================================
   CSS DEĞİŞKENLERİ (Design Tokens)
   ============================================================================ */
:root {
  /* Arka plan */
  --bg-primary: #f6f7f9;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-hover: #f2f4f7;
  --bg-input: #ffffff;
  --bg-table-head: #fafbfc;

  /* Metin */
  --text-primary: #171a1f;
  --text-secondary: #4b5260;
  --text-muted: #9aa1ac;
  --text-accent: #2f6df6;

  /* Aksan renkleri */
  --accent: #2f6df6;
  --accent-light: #1b4fd0;
  --accent-bg: #f0f4fe;
  --accent-border: #dfe6f8;

  /* Durum renkleri */
  --success: #1c8b57;
  --success-bg: #eefaf3;
  --success-border: #d3f0e0;
  --warning: #96660c;
  --warning-bg: #fdf7ec;
  --warning-border: #f5e6c5;
  --danger: #b4423f;
  --danger-bg: #fdf2f2;
  --danger-border: #f7dcdc;
  --info: #3b5aa6;
  --info-bg: #f1f4fb;
  --info-border: #d6dff3;

  /* Kenarlık */
  --border: #e7e9ed;
  --border-light: #eef0f3;
  --border-focus: #c3d3f7;

  /* Gölge */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.08);

  /* Kenar yuvarlaklığı */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --radius: 6px;

  /* Sidebar */
  --sidebar-width: 252px;
  --header-height: 62px;

  /* Geçiş */
  --transition: 0.2s ease;
  --transition-slow: 0.3s ease;

  /* Accent renk değişkeni (login sayfası için) */
  --accent-color: #2f6df6;
  --border-color: #e7e9ed;
}

/* ============================================================================
   RESET & GLOBALS
   ============================================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 14px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: "Helvetica Neue", Helvetica, Arial, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--accent-light); }

table { border-collapse: collapse; width: 100%; }
input, select, button { font-family: inherit; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c0c5cd; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #9aa1ac; }

/* ============================================================================
   LOGIN SAYFASI
   ============================================================================ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f2f5;
}

.login-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 3rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo h1 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent);
}

.login-logo p {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 0.3rem;
}

/* ============================================================================
   FORM ELEMENTLERİ
   ============================================================================ */
.form-group { margin-bottom: 1.2rem; }

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.93rem;
  transition: var(--transition);
  outline: none;
}

.form-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(47, 109, 246, 0.08);
}

.form-input::placeholder { color: var(--text-muted); }

select.form-input {
  appearance: none;
  background-color: var(--bg-input);
  color: var(--text-primary);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239aa1ac' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* ============================================================================
   BUTONLAR
   ============================================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.1rem;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  letter-spacing: 0.3px;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-light);
}

.btn-block { width: 100%; }

.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.75rem; }

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ============================================================================
   SIDEBAR
   ============================================================================ */
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 2000;
  transition: var(--transition-slow);
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border-light);
  height: var(--header-height);
}

.sidebar-header .logo-icon {
  width: 34px; height: 34px;
  background: var(--accent);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.sidebar-header .logo-text {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.1px;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-nav { flex: 1; padding: 18px 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 18px; }

.nav-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-section-title {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.1px;
  padding: 0 10px 8px 10px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.nav-item:hover { background: var(--bg-hover); }

.nav-item.active {
  background: var(--accent-bg);
  color: var(--accent);
  font-weight: 600;
}

.nav-item .nav-icon {
  width: 17px; height: 17px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  opacity: 0.62;
}

.nav-item.active .nav-icon { opacity: 1; }

.nav-item .nav-icon svg {
  width: 17px; height: 17px;
}

.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 9px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-light);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 14px;
}

.user-avatar {
  width: 34px; height: 34px;
  background: #eef2fb;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #3b6ae1;
  flex-shrink: 0;
}

.user-details { overflow: hidden; }
.user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11.5px; color: var(--text-muted); margin-top: 1px; }

.sidebar-footer .btn-ghost {
  text-align: center;
  padding: 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  letter-spacing: 0.3px;
  width: 100%;
}

.sidebar-footer .btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

/* ============================================================================
   HEADER
   ============================================================================ */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-width: 0;
  transition: var(--transition-slow);
}

.header {
  height: var(--header-height);
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 26px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-left { display: flex; align-items: center; gap: 1rem; }
.header-right { display: flex; align-items: center; gap: 16px; }

.page-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.header-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.badge-online { background: var(--success-bg); border: 1px solid var(--success-border); color: var(--success); }
.badge-offline { background: var(--danger-bg); border: 1px solid var(--danger-border); color: var(--danger); }
.badge-warning { background: var(--warning-bg); border: 1px solid var(--warning-border); color: var(--warning); }

/* ============================================================================
   İÇERİK ALANI
   ============================================================================ */
.content { flex: 1; padding: 24px 26px 40px 26px; overflow: auto; }

/* Grid */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ============================================================================
   KARTLAR
   ============================================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-light);
}

.card-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.7px;
}

.card-body { padding: 18px; }

/* Stat cards */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
}

.stat-card .stat-icon-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stat-card .stat-icon-row svg {
  width: 16px; height: 16px;
  flex-shrink: 0;
}

.stat-label { font-size: 12px; color: #6b7280; font-weight: 500; }
.stat-value { font-size: 28px; font-weight: 700; margin-top: 12px; letter-spacing: -0.5px; }
.stat-note { font-size: 11.5px; color: var(--text-muted); margin-top: 6px; }

/* legacy stat-card layout (icon left) */
.stat-icon {
  width: 46px; height: 46px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.stat-icon.blue { background: var(--accent-bg); color: var(--accent); }
.stat-icon.green { background: var(--success-bg); color: var(--success); }
.stat-icon.amber { background: var(--warning-bg); color: var(--warning); }
.stat-icon.red { background: var(--danger-bg); color: var(--danger); }
.stat-icon.cyan { background: var(--info-bg); color: var(--info); }
.stat-info { flex: 1; }

/* ============================================================================
   TABLO
   ============================================================================ */
.table-wrapper { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  padding: 12px 18px;
  font-size: 10.5px;
  font-weight: 700;
  color: #8b929d;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-table-head);
  white-space: nowrap;
}

.data-table td {
  padding: 14px 18px;
  font-size: 13px;
  border-bottom: 1px solid #f2f4f7;
  vertical-align: middle;
}

.data-table tbody tr { transition: var(--transition); }
.data-table tbody tr:hover { background: var(--bg-hover); }

/* ============================================================================
   HARİTA
   ============================================================================ */
.map-container {
  width: 100%;
  height: 420px;
  overflow: hidden;
  background: #eef0f3;
}

/* Canlı harita: sayfa ekrana tam sığar, kaydırma gerekmez.
   Üstteki durum rozetleri dahil hepsi görünür kalır. */
#page-map.active {
  display: flex;
  flex-direction: column;
  /* 64px = .content üst (24px) + alt (40px) dolgu */
  height: calc(100vh - var(--header-height) - 64px);
  min-height: 320px;
}
#page-map .card {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.map-container.fullscreen {
  flex: 1;
  height: 100%;
  min-height: 0;
}

.leaflet-container { background: #eef0f3; font-family: inherit; }

.vehicle-popup h4 { font-size: 0.9rem; margin-bottom: 0.5rem; color: var(--accent); }
.vehicle-popup .popup-row { display: flex; justify-content: space-between; padding: 0.2rem 0; font-size: 0.8rem; }
.vehicle-popup .popup-label { color: var(--text-muted); }
.vehicle-popup .popup-value { font-weight: 600; }

/* ============================================================================
   ALARM LİSTESİ (Dashboard son alarmlar)
   ============================================================================ */
.alarm-item {
  display: flex;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid #f2f4f7;
  transition: var(--transition);
}

.alarm-item:hover { background: var(--bg-hover); }
.alarm-item:last-child { border-bottom: none; }

.alarm-severity {
  width: 3px;
  border-radius: 2px;
  flex-shrink: 0;
}

.alarm-severity.critical { background: #d15b56; }
.alarm-severity.high { background: #d15b56; }
.alarm-severity.medium { background: #e0a112; }
.alarm-severity.low { background: #8ea6da; }

.alarm-info { flex: 1; min-width: 0; }
.alarm-type { font-size: 13px; font-weight: 600; }
.alarm-desc { font-size: 12.5px; color: #6b7280; margin-top: 3px; }
.alarm-time { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; }

/* ============================================================================
   STATUS BADGES & TAGS
   ============================================================================ */
.status-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
}

.status-dot.online { background: #22a06b; }
.status-dot.offline { background: #c0c5cd; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
}

.tag-success { background: var(--success-bg); color: var(--success); }
.tag-warning { background: var(--warning-bg); color: var(--warning); }
.tag-danger { background: var(--danger-bg); color: var(--danger); }
.tag-info { background: var(--info-bg); color: var(--info); }
.tag-neutral { background: #f2f4f7; color: #6b7280; }

/* ============================================================================
   TOAST BİLDİRİMLER
   ============================================================================ */
.toast-container {
  position: fixed;
  top: 1rem; right: 1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.8rem 1.2rem;
  min-width: 300px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.8rem;
  animation: slideIn 0.3s ease;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.warning { border-left: 3px solid #e0a112; }
.toast.info { border-left: 3px solid var(--accent); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ============================================================================
   MODAL
   ============================================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(2px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.modal-overlay.active { opacity: 1; visibility: visible; }

.modal {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px);
  transition: var(--transition);
}

.modal-overlay.active .modal { transform: translateY(0); }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid var(--border-light);
}

.modal-title { font-size: 1rem; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 1.3rem; cursor: pointer; }
.modal-close:hover { color: var(--text-primary); }
.modal-body { padding: 1.5rem; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border-light); display: flex; justify-content: flex-end; gap: 0.8rem; }

/* ============================================================================
   YÜKLEME ANİMASYONU
   ============================================================================ */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(246, 247, 249, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border-radius: inherit;
}

/* ============================================================================
   SAYFA GİZLE/GÖSTER
   ============================================================================ */
.page { display: none; }
.page.active { display: block; animation: fadeIn 0.2s ease; }

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ============================================================================
   BOŞLUK & YARDIMCI
   ============================================================================ */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.gap-1 { gap: 0.5rem; }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 13px; font-variant-numeric: tabular-nums; }
.fw-600 { font-weight: 600; }
.hidden { display: none !important; }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  margin: 0 auto 12px auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-state p { font-size: 13px; }

/* ============================================================================
   RESPONSIVE
   ============================================================================ */
#menuToggle { display: none; margin-right: 1rem; }

/* Kontrol panelindeki harita + alarm ikilisi.
   Onceden satir ici stille yazilmisti; satir ici stil medya
   sorgularini gecersiz kildigi icin telefonda iki sutun yan yana
   sikisiyordu (harita ~200px genislikte kaliyordu). Sinifa
   tasindi ki kucuk ekranda alt alta gecebilsin. */
.dashboard-split { grid-template-columns: 1.35fr 1fr; }

/* Karta gomulu harita: kenarliksiz, kartin kosesine oturur */
.map-embedded { height: 420px; border: none; border-radius: 0; }

/* Yanindaki kart kadar uzayan kart (alarm listesi) */
.card-stretch { display: flex; flex-direction: column; }
.card-stretch > .card-body { flex: 1; }

@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  #menuToggle { display: inline-flex; }
  .sidebar {
    transform: translateX(-100%);
    box-shadow: 2px 0 12px rgba(0,0,0,0.1);
  }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; width: 100vw; }

  /* Durum kutulari telefonda IKI sutun kalir. Tek sutuna
     dusurulurse dort kutu ust uste dizilip haritayi ekranin
     disina itiyor; kullanici once kaydirmak zorunda kaliyor. */
  .grid-4 { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }

  /* Harita ve alarm listesi alt alta */
  .dashboard-split { grid-template-columns: 1fr; }

  .map-container { height: 320px; }
  .map-embedded { height: 320px; }

  .flex-between { flex-direction: column; align-items: stretch; gap: 0.75rem; }
  .flex-between .flex { flex-wrap: wrap; gap: 8px; }
  .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Dar ekranda her piksel degerli: sayfa ve kart bosluklari kisilir */
  .content { padding: 16px 12px 32px 12px; }
  .card-header { padding: 12px 14px; }
  .card-body { padding: 14px; }
  .stat-card { padding: 14px 12px; }
  .stat-value { font-size: 22px; }
  .stat-label { font-size: 10.5px; }

  /* Filtre kutulari tam genislik — yan yana sikismasinlar */
  .form-input { width: 100%; max-width: none; }
  select.form-input { min-width: 0 !important; width: 100% !important; }

  /* Ust cubuk sadelesir */
  .header { padding: 0 12px; }
  .page-title { font-size: 17px; }

  /* Dokunma hedefleri: 44px Apple/Google'in onerdigi asgari boyut.
     Kucuk butonlar telefonda isabet ettirilemiyordu. */
  .btn-sm { min-height: 38px; }
  .nav-item { min-height: 44px; }
}

/* Cok dar telefonlar (iPhone SE vb.).
   Durum kutulari burada da IKI sutun kalir: tek sutuna dusurulunce
   dort kutu ust uste dizilip haritayi ekranin disina itiyor —
   kullanici panele girdiginde once bos kutular gorup kaydirmak
   zorunda kaliyordu. */
@media (max-width: 400px) {
  .grid-4 { gap: 8px; }
  .stat-card { padding: 12px 10px; }
  .stat-value { font-size: 20px; margin-top: 8px; }
  .stat-label { font-size: 10px; }
  .stat-note { font-size: 10.5px; }
  .map-embedded { height: 300px; }
}

/* ============================================================================
   ERİŞİLEBİLİRLİK
   ============================================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ============================================================================
   TAB YAPISI (Sanal Sınırlar / Güzergahlar)
   ============================================================================ */
.tab-bar {
  display: flex;
  gap: 6px;
  background: #eef0f3;
  border-radius: 7px;
  padding: 4px;
}

.tab-btn {
  background: transparent;
  border: none;
  color: #6b7280;
  padding: 7px 14px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  font-family: inherit;
  transition: var(--transition);
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  background: #ffffff;
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

/* ============================================================================
   TİP SEÇİM MODALİ
   ============================================================================ */
.type-selector-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  padding: 0.5rem 0;
}

.type-selector-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1.25rem 0.75rem;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.type-selector-item:hover {
  background: var(--accent-bg);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.type-selector-item .icon { font-size: 1.75rem; line-height: 1; }
.type-selector-item .label { font-size: 0.8rem; font-weight: 600; color: var(--text-primary); }
.type-selector-item .desc { font-size: 0.7rem; color: var(--text-muted); line-height: 1.3; }

.type-selector-divider {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.type-selector-divider::before,
.type-selector-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ============================================================================
   KORİDOR SLIDER
   ============================================================================ */
.corridor-slider-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.corridor-slider-group input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
  height: 6px;
}

.corridor-slider-group .corridor-value {
  min-width: 60px;
  text-align: right;
  font-weight: 600;
  color: var(--accent);
  font-size: 0.85rem;
}

/* ============================================================================
   ATAMA DURUM BADGE
   ============================================================================ */
.assignment-status {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
}

.assignment-status.status-active { background: var(--success-bg); color: var(--success); }
.assignment-status.status-completed { background: var(--info-bg); color: var(--info); }
.assignment-status.status-cancelled { background: var(--danger-bg); color: var(--danger); }

/* ============================================================================
   GEOFENCE LİSTE ÖĞESI
   ============================================================================ */
.geofence-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid #f2f4f7;
  cursor: pointer;
  transition: var(--transition);
}

.geofence-item:hover { background: var(--bg-hover); }

.geofence-item .zone-icon {
  width: 28px; height: 28px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.geofence-item .zone-name { font-size: 13px; font-weight: 600; }
.geofence-item .zone-meta { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }

.zone-kind-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  padding: 4px 9px;
  border-radius: 4px;
  margin-left: auto;
}

/* Map filter badges */
.map-filter-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 11px;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.map-filter-badge .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
}
