/* ==============================================
   Akeenah Branch Map Pro — Frontend Styles v2
   ============================================== */
:root {
  --abm-accent:   #b6d432;
  --abm-accent2:  #8faa1e;
  --abm-dark:     #1a1f2e;
  --abm-darker:   #131720;
  --abm-card:     #222840;
  --abm-border:   rgba(182,212,50,.18);
  --abm-text:     #f0f2f8;
  --abm-muted:    #8892a4;
  --abm-radius:   12px;
  --abm-shadow:   0 8px 32px rgba(0,0,0,.32);
}

/* ---- Wrapper ---- */
.abm-wrapper {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--abm-darker);
  border-radius: var(--abm-radius);
  overflow: hidden;
  box-shadow: var(--abm-shadow);
  display: flex;
  flex-direction: column;
  color: var(--abm-text);
  margin: 1.6em 0;
}

/* ---- Top Bar ---- */
.abm-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  background: var(--abm-dark);
  border-bottom: 1px solid var(--abm-border);
  flex-wrap: wrap;
}
.abm-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 15px;
  color: var(--abm-text);
  white-space: nowrap;
}
.abm-brand-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--abm-accent);
  animation: abm-glow 2s infinite;
}
@keyframes abm-glow {
  0%,100% { box-shadow: 0 0 0 0 rgba(182,212,50,.6); }
  50%      { box-shadow: 0 0 0 6px rgba(182,212,50,0); }
}
.abm-brand-tag {
  background: rgba(182,212,50,.15);
  color: var(--abm-accent);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  border: 1px solid var(--abm-border);
}
.abm-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  flex-wrap: wrap;
}
.abm-search-wrap {
  position: relative;
  flex: 1;
  min-width: 180px;
}
.abm-search-icon {
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%);
  width: 15px; height: 15px;
  color: var(--abm-muted);
  pointer-events: none;
}
#abm-search {
  width: 100%;
  padding: 8px 32px 8px 34px;
  background: var(--abm-card);
  border: 1px solid var(--abm-border);
  border-radius: 8px;
  color: var(--abm-text);
  font-size: 13px;
  outline: none;
  transition: border .2s;
  box-sizing: border-box;
}
#abm-search::placeholder { color: var(--abm-muted); }
#abm-search:focus { border-color: var(--abm-accent); }
#abm-search-clear {
  position: absolute;
  right: 8px; top: 50%;
  transform: translateY(-50%);
  background: none; border: none;
  color: var(--abm-muted); font-size: 16px;
  cursor: pointer; display: none;
  line-height: 1;
}
#abm-search-clear.visible { display: block; }
.abm-controls select {
  padding: 8px 10px;
  background: var(--abm-card);
  border: 1px solid var(--abm-border);
  border-radius: 8px;
  color: var(--abm-text);
  font-size: 13px;
  outline: none;
  cursor: pointer;
  transition: border .2s;
}
.abm-controls select:focus { border-color: var(--abm-accent); }

/* ---- Stats ---- */
.abm-stats {
  display: flex;
  align-items: center;
  padding: 10px 20px;
  background: var(--abm-dark);
  border-bottom: 1px solid var(--abm-border);
  gap: 0;
  overflow-x: auto;
}
.abm-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 20px;
  gap: 2px;
}
.abm-stat-num {
  font-size: 20px;
  font-weight: 700;
  color: var(--abm-accent);
  line-height: 1;
}
.abm-stat-label {
  font-size: 10px;
  color: var(--abm-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  white-space: nowrap;
}
.abm-stat-sep {
  width: 1px;
  height: 28px;
  background: var(--abm-border);
}

/* ---- Main layout ---- */
.abm-main {
  display: flex;
  position: relative;
  overflow: hidden;
}

/* ---- Map ---- */
.abm-map-area {
  flex: 1;
  position: relative;
  min-width: 0;
}
#abm-map {
  width: 100%;
  height: 100%;
  background: #1e2433;
}

/* ---- Toggle sidebar btn ---- */
.abm-toggle-sidebar {
  position: absolute;
  top: 12px; left: 12px;
  z-index: 500;
  background: var(--abm-dark);
  border: 1px solid var(--abm-border);
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  color: var(--abm-text);
  display: flex;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
  transition: background .2s;
}
.abm-toggle-sidebar:hover { background: var(--abm-card); }
.abm-toggle-sidebar svg { width: 18px; height: 18px; }

/* ---- Sidebar ---- */
.abm-sidebar {
  width: 300px;
  min-width: 260px;
  background: var(--abm-dark);
  border-right: 1px solid var(--abm-border);
  display: flex;
  flex-direction: column;
  transition: width .3s, min-width .3s;
  overflow: hidden;
}
.abm-sidebar.collapsed {
  width: 0 !important;
  min-width: 0 !important;
}
.abm-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--abm-border);
  font-size: 12px;
  font-weight: 600;
  color: var(--abm-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.abm-sidebar-close {
  background: none; border: none;
  color: var(--abm-muted); font-size: 18px;
  cursor: pointer; line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
  transition: background .2s;
}
.abm-sidebar-close:hover { background: rgba(255,255,255,.08); }
.abm-branch-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}
.abm-branch-list::-webkit-scrollbar { width: 4px; }
.abm-branch-list::-webkit-scrollbar-track { background: transparent; }
.abm-branch-list::-webkit-scrollbar-thumb { background: var(--abm-border); border-radius: 4px; }

/* ---- Branch card ---- */
.abm-branch-card {
  background: var(--abm-card);
  border: 1px solid var(--abm-border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color .2s, transform .15s, box-shadow .2s;
  position: relative;
}
.abm-branch-card:hover {
  border-color: var(--abm-accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(182,212,50,.12);
}
.abm-branch-card.active {
  border-color: var(--abm-accent);
  box-shadow: 0 0 0 2px rgba(182,212,50,.25);
}
.abm-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.abm-card-flag { font-size: 20px; line-height: 1; }
.abm-card-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--abm-text);   /* ← FIXED: was invisible in v1 */
  flex: 1;
}
.abm-card-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 20px;
  border: 1px solid;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.abm-card-badge.full    { color: var(--abm-accent); border-color: rgba(182,212,50,.4); background: rgba(182,212,50,.08); }
.abm-card-badge.partner { color: #7ebfff; border-color: rgba(126,191,255,.4); background: rgba(126,191,255,.08); }
.abm-card-country {
  font-size: 12px;
  color: var(--abm-muted);
  margin-bottom: 2px;
}
.abm-card-address {
  font-size: 11.5px;
  color: var(--abm-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.abm-no-results {
  text-align: center;
  padding: 40px 20px;
  color: var(--abm-muted);
  font-size: 13px;
}

/* ---- Detail Panel (bottom sheet on mobile, strip on desktop) ---- */
.abm-detail-panel {
  display: none;
  background: var(--abm-card);
  border-top: 2px solid var(--abm-accent);
  padding: 16px 20px 16px;
  position: relative;
  animation: abm-slide-up .2s ease;
}
@keyframes abm-slide-up {
  from { transform: translateY(12px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.abm-detail-panel.visible { display: block; }
.abm-detail-inner {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
}
.abm-detail-close {
  position: absolute; top: 12px; right: 14px;
  background: none; border: none;
  color: var(--abm-muted); font-size: 22px;
  cursor: pointer; line-height: 1;
}
.abm-detail-flag { font-size: 38px; line-height: 1; }
.abm-detail-info { flex: 1; min-width: 180px; }
.abm-detail-title {
  font-size: 18px; font-weight: 700;
  color: var(--abm-text);           /* ← FIXED */
  margin-bottom: 2px;
}
.abm-detail-country {
  font-size: 13px; color: var(--abm-accent);
  font-weight: 600; margin-bottom: 8px;
}
.abm-detail-addr {
  font-size: 13px; color: var(--abm-muted);
  line-height: 1.55;
}
.abm-detail-contacts {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 180px;
}
.abm-detail-contact-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.abm-detail-contact-item a {
  color: var(--abm-accent);
  text-decoration: none;
}
.abm-detail-contact-item a:hover { text-decoration: underline; }
.abm-detail-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.abm-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px;
  font-size: 13px; font-weight: 600;
  text-decoration: none; cursor: pointer; border: none;
  transition: opacity .2s, transform .15s;
}
.abm-btn:hover { opacity: .88; transform: translateY(-1px); }
.abm-btn-primary { background: var(--abm-accent); color: #1a1f2e; }
.abm-btn-outline  { background: transparent; color: var(--abm-accent); border: 1.5px solid var(--abm-accent); }

/* ---- Leaflet popup overrides ---- */
.leaflet-popup-content-wrapper {
  background: #222840 !important;
  border-radius: 10px !important;
  border: 1px solid rgba(182,212,50,.3) !important;
  box-shadow: 0 8px 24px rgba(0,0,0,.4) !important;
  padding: 0 !important;
}
.leaflet-popup-tip { background: #222840 !important; }
.leaflet-popup-content {
  margin: 0 !important;
  color: #f0f2f8 !important;  /* ← FIXED: always white */
}
.abm-popup {
  padding: 14px 16px;
  min-width: 210px;
}
.abm-popup-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.abm-popup-flag { font-size: 22px; }
.abm-popup-name {
  font-size: 14px;
  font-weight: 700;
  color: #f0f2f8 !important;  /* ← FIXED: always light */
  line-height: 1.3;
}
.abm-popup-country {
  font-size: 11px;
  color: #b6d432;
  font-weight: 600;
}
.abm-popup-addr {
  font-size: 12px;
  color: #8892a4;
  margin-bottom: 10px;
  line-height: 1.5;
}
.abm-popup-links { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.abm-popup-links a { color: #b6d432; font-size: 12px; text-decoration: none; }
.abm-popup-links a:hover { text-decoration: underline; }
.abm-popup-dir {
  display: inline-block;
  background: #b6d432; color: #1a1f2e;
  padding: 6px 14px; border-radius: 6px;
  font-size: 12px; font-weight: 700;
  text-decoration: none;
  transition: background .2s;
}
.abm-popup-dir:hover { background: #9ab82a; color: #1a1f2e; text-decoration: none; }

/* ---- Pulse marker ---- */
.abm-pulse {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--abm-accent);
  border: 2.5px solid #fff;
  box-shadow: 0 0 0 0 rgba(182,212,50,.7);
  animation: abm-pulse 2s infinite;
  cursor: pointer;
}
.abm-pulse.partner { background: #7ebfff; box-shadow: 0 0 0 0 rgba(126,191,255,.7); }
@keyframes abm-pulse {
  0%   { box-shadow: 0 0 0 0   rgba(182,212,50,.7); }
  70%  { box-shadow: 0 0 0 10px rgba(182,212,50,0);  }
  100% { box-shadow: 0 0 0 0   rgba(182,212,50,0);   }
}

/* ---- Loading ---- */
.abm-loading {
  display: flex; align-items: center; gap: 10px;
  padding: 24px 16px; color: var(--abm-muted); font-size: 13px;
}
.abm-spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--abm-border);
  border-top-color: var(--abm-accent);
  border-radius: 50%;
  animation: abm-spin .7s linear infinite;
}
@keyframes abm-spin { to { transform: rotate(360deg); } }

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 700px) {
  .abm-topbar { padding: 10px 12px; gap: 8px; }
  .abm-controls { flex-wrap: wrap; gap: 6px; }
  .abm-controls select { flex: 1; min-width: 120px; }
  .abm-sidebar { width: 100% !important; min-width: 0 !important; position: absolute; top: 0; left: 0; height: 100%; z-index: 600; }
  .abm-sidebar.collapsed { width: 0 !important; }
  .abm-main { position: relative; }
  .abm-stats { padding: 8px 12px; gap: 0; }
  .abm-stat { padding: 0 10px; }
  .abm-stat-num { font-size: 16px; }
  #abm-map { height: 100% !important; }
}
@media (max-width: 480px) {
  .abm-brand-tag { display: none; }
  .abm-detail-inner { flex-direction: column; gap: 12px; }
  .abm-detail-flag { font-size: 28px; }
}
