/* ============================================================
   RouteRunner – Industrial/Utilitarian theme
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Barlow:wght@400;600;700;900&display=swap');

:root {
  --bg:         #0f0f0f;
  --surface:    #191919;
  --surface-2:  #222222;
  --border:     #2e2e2e;
  --accent:     #f5c518;
  --accent-dim: #c49d0e;
  --text:       #e8e8e8;
  --text-muted: #7a7a7a;
  --green:      #3ddc84;
  --red:        #ff5a5a;
  --radius:     4px;
  --font-body:  'Barlow', sans-serif;
  --font-mono:  'DM Mono', monospace;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
}

/* ── Layout ── */
.layout { display: flex; flex-direction: column; min-height: 100vh; }

.header {
  background: var(--surface);
  border-bottom: 2px solid var(--accent);
  position: sticky; top: 0; z-index: 100;
}
.header-inner {
  max-width: 1100px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px;
}

.logo { display: flex; align-items: center; gap: 10px; }
.logo-icon { font-size: 24px; color: var(--accent); line-height: 1; }
.logo-icon img {
  width: 48px;      /* change size here */
  height: 48px;     /* keep same for square logos */
  object-fit: contain;
  display: block;
}
.logo-text {
  font-size: 20px; font-weight: 900; letter-spacing: -0.5px;
  text-transform: uppercase;
}

.main {
  max-width: 1100px; margin: 0 auto; width: 100%;
  padding: 32px 24px;
  display: flex; flex-direction: column; gap: 32px;
}

/* ── Buttons ── */
.btn-primary {
  background: var(--accent); color: #000;
  font-family: var(--font-body); font-weight: 700; font-size: 14px;
  text-transform: uppercase; letter-spacing: 0.5px;
  padding: 10px 20px; border-radius: var(--radius);
  border: none; cursor: pointer; text-decoration: none;
  transition: background 0.15s;
}
.btn-primary:hover { background: var(--accent-dim); }

.btn-ghost {
  background: transparent; color: var(--text-muted);
  font-family: var(--font-body); font-size: 14px;
  border: 1px solid var(--border); padding: 9px 16px;
  border-radius: var(--radius); cursor: pointer; text-decoration: none;
  transition: color 0.15s, border-color 0.15s;
}
.btn-ghost:hover { color: var(--text); border-color: var(--text-muted); }

.btn-add {
  background: var(--accent); color: #000;
  font-family: var(--font-body); font-weight: 700; font-size: 14px;
  text-transform: uppercase; letter-spacing: 0.5px;
  padding: 0 28px; border: none; border-radius: var(--radius);
  cursor: pointer; white-space: nowrap; align-self: flex-end; height: 48px;
  transition: background 0.15s;
}
.btn-add:hover { background: var(--accent-dim); }
.btn-add:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Panels ── */
.add-panel, .stops-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.panel-title {
  font-size: 13px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1.5px; color: var(--text-muted);
  margin-bottom: 16px;
}

/* ── Form ── */
.form-row {
  display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap;
}
.field { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 140px; }

label {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 1px; color: var(--text-muted);
}

input[type="text"] {
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); font-family: var(--font-mono); font-size: 15px;
  padding: 12px 14px; border-radius: var(--radius);
  outline: none; height: 48px;
  transition: border-color 0.15s;
}
input[type="text"]:focus { border-color: var(--accent); }
input[type="text"]::placeholder { color: var(--text-muted); }

/* ── Error ── */
.error-msg {
  margin-top: 12px; padding: 10px 14px;
  background: rgba(255,90,90,0.1); border: 1px solid var(--red);
  border-radius: var(--radius); color: var(--red);
  font-size: 13px; font-family: var(--font-mono);
}
.hidden { display: none !important; }

/* ── Stop list (shared) ── */
.stops-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.stops-header .panel-title { margin-bottom: 0; }

.badge {
  background: var(--accent); color: #000;
  font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 20px; font-family: var(--font-mono);
}

.stop-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }

.stop-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  transition: border-color 0.2s, opacity 0.3s;
  animation: slide-in 0.2s ease;
}
.stop-item.done {
  opacity: 0.45;
  border-color: var(--green);
}
.stop-item.done .stop-address { text-decoration: line-through; color: var(--text-muted); }

@keyframes slide-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.stop-num {
  font-family: var(--font-mono); font-size: 11px; color: var(--text-muted);
  min-width: 24px;
}
.stop-address {
  flex: 1; font-weight: 600; font-size: 15px;
}
.stop-coords {
  font-family: var(--font-mono); font-size: 11px; color: var(--text-muted);
}
.stop-done-badge {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--green);
}

.stop-actions { display: flex; gap: 8px; }

.btn-done, .btn-remove {
  font-family: var(--font-body); font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px;
  padding: 6px 12px; border-radius: var(--radius); border: none;
  cursor: pointer; transition: background 0.15s;
}
.btn-done {
  background: rgba(61,220,132,0.12); color: var(--green);
  border: 1px solid var(--green);
}
.btn-done:hover { background: rgba(61,220,132,0.25); }
.btn-remove {
  background: rgba(255,90,90,0.08); color: var(--red);
  border: 1px solid var(--red);
}
.btn-remove:hover { background: rgba(255,90,90,0.2); }

.empty-state {
  color: var(--text-muted); font-size: 14px;
  padding: 24px 0; text-align: center;
}

/* ── Route page layout ── */
.route-layout { height: 100vh; overflow: hidden; }

.route-body {
  display: flex; flex: 1; height: calc(100vh - 58px);
}

.sidebar {
  width: 340px; min-width: 280px;
  background: var(--surface); border-right: 1px solid var(--border);
  padding: 20px; overflow-y: auto; flex-shrink: 0;
}
.sidebar-header {
  display: flex; align-items: center; gap: 10px; margin-bottom: 16px;
}
.sidebar-header .panel-title { margin-bottom: 0; }

#map { flex: 1; }

/* ── Leaflet overrides ── */
.leaflet-container { background: #1a1a1a !important; }
.leaflet-tile { filter: brightness(0.85) saturate(0.7); }

/* Route stop items in sidebar */
.route-stop-item {
  display: flex; flex-direction: column; gap: 4px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px;
  margin-bottom: 8px; cursor: pointer;
  transition: border-color 0.15s;
}
.route-stop-item:hover { border-color: var(--accent); }
.route-stop-item.done { opacity: 0.4; border-color: var(--green); }
.route-stop-item .stop-address { font-weight: 600; }
.route-stop-item .stop-coords { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }

.btn-done-route {
  margin-top: 8px; width: 100%;
  background: rgba(61,220,132,0.1); color: var(--green);
  border: 1px solid var(--green); border-radius: var(--radius);
  font-family: var(--font-body); font-weight: 700; font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.5px;
  padding: 8px; cursor: pointer; transition: background 0.15s;
}
.btn-done-route:hover { background: rgba(61,220,132,0.25); }
.btn-done-route:disabled { opacity: 0.3; cursor: default; }

.btn-navigate-route {
  margin-top: 8px;
  width: 100%;

  background: rgba(66, 133, 244, 0.1);
  color: #4285f4;

  border: 1px solid #4285f4;
  border-radius: var(--radius);

  font-family: var(--font-body);
  font-weight: 700;
  font-size: 12px;

  text-transform: uppercase;
  letter-spacing: 0.5px;

  padding: 8px;
  cursor: pointer;

  transition: background 0.15s, transform 0.1s;
}

.btn-navigate-route:hover {
  background: rgba(66, 133, 244, 0.18);
}

.btn-navigate-route:active {
  transform: scale(0.98);
}

/* ── Sidebar collapse ── */
.collapse-btn {
  position: absolute;
  top: 50%;
  left: 340px;
  transform: translateY(-50%);
  z-index: 500;
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-left: none;
  width: 20px;
  height: 56px;
  border-radius: 0 var(--radius) var(--radius) 0;
  cursor: pointer;
  font-size: 10px;
  padding: 0;
  transition: left 0.3s ease, color 0.15s;
}
.collapse-btn:hover { color: var(--text); }

.route-body { position: relative; }

.sidebar {
  transition: width 0.3s ease, padding 0.3s ease;
  overflow: hidden;
}
.sidebar.collapsed {
  width: 0;
  padding: 0;
  border: none;
  min-width: 0px;
}
.sidebar.collapsed .collapse-btn {
  left: 0;
}
/* Move button when sidebar is collapsed */
.sidebar.collapsed ~ .collapse-btn {
  left: 0;
}