/* ─────────────────────────────────────────────
   ProfileMap.css
   Three-tier glossy navigation map — read-only.
   Single open entry at a time. Container sizes
   to actual open content.
   ───────────────────────────────────────────── */

.pm-container {
  position: relative;
  background: linear-gradient(180deg, #0f1623 0%, #0a0f1a 100%);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  padding: 1.25rem 1.25rem 1rem;
  margin: 1rem 0;
}

.pm-container::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
  pointer-events: none;
}

/* ─── Header ─── */
.pm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  gap: 12px;
  flex-wrap: wrap;
}

.pm-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pm-header-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.18), rgba(249, 115, 22, 0.06));
  border: 1px solid rgba(249, 115, 22, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
}

.pm-header-text {
  display: flex;
  flex-direction: column;
}

.pm-header-title {
  font-size: 15px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.92);
}

.pm-header-sub {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.45);
  margin-top: 1px;
}

/* ─── Mode toggle ─── */
.pm-mode-toggle {
  display: flex;
  gap: 4px;
  padding: 3px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
}

.pm-mode-btn {
  padding: 5px 12px;
  border-radius: 6px;
  background: transparent;
  color: rgba(255, 255, 255, 0.5);
  border: 1px solid transparent;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.pm-mode-btn:hover {
  color: rgba(255, 255, 255, 0.8);
}

.pm-mode-btn.active {
  background: rgba(34, 211, 238, 0.12);
  color: #22d3ee;
  border-color: rgba(34, 211, 238, 0.25);
}

/* ─── Tree root ─── */
.pm-tree {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pm-tree-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pm-tree-section + .pm-tree-section {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed rgba(255, 255, 255, 0.05);
}

.pm-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  margin: 2px 0 4px 2px;
  opacity: 0.8;
}

/* ─── Chevron + badge ─── */
.pm-chev {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  transition: transform 0.25s ease;
}

.pm-chev.open {
  transform: rotate(90deg);
}

.pm-count-badge {
  font-size: 10px;
  min-width: 18px;
  padding: 2px 7px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.55);
  margin-left: auto;
  text-align: center;
  white-space: nowrap;
  font-weight: 500;
}

/* ─── Entry node (orange tier) ─── */
.pm-entry-node {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  transition: background 0.2s ease, border-color 0.2s ease;
  overflow: hidden;
}

.pm-entry-node:hover {
  background: rgba(255, 255, 255, 0.035);
  border-color: rgba(249, 115, 22, 0.18);
}

.pm-entry-open {
  background: rgba(255, 255, 255, 0.035);
  border-color: rgba(249, 115, 22, 0.22);
}

.pm-entry-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  user-select: none;
}

.pm-entry-row:focus-visible {
  outline: 1px solid rgba(249, 115, 22, 0.5);
  outline-offset: -1px;
  border-radius: 10px;
}

.pm-entry-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: rgba(249, 115, 22, 0.1);
  border: 1px solid rgba(249, 115, 22, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pm-entry-label {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
  letter-spacing: 0.2px;
}

.pm-entry-children-wrap {
  overflow: hidden;
  transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Bulletproof closed state — wins over inline styles and parent overrides */
.pm-entry-children-wrap.is-closed {
  height: 0 !important;
  overflow: hidden !important;
}

.pm-entry-children {
  padding: 4px 12px 20px 34px;       /* 20px bottom padding per your spec */
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}

/* connector line entry → pages */
.pm-entry-children::before {
  content: '';
  position: absolute;
  left: 22px;
  top: 4px;
  bottom: 24px;
  width: 1px;
  background: linear-gradient(180deg, rgba(168, 85, 247, 0.3), rgba(168, 85, 247, 0.05));
}

/* ─── Page node (purple tier) ─── */
.pm-page-node {
  background: rgba(168, 85, 247, 0.04);
  border: 1px solid rgba(168, 85, 247, 0.12);
  border-radius: 8px;
  transition: background 0.18s ease, border-color 0.18s ease;
  overflow: hidden;
}

.pm-page-node:hover {
  background: rgba(168, 85, 247, 0.06);
  border-color: rgba(168, 85, 247, 0.2);
}

.pm-page-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  cursor: pointer;
  user-select: none;
}

.pm-page-row:focus-visible {
  outline: 1px solid rgba(168, 85, 247, 0.5);
  outline-offset: -1px;
  border-radius: 8px;
}

.pm-page-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.pm-page-label {
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85);
}

.pm-page-tabs-wrap {
  overflow: hidden;
  transition: height 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.pm-page-tabs-wrap.is-closed {
  height: 0 !important;
  overflow: hidden !important;
}

.pm-page-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 2px 10px 12px 28px;
}

/* ─── Tab pill (cyan leaf tier) ─── */
.pm-tab-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(34, 211, 238, 0.06);
  border: 1px solid rgba(34, 211, 238, 0.14);
  font-size: 11px;
  color: rgba(255, 255, 255, 0.78);
  white-space: nowrap;
  letter-spacing: 0.1px;
}

/* ─── Footer ─── */
.pm-footer {
  margin-top: 1rem;
  padding-top: 0.875rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.pm-mini-btn {
  padding: 5px 10px;
  border-radius: 6px;
  background: transparent;
  color: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, opacity 0.18s ease;
}

.pm-mini-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.85);
  border-color: rgba(255, 255, 255, 0.16);
}

.pm-mini-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

/* ─── Empty state ─── */
.pm-container-empty {
  padding-bottom: 1.25rem;
}

.pm-container-empty .pm-header-sub {
  color: rgba(255, 255, 255, 0.4);
  font-style: italic;
}

/* ─── Mobile ─── */
@media (max-width: 480px) {
  .pm-container {
    padding: 1rem;
    border-radius: 12px;
  }

  .pm-header {
    margin-bottom: 0.875rem;
  }

  .pm-entry-children {
    padding-left: 28px;
    padding-bottom: 20px;
  }

  .pm-entry-children::before {
    left: 18px;
  }

  .pm-page-tabs {
    padding-left: 24px;
    padding-bottom: 10px;
  }
}