/* ============================================================
   Aweta NY Lead Map — page-specific styles
   Aweta branding (from aweta.com):
   #DB0032 primary red, #a20025 dark red, #a7a7a7 neutral gray,
   black + white for text.
   ============================================================ */

:root {
  --aw-primary: #DB0032;
  --aw-primary-dark: #a20025;
  --aw-text-dark: #1a1a1a;
  --aw-secondary: #1a1a1a;
  --aw-neutral: #a7a7a7;
  --aw-light: #e5e7eb;
  --aw-gray: #6b7280;
  --aw-bg-tint: #fde8ec;
  --aw-bg-soft: #f9fafb;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; font-family: "Helvetica Neue", Roboto, Helvetica, Arial, sans-serif; color: #1f2937; }
body { overflow: hidden; background: #f1f1f1; }
a { color: var(--aw-primary); }

#map { position: absolute; inset: 0; height: 100vh; width: 100%; z-index: 1; }

/* --- Sidebar --- */
.sidebar {
  position: fixed; top: 16px; right: 16px; z-index: 1000;
  width: 380px; max-height: calc(100vh - 32px);
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(26, 26, 46, 0.18);
  display: flex; flex-direction: column;
  overflow: hidden;
  font-size: 13px;
}

.sidebar.collapsed { transform: translateX(calc(100% + 16px)); transition: transform 0.25s ease; }
.sidebar:not(.collapsed) { transition: transform 0.25s ease; }

.sidebar-toggle {
  position: absolute; top: 10px; right: 10px;
  width: 26px; height: 26px;
  border: none; border-radius: 50%;
  background: transparent; color: var(--aw-gray);
  font-size: 22px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  z-index: 5;
}
.sidebar-toggle:hover { background: var(--aw-bg-tint); color: var(--aw-primary); }

.sidebar-show {
  position: fixed; top: 16px; right: 16px; z-index: 1000;
  width: 44px; height: 44px;
  padding: 0;
  border: none; border-radius: 50%;
  background: var(--aw-primary); color: #fff;
  font-size: 18px; line-height: 1; cursor: pointer;
  box-shadow: 0 4px 14px rgba(219, 0, 50, 0.35);
  display: none; align-items: center; justify-content: center;
  font-family: inherit;
}
.sidebar-show.is-visible { display: flex; }
.sidebar-show:hover { background: var(--aw-primary-dark); }

/* Header */
.sb-header {
  padding: 18px 20px 16px;
  border-bottom: 3px solid var(--aw-primary);
  background: #fff;
}
.sb-logo { display: block; height: 32px; width: auto; margin-bottom: 6px; }
.sb-subtitle { font-size: 12px; color: var(--aw-gray); font-weight: 500; letter-spacing: 0.3px; }
.sb-back {
  display: inline-block; margin-top: 8px;
  font-size: 11px; color: var(--aw-primary); text-decoration: none;
  font-weight: 600;
}
.sb-back:hover { text-decoration: underline; }

/* Stats */
.sb-stats { display: flex; gap: 6px; padding: 16px 20px 12px; border-bottom: 1px solid #ecf0f1; }
.sb-stats .stat { flex: 1; text-align: center; }
.sb-stats .num { font-size: 20px; font-weight: 700; color: var(--aw-primary); line-height: 1.1; }
.sb-stats .label { font-size: 10px; color: var(--aw-gray); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 2px; }

/* Legend */
.sb-legend { display: flex; gap: 14px; padding: 12px 20px 0; flex-wrap: wrap; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--aw-gray); }
.legend-dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid white; box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
.legend-dot.a { background: var(--aw-primary); }
.legend-dot.b { background: var(--aw-primary-dark); }
.legend-dot.r { background: var(--aw-neutral); }

/* Search */
.sb-search {
  width: calc(100% - 40px); margin: 12px 20px 8px;
  padding: 10px 12px; border: 1px solid #dde3e6; border-radius: 8px;
  font-size: 13px; font-family: inherit;
  outline: none; transition: border 0.15s, box-shadow 0.15s;
}
.sb-search:focus { border-color: var(--aw-primary); box-shadow: 0 0 0 3px rgba(219, 0, 50, 0.1); }

.sb-filter-row { padding: 4px 20px 12px; }
.sb-filter-row label {
  display: inline-flex; align-items: center; gap: 6px;
  margin-right: 16px; font-size: 13px; color: #1f2937;
  cursor: pointer; font-weight: 500;
}
.sb-filter-row input[type="checkbox"] { accent-color: var(--aw-primary); width: 14px; height: 14px; }

/* Company list */
.sb-list-header {
  padding: 10px 20px 6px; font-size: 11px; text-transform: uppercase;
  color: var(--aw-gray); font-weight: 600; letter-spacing: 0.5px;
  border-top: 1px solid #ecf0f1;
}
.sb-list-count { color: var(--aw-primary); font-weight: 700; }
.sb-list {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 4px 12px 12px;
  min-height: 100px;
  max-height: 260px;
}
.company-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 7px 10px; margin: 1px 0; border-radius: 6px;
  font-size: 12px; cursor: pointer;
  color: #1f2937;
}
.company-item:hover { background: var(--aw-bg-tint); }
.company-item .ci-name { font-weight: 500; line-height: 1.3; padding-right: 8px; }
.company-item .ci-meta { font-size: 10px; color: var(--aw-gray); margin-top: 1px; }
.company-item .score-badge {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 10px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.company-item .score-badge.a { background: var(--aw-primary); }
.company-item .score-badge.b { background: var(--aw-primary-dark); }
.company-item .score-badge.r { background: var(--aw-neutral); color: var(--aw-white); }

/* Route planner */
.sb-route {
  border-top: 1px solid #ecf0f1;
  padding: 14px 20px 18px;
  background: var(--aw-bg-soft);
}
.sb-route h3 {
  font-size: 12px; text-transform: uppercase; color: var(--aw-primary);
  letter-spacing: 0.5px; margin-bottom: 6px; font-weight: 700;
}
.sb-route-hint { font-size: 11px; color: var(--aw-gray); margin-bottom: 8px; }
.route-list { list-style: none; max-height: 140px; overflow-y: auto; }
.route-list li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 7px 10px; margin: 3px 0;
  background: #fff; border: 1px solid #e5e7eb; border-radius: 6px;
  font-size: 12px;
}
.route-list li .num { font-weight: 700; color: var(--aw-primary); margin-right: 6px; min-width: 18px; }
.route-list li .remove {
  cursor: pointer; color: var(--aw-gray); font-weight: bold; font-size: 16px;
  padding: 0 4px; user-select: none;
}
.route-list li .remove:hover { color: var(--aw-primary); }
.sb-route-actions { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }

/* Buttons */
.btn {
  display: inline-block;
  padding: 9px 14px;
  border: none; border-radius: 8px;
  cursor: pointer;
  font-size: 12px; font-weight: 600; font-family: inherit;
  text-decoration: none; text-align: center;
  transition: background 0.15s, transform 0.05s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--aw-primary); color: #fff; }
.btn-primary:hover { background: var(--aw-primary-dark); }
.btn-ghost { background: transparent; color: var(--aw-gray); border: 1px solid #dde3e6; }
.btn-ghost:hover { background: #f3f4f6; color: var(--aw-primary); }
.btn-sm { padding: 7px 12px; font-size: 11px; }

/* --- Marker icon --- */
.aw-marker {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 11px;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.35);
}
.aw-marker.a { background: var(--aw-primary); }
.aw-marker.b { background: var(--aw-primary-dark); }
.aw-marker.r { background: var(--aw-neutral); color: var(--aw-white); }

/* Override marker cluster colors — Aweta red palette */
.marker-cluster-small { background-color: rgba(219, 0, 50, 0.45); }
.marker-cluster-small div { background-color: rgba(219, 0, 50, 0.85); color: #fff; font-weight: 700; }
.marker-cluster-medium { background-color: rgba(162, 0, 37, 0.5); }
.marker-cluster-medium div { background-color: rgba(162, 0, 37, 0.9); color: #fff; font-weight: 700; }
.marker-cluster-large { background-color: rgba(26, 26, 26, 0.45); }
.marker-cluster-large div { background-color: rgba(26, 26, 26, 0.85); color: #fff; font-weight: 700; }

/* --- Popup --- */
.leaflet-popup-content-wrapper { border-radius: 12px; padding: 0; }
.leaflet-popup-content { font-size: 12px; line-height: 1.55; max-width: 320px; min-width: 280px; margin: 0; padding: 0; }
.leaflet-popup-tip { background: #fff; }

.lp {
  font-family: 'Inter', sans-serif;
  padding: 14px 16px;
}
.lp-title { font-weight: 700; font-size: 15px; color: var(--aw-secondary); margin-bottom: 4px; line-height: 1.3; }
.lp-tier {
  display: inline-block; padding: 2px 9px; border-radius: 10px;
  font-size: 10px; font-weight: 700; color: #fff; margin-bottom: 8px;
  letter-spacing: 0.5px; text-transform: uppercase;
}
.lp-tier.a { background: var(--aw-primary); }
.lp-tier.b { background: var(--aw-primary-dark); }
.lp-tier.r { background: var(--aw-neutral); color: var(--aw-white); }
.lp-approx { font-size: 10px; color: #c47a00; margin-bottom: 6px; }
.lp-summary { font-size: 12px; color: #1f2937; margin-bottom: 8px; line-height: 1.5; }
.lp-section {
  border-top: 1px solid #ecf0f1; padding-top: 8px; margin-top: 8px;
}
.lp-section-title {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--aw-gray); font-weight: 600; margin-bottom: 5px;
}
.lp-field { margin: 3px 0; }
.lp-field strong { color: #1f2937; font-weight: 600; }
.lp-field a { color: var(--aw-primary); text-decoration: none; }
.lp-field a:hover { text-decoration: underline; }
.lp-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; padding-top: 10px; border-top: 1px solid #ecf0f1; }
.lp-actions .btn { flex: 1 1 auto; min-width: 0; }

/* --- Mobile --- */
@media (max-width: 768px) {
  .sidebar {
    width: calc(100% - 16px);
    top: auto; bottom: 8px; right: 8px; left: 8px;
    max-height: 55vh;
  }
  .sb-list { max-height: 140px; }
  .route-list { max-height: 100px; }
  .sb-stats .num { font-size: 18px; }
}
