/* =========================================================
   Docka — Harita Arayüzü
   Maritime dark theme — coldengine.tech
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ----- CSS Değişkenleri ----- */
:root {
  --bg:           #060e1f;
  --panel-bg:     rgba(6, 14, 31, 0.88);
  --card-bg:      rgba(255, 255, 255, 0.04);
  --border:       rgba(255, 255, 255, 0.08);
  --border-hover: rgba(14, 165, 233, 0.35);

  --blue:         #0ea5e9;
  --blue-dim:     rgba(14, 165, 233, 0.15);
  --amber:        #f59e0b;
  --amber-dim:    rgba(245, 158, 11, 0.15);
  --green:        #22c55e;
  --yellow:       #eab308;
  --red:          #ef4444;

  --text-1:       #f1f5f9;
  --text-2:       #94a3b8;
  --text-3:       #64748b;
}

/* ----- Reset ----- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text-1);
}

/* ----- Harita ----- */
#map {
  position: fixed;
  inset: 0;
  z-index: 1;
}

/* Leaflet popup özelleştirme */
.leaflet-popup-content-wrapper {
  background: #0d1e35;
  border: 1px solid var(--border-hover);
  color: var(--text-1);
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.5);
}
.leaflet-popup-tip { background: #0d1e35; }
.leaflet-popup-content { font-size: 0.85rem; line-height: 1.6; }

/* ----- Sağ Panel ----- */
.panel {
  position: fixed;
  top: 0; right: 0;
  width: 340px; height: 100vh;
  background: var(--panel-bg);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border-left: 1px solid var(--border);
  z-index: 200;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ----- Panel Başlık ----- */
.panel-header {
  padding: 1.25rem 1.5rem 1rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

.brand-icon {
  font-size: 1.4rem;
  line-height: 1;
}

.brand-name {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-1);
}

.brand-name span {
  color: var(--blue);
}

.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-3);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
  animation: pulse-dot 2s infinite;
}

.status-dot.offline { background: var(--red); box-shadow: 0 0 6px var(--red); animation: none; }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ----- Bölge Göstergesi ----- */
.zones-legend {
  padding: 0.85rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 1rem;
  flex-shrink: 0;
}

.zone-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  color: var(--text-2);
}

.zone-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ----- Siparişler ----- */
.orders-section {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.5rem;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.orders-section::-webkit-scrollbar { width: 4px; }
.orders-section::-webkit-scrollbar-track { background: transparent; }
.orders-section::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.section-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.order-count-badge {
  background: var(--blue-dim);
  color: var(--blue);
  border: 1px solid rgba(14,165,233,0.25);
  border-radius: 20px;
  padding: 0.1rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.orders-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.order-item {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: border-color 0.2s, background 0.2s;
  cursor: pointer;
}

.order-item:hover {
  border-color: var(--border-hover);
  background: rgba(14,165,233,0.04);
}

.order-seq {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--blue-dim);
  border: 1px solid rgba(14,165,233,0.3);
  color: var(--blue);
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.order-body {
  flex: 1;
  min-width: 0;
}

.order-id {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.order-coords {
  font-size: 0.7rem;
  color: var(--text-3);
  margin-top: 0.1rem;
  font-variant-numeric: tabular-nums;
}

.order-amount {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--amber);
  white-space: nowrap;
  flex-shrink: 0;
}

.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-3);
  font-size: 0.85rem;
}

.empty-icon { font-size: 2rem; margin-bottom: 0.5rem; }

/* ----- Rota Bilgi Kartı ----- */
.route-panel {
  display: none;
  margin: 0 1.5rem 1rem;
  background: var(--amber-dim);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  flex-shrink: 0;
}

.route-panel.visible { display: block; }

.route-panel-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--amber);
  margin-bottom: 0.5rem;
}

.route-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.5rem;
}

.route-stat {
  text-align: center;
}

.route-stat-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-1);
  font-variant-numeric: tabular-nums;
}

.route-stat-label {
  font-size: 0.65rem;
  color: var(--text-3);
  margin-top: 0.1rem;
}

/* ----- Optimize Butonu ----- */
.panel-footer {
  padding: 1rem 1.5rem 1.25rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.btn-optimize {
  width: 100%;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(135deg, var(--blue), #0284c7);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-optimize:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-optimize:active { transform: translateY(0); }
.btn-optimize:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-clear {
  width: 100%;
  padding: 0.55rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-3);
  font-family: 'Inter', sans-serif;
  font-size: 0.75rem;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.btn-clear:hover { border-color: var(--red); color: var(--red); }

/* ----- Özel Marker İkonları ----- */
.depot-marker-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.6));
}

.route-num-icon {
  width: auto; height: 24px;
  padding: 0 6px;
  border-radius: 12px;
  background: var(--amber); /* Yedek renk, inline ezilir */
  border: 2px solid #fff;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

/* ----- Bildirim Toast ----- */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #1e3a5f;
  border: 1px solid var(--border-hover);
  color: var(--text-1);
  padding: 0.65rem 1.25rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 500;
  z-index: 999;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
  pointer-events: none;
}

.toast.show { transform: translateX(-50%) translateY(0); }
.toast.error { background: #3f0e0e; border-color: rgba(239,68,68,0.4); }

/* ----- Responsive ----- */
@media (max-width: 640px) {
  .panel {
    width: 100%;
    height: 45vh;
    top: auto;
    bottom: 0;
    border-left: none;
    border-top: 1px solid var(--border);
  }

  #map { height: 55vh; }
}
