/* ═══════════════════════════════════════════════════════════════
   Branch Directory Page Styles
   ═══════════════════════════════════════════════════════════════ */


/* ═══════════════════════════════════════════════════════════════
   1. PAGE HEADER
   ═══════════════════════════════════════════════════════════════ */
.branches-page-header {
  margin-bottom: 32px;
}

.branches-page-title {
  font-family: var(--font-serif);
  font-size: 36px;
  line-height: 1.2;
  color: var(--color-ink);
  font-weight: 400;
  margin: 0 0 2px 0;
}

.branches-page-subtitle {
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--color-muted);
  margin: 6px 0 0 0;
}


/* ═══════════════════════════════════════════════════════════════
   2. TOP LAYOUT (Grid & Columns)
   ═══════════════════════════════════════════════════════════════ */
.branches-top-layout {
  display: grid;
  grid-template-columns: 5fr 8fr;
  gap: 24px;
  margin-bottom: 24px;
  align-items: start;
}

.branches-top-left {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* 
 * Z-INDEX FIX: Creates a new stacking context. 
 * Leaflet maps use massive internal z-indexes (400+). This traps them 
 * inside this container so they don't overlap the mobile menu (z-index: 100).
 */
.branches-top-right {
  position: relative;
  z-index: 0; 
}


/* ═══════════════════════════════════════════════════════════════
   3. STAT CARDS
   ═══════════════════════════════════════════════════════════════ */
.br-stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.br-stat-card {
  background: var(--surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.br-stat-card:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
}

.br-stat-icon-wrap {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--swatch-gold-bg) 15%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.br-stat-icon {
  font-size: 22px;
  color: var(--color-gold-text);
}

.br-stat-number {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 400;
  color: var(--color-gold-text);
  line-height: 1;
  margin-bottom: 3px;
}

.br-stat-label {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}


/* ═══════════════════════════════════════════════════════════════
   4. HEAD OFFICE CARD
   ═══════════════════════════════════════════════════════════════ */
.br-hq-card {
  background: var(--surface-muted);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-gold-text);
  border-radius: var(--radius-md);
  padding: 28px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.25s ease;
}

.br-hq-card:hover { box-shadow: var(--shadow-card-hover); }

/* Decorative background icon */
.br-hq-bg-icon {
  position: absolute;
  bottom: -12px;
  right: -10px;
  font-size: 120px;
  color: var(--color-gold-text);
  opacity: 0.05;
  pointer-events: none;
  user-select: none;
  line-height: 1;
}

.br-hq-inner { position: relative; z-index: 1; }

.br-hq-eyebrow {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--color-gold-text);
  background: color-mix(in srgb, var(--swatch-gold-bg) 20%, transparent);
  border: 1px solid color-mix(in srgb, var(--swatch-gold-gradient) 30%, transparent);
  border-radius: 99px;
  padding: 3px 12px;
  margin-bottom: 14px;
}

.br-hq-name {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 400;
  color: var(--color-ink);
  margin: 0 0 16px 0;
  line-height: 1.2;
}

.br-hq-rows { display: flex; flex-direction: column; gap: 10px; }

.br-hq-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--color-subtle);
  line-height: 1.5;
}

.br-hq-row-icon {
  font-size: 17px;
  color: var(--color-gold-text);
  opacity: 0.75;
  flex-shrink: 0;
  margin-top: 1px;
}


/* ═══════════════════════════════════════════════════════════════
   5. SEARCH BAR
   ═══════════════════════════════════════════════════════════════ */
.br-search-wrap {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

#branch-search { padding-left: 2.9rem; }

.br-search-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  color: var(--color-muted);
  pointer-events: none;
}

.br-search-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  padding: 16px 16px 16px 52px;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--color-ink);
  box-sizing: border-box;
  transition: background 0.2s ease;
}

.br-search-input::placeholder { color: var(--color-muted); }

.br-search-wrap:focus-within {
  border-color: var(--color-gold-text);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-gold-text) 10%, transparent);
}


/* ═══════════════════════════════════════════════════════════════
   6. MAP CARD & LEAFLET OVERRIDES
   ═══════════════════════════════════════════════════════════════ */
.branch-map-card {
  width: 100%;
  height: 100%;
  min-height: 390px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface-muted);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-card);
}

#branch-map {
  width: 100%;
  height: 100%;
  min-height: 390px;
}

/* ── Base Map Styles ── */
.leaflet-container {
  background: #1e293b; 
  font-family: inherit;
}

.leaflet-popup-content-wrapper {
  border-radius: 10px;
  box-shadow: var(--shadow-dropdown);
  font-family: inherit;
}

.leaflet-popup-content { margin: 10px 14px; font-size: 13px; line-height: 1.5; }
.leaflet-popup-tip { box-shadow: var(--shadow-dropdown); }

/* ── Map Tooltips ── */
.leaflet-tooltip.branch-district-tip {
  background: rgba(15, 23, 42, 0.85); 
  color: var(--surface);
  border: none;
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.02em;
  font-family: inherit;
}
.leaflet-tooltip.branch-district-tip::before { border-top-color: rgba(15, 23, 42, 0.85); }

.leaflet-tooltip.branch-name-tip {
  background: #6366f1; 
  color: var(--surface);
  border: none;
  border-radius: var(--radius-md);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4); 
}
.leaflet-tooltip.branch-name-tip::before { border-top-color: #6366f1; }

/* ── Map Controls ── */
.leaflet-control-zoom a {
  background: var(--surface) !important;
  color: #334155 !important; 
  border: none !important;
  width: 30px !important;
  height: 30px !important;
  line-height: 30px !important;
  font-size: 15px !important;
  transition: background 0.15s ease;
}
.leaflet-control-zoom a:hover { background: var(--surface-muted) !important; }
.leaflet-control-zoom a:first-child { border-radius: 8px 8px 0 0 !important; }
.leaflet-control-zoom a:last-child { border-radius: 0 0 8px 8px !important; }

.leaflet-control-zoom {
  border: none !important;
  box-shadow: var(--shadow-card-hover) !important;
  border-radius: 8px !important;
  overflow: hidden;
}

.leaflet-control-attribution {
  background: rgba(255, 255, 255, 0.8) !important;
  font-size: 10px !important;
  border-radius: 4px 0 0 0 !important;
  padding: 2px 6px !important;
}


/* ═══════════════════════════════════════════════════════════════
   7. PROVINCE GROUP CARDS & TABLES
   ═══════════════════════════════════════════════════════════════ */
.branch-group-card {
  background: var(--surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.25s ease;
}

.branch-group-card:hover { box-shadow: var(--shadow-card-hover); }

.branch-group-header {
  background: var(--surface-alt);
  padding: 14px 24px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.branch-group-header__icon { font-size: 20px; color: var(--swatch-terracotta); }

.branch-group-header__title {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 700;
  color: var(--color-subtle);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.branch-group-header__count {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  color: var(--color-muted);
  background: var(--color-border);
  padding: 3px 10px;
  border-radius: 99px;
  margin-left: auto;
  white-space: nowrap;
}

/* ── Table Overrides ── */
.branch-group-card .db-table thead th {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 12px 24px;
  border-bottom: 1px solid var(--color-border);
  background: transparent;
}

.branch-group-card .db-table tbody td {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--color-subtle);
  padding: 14px 24px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}

.branch-group-card .db-table tbody tr:last-child td { border-bottom: none; }
.branch-group-card .db-table tbody tr:hover td { background: var(--surface-alt); }

/* ── Cell Types ── */
.br-branch-name { font-weight: 600; color: var(--color-ink); white-space: nowrap; }
.br-contact-cell { white-space: nowrap; line-height: 1.6; }

.br-email {
  color: var(--color-gold-text);
  text-decoration: none;
  transition: color 0.15s ease;
}
.br-email:hover { color: var(--swatch-gold-text); text-decoration: underline; }


/* ═══════════════════════════════════════════════════════════════
   8. EMPTY / NO-RESULTS STATES
   ═══════════════════════════════════════════════════════════════ */
.branches-empty-state {
  text-align: center;
  padding: 100px 24px;
  color: var(--color-muted);
}

.branches-empty-state__icon {
  font-size: 56px;
  display: block;
  margin-bottom: 16px;
  color: var(--color-border-strong);
}

.branches-empty-state__text {
  font-family: var(--font-serif-alt);
  font-size: 18px;
  margin: 0;
}


/* ═══════════════════════════════════════════════════════════════
   9. RESPONSIVE ADJUSTMENTS
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .branches-top-layout {
    grid-template-columns: 1fr;
  }

  .branch-map-card,
  #branch-map {
    min-height: 260px;
  }

  .branches-page-title { font-size: 28px; }
  .br-contact-cell { white-space: normal; }
}