/* ═══════════════════════════════════════════════════════════════
   Distributor Map — Frontend Styles
   Layout: map LEFT + panel RIGHT on desktop/tablet
           map TOP  + panel BOTTOM on mobile
═══════════════════════════════════════════════════════════════ */

/* ── Outer wrapper — no max-width clamp here; layout handles it */
.dm-wrap {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  position: relative;
  width: 100%;
  box-sizing: border-box;
}

/* ── Side-by-side grid (desktop & tablet ≥ 768px) ── */
.dm-layout {
  display: grid;
  grid-template-columns: 1fr 340px;   /* map | panel */
  gap: 20px;
  align-items: start;
  width: 100%;
  box-sizing: border-box;
}

/* ── Map column ── */
.dm-map-container {
  position: relative;
  width: 100%;
  min-width: 0;          /* prevent grid blowout */
}
.dm-map-container svg {
  width: 100%;
  height: auto;
  display: block;
}

/* ── State paths ── */
#dm-svg path {
  fill: #e8edf4;
  stroke: #b0bccc;
  stroke-width: 0.7px;
  cursor: pointer;
  fill-rule: evenodd;
  transition: filter .18s ease, stroke-width .15s ease;
}
#dm-svg path:hover {
  filter: brightness(.86);
  stroke-width: 1.2px;
}
#dm-svg path.dm-active {
  filter: brightness(.92) !important;
  stroke: #e75204;
  stroke-width: 2px;
	fill:#e75204 !important;
}

/* ── Tooltip ── */
#dm-tooltip-el {
  position: fixed;
  pointer-events: none;
  background: #1e293b;
  color: #f1f5f9;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0;
  transition: opacity .12s ease;
  z-index: 9999;
  box-shadow: 0 4px 16px rgba(0,0,0,.28);
}
#dm-tooltip-el.dm-visible { opacity: 1; }

/* ═══════════════════════════════════════════════════════════════
   PANEL COLUMN (right on desktop, bottom on mobile)
═══════════════════════════════════════════════════════════════ */

.dm-panel-col {
  position: sticky;
  top: 24px;                  /* sticks while user scrolls page */
  align-self: start;
  min-width: 0;
}

#dm-info-panel {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,.07);
  transition: border-color .2s ease, box-shadow .2s ease;
  /* Fixed height on desktop so cards scroll within panel */
  max-height: calc(100vh - 80px);
  display: flex;
  flex-direction: column;
}
#dm-info-panel.dm-active-panel {
  border-color: #3b82f6;
  box-shadow: 0 4px 16px rgba(59,130,246,.14);
}

/* ── Empty / default state ── */
.dm-panel-default {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 36px 24px;
  color: #94a3b8;
  flex: 1;
  gap: 10px;
}
.dm-panel-default svg { stroke: #cbd5e1; }
.dm-panel-default h3 {
  font-size: .95rem;
  font-weight: 700;
  color: #64748b;
  margin: 0;
}
.dm-panel-default p {
  font-size: .82rem;
  color: #94a3b8;
  margin: 0;
  line-height: 1.5;
}

/* ── State header strip ── */
.dm-panel-header {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}
.dm-panel-code {
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: .1em;
  color: #fff;
  background: rgba(0,0,0,.18);
  padding: 2px 9px;
  border-radius: 5px;
  white-space: nowrap;
  flex-shrink: 0;
}
.dm-panel-sname {
  font-size: .9rem;
  font-weight: 700;
  color: rgba(255,255,255,.92);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Scrollable body ── */
.dm-panel-body {
  padding: 14px 16px;
  overflow-y: auto;
  flex: 1;
  /* Custom scrollbar */
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}
.dm-panel-body::-webkit-scrollbar { width: 5px; }
.dm-panel-body::-webkit-scrollbar-track { background: transparent; }
.dm-panel-body::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

.dm-no-dist {
  color: #94a3b8;
  font-size: .85rem;
  text-align: center;
  padding: 16px 0;
  margin: 0;
}

/* ── Distributor cards — single column inside panel ── */
.dm-dist-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.dm-dist-card {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 13px 14px;
  font-size: .82rem;
  line-height: 1.55;
  background: #fafbfd;
  transition: box-shadow .15s, border-color .15s, background .15s;
}
.dm-dist-card:hover {
  box-shadow: 0 3px 10px rgba(0,0,0,.08);
  border-color: #93c5fd;
  background: #fff;
}
.dm-dist-name {
  font-weight: 700;
  color: #0f172a;
  font-size: .9rem;
  display: block;
  margin-bottom: 8px;
  line-height: 1.3;
}
.dm-dist-row {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  margin-bottom: 4px;
  color: #64748b;
  font-size: .78rem;
}
.dm-dist-row svg {
  flex-shrink: 0;
  margin-top: 1px;
  opacity: .7;
}
.dm-dist-row a {
  color: #2563eb;
  text-decoration: none;
  word-break: break-all;
}
.dm-dist-row a:hover { text-decoration: underline; }
.dm-dist-meta-label {
  font-weight: 600;
  color: #94a3b8;
  margin-right: 2px;
  flex-shrink: 0;
  white-space: nowrap;
}

/* ── Action buttons ── */
.dm-dist-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid #f1f5f9;
}
.dm-btn-readmore {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 11px;
  background: #2563eb;
  color: #fff;
  border-radius: 5px;
  font-size: .73rem;
  font-weight: 700;
  text-decoration: none;
  transition: background .15s;
  white-space: nowrap;
}
.dm-btn-readmore:hover { background: #1d4ed8; color: #fff; text-decoration: none; }
.dm-btn-website {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 11px;
  background: #f1f5f9;
  color: #334155;
  border-radius: 5px;
  font-size: .73rem;
  font-weight: 700;
  text-decoration: none;
  border: 1px solid #e2e8f0;
  transition: background .15s;
  white-space: nowrap;
}
.dm-btn-website:hover { background: #e2e8f0; text-decoration: none; color: #0f172a; }

/* ═══════════════════════════════════════════════════════════════
   TABLET  (768px – 1023px) — keep side-by-side, narrower panel
═══════════════════════════════════════════════════════════════ */
@media (min-width: 768px) and (max-width: 1023px) {
  .dm-layout {
    grid-template-columns: 1fr 280px;
    gap: 14px;
  }
  .dm-panel-col {
    top: 16px;
  }
  #dm-info-panel {
    max-height: calc(100vh - 60px);
  }
}

/* ═══════════════════════════════════════════════════════════════
   MOBILE  (< 768px) — stack vertically
═══════════════════════════════════════════════════════════════ */
@media (max-width: 767px) {
  .dm-layout {
    grid-template-columns: 1fr;   /* single column */
    gap: 12px;
  }

  /* Panel is no longer sticky — flows naturally below map */
  .dm-panel-col {
    position: static;
  }

  /* Remove fixed height; let content expand naturally */
  #dm-info-panel {
    max-height: none;
  }

  /* Cards go back to single-column (already flex-direction column, no change needed) */
  .dm-dist-card {
    font-size: .85rem;
  }
}
