/* =============================================
   HAT YÖNETİMİ SAYFASI — routes.css
   ============================================= */

.routes-layout {
  display: grid;
  grid-template-columns: 280px 360px 1fr;
  gap: 14px;
  height: calc(100vh - var(--header-h) - 80px);
}

/* Sol: Hat Listesi */
.routes-left {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.routes-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.routes-toolbar input { flex: 1; }

.routes-list-container {
  flex: 1;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.route-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background 0.12s;
}

.route-list-item:last-child { border-bottom: none; }
.route-list-item:hover { background: #f3f4f6; }
.route-list-item.active { background: #eef2ff; border-left: 3px solid var(--primary); }

.route-list-badge {
  display: inline-flex;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  background: rgba(79,110,247,0.12);
  color: var(--primary);
  white-space: nowrap;
  min-width: 36px;
  justify-content: center;
}

.route-list-info {
  flex: 1;
  min-width: 0;
}

.route-list-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.route-list-meta {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  gap: 6px;
  align-items: center;
}

.route-list-meta .badge {
  font-size: 10px;
  padding: 1px 6px;
}

/* Orta: Detay paneli */
.routes-mid {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
}

/* Sağ: Harita alanı (büyük) */
.routes-map-area {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* Polyline legend */
.route-legend {
  display: flex;
  gap: 12px;
  padding: 6px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 500;
  flex-wrap: wrap;
  align-items: center;
}

.route-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
}

.route-legend-line {
  width: 22px;
  height: 4px;
  border-radius: 2px;
}

.route-legend-line.kml {
  background: #ef4444;
}

.route-legend-line.seg {
  background: #3b82f6;
  background-image: linear-gradient(90deg, #3b82f6 50%, transparent 50%);
  background-size: 8px 4px;
}

.route-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.2);
}
.route-legend-dot.route { background: #22c55e; }
.route-legend-dot.other { background: #9ca3af; }

.route-legend-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
  margin-left: auto;
}
.route-legend-toggle input { margin: 0; cursor: pointer; }

/* Direction tabs */
.route-direction-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  width: fit-content;
}

.route-dir-tab {
  padding: 6px 20px;
  border: none;
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.15s;
  font-family: var(--font);
}

.route-dir-tab:hover { background: #f3f4f6; }
.route-dir-tab.active { background: var(--primary); color: #fff; }

/* Workflow Tabs */
.route-workflow-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 12px;
  border-bottom: 2px solid var(--border-light);
}

.route-wf-tab {
  padding: 8px 16px;
  border: none;
  background: transparent;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s;
  font-family: var(--font);
  display: flex;
  align-items: center;
  gap: 6px;
}

.route-wf-tab:hover { color: var(--text); }
.route-wf-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.route-wf-tab i { font-size: 14px; }

/* Workflow panes */
.route-wf-pane { display: none; }
.route-wf-pane.active { display: block; }

/* Harita */
.route-map {
  flex: 1;
  width: 100%;
  height: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  min-height: 500px;
  background: #e5e7eb;
}

/* Durak listesi (güzergah tab'ında) */
.route-stops-list {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}

.route-stop-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-light);
  font-size: 12.5px;
}

.route-stop-item:last-child { border-bottom: none; }

.route-stop-seq {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.route-stop-name {
  flex: 1;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.route-stop-side {
  font-size: 11px;
  font-weight: 600;
}
.route-stop-side.left { color: var(--green); }
.route-stop-side.right { color: var(--yellow); }

.route-stop-remove {
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 2px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}

.route-stop-item:hover .route-stop-remove { opacity: 1; }
.route-stop-remove:hover { color: var(--red); background: rgba(239,68,68,0.1); }

/* Segment listesi */
.segment-list {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.segment-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-light);
  font-size: 12px;
}

.segment-item:last-child { border-bottom: none; }

.segment-label { flex: 1; font-weight: 500; }
.segment-dist { color: var(--text-muted); font-size: 11px; }

/* Hat ekleme formu */
.route-add-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-top: 12px;
}

/* Boş seçim durumu */
.route-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  gap: 12px;
}

.route-empty-state i { font-size: 48px; opacity: 0.3; }
.route-empty-state p { font-size: 14px; }

/* Durak Modal */
.stop-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}

.stop-modal-box {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  width: 360px;
  max-width: 92vw;
  font-family: var(--font);
  overflow: hidden;
  animation: stopModalIn 0.15s ease-out;
}

@keyframes stopModalIn {
  from { opacity: 0; transform: translateY(-10px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.stop-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 14px;
}

.stop-modal-close {
  background: none;
  border: none;
  font-size: 20px;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
}
.stop-modal-close:hover { color: var(--red); }

.stop-modal-body {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stop-modal-field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.stop-modal-radios {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.stop-modal-radios label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
  margin-bottom: 0;
}

.stop-modal-radios input[type=radio] { cursor: pointer; }

.stop-modal-foot {
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background: #f9fafb;
}

@media (max-width: 1200px) {
  .routes-layout {
    grid-template-columns: 260px 320px 1fr;
  }
}

@media (max-width: 900px) {
  .routes-layout {
    grid-template-columns: 1fr;
    height: auto;
  }
  .routes-map-area { min-height: 400px; }
  .route-map { min-height: 400px; }
}
