/* ============================================================
   FORGE — forge_app_navbar.css
   Left navigation rail (navbar):
   - Main server icon (top, always visible)
   - Sub-server icons (joined servers)
   - Add sub-server button
   - Spacer
   - DM button, server list button, discovery (bottom)
   - Server list slide-over panel
   ============================================================ */

/* ══════════════════════════════════════
   RAIL SHELL
══════════════════════════════════════ */
.rail {
  width: var(--rail-width);
  min-width: var(--rail-width);
  background: var(--bg-rail);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 0 60px 0; /* Extra bottom padding so rail stops above user bar */
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  flex-shrink: 0;
  z-index: 10;
  contain: layout style;
}
.rail::-webkit-scrollbar { display: none; }

/* Pushes bottom buttons (DM, server list, discovery) to the bottom */
.rail-spacer { flex: 1; min-height: 12px; }

/* Thin horizontal divider between main icon and sub-servers */
.rail-divider {
  width: 32px;
  height: 1px;
  background: rgba(255,255,255,0.1);
  margin: 6px 0;
  flex-shrink: 0;
}

/* ── Shared frame style for all rail buttons ──
   Inactive = no background, no border, muted icon
   Active   = yellow border, dark bg, yellow icon
   (The "Guilded yellow frame" treatment)
*/
.rail-frame-btn {
  width: 44px; height: 44px;
  border-radius: var(--radius-frame);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  border: 2.5px solid transparent;
  background: transparent;
  transition:
    color         var(--transition-fast),
    border-color  var(--transition-fast),
    background    var(--transition-fast),
    border-radius var(--transition-base);
  flex-shrink: 0;
  margin: 2px 0;
  position: relative;
}
.rail-frame-btn:hover { color: var(--text-secondary); }
.rail-frame-btn.active {
  border-color: var(--yellow);
  background: var(--bg-rail);
  color: var(--yellow);
}

/* ══════════════════════════════════════
   MAIN SERVER ICON (top of rail)
   Always shows the currently active server.
   Yellow border = always active style.
══════════════════════════════════════ */
.rail-main-server {
  width: 44px; height: 44px;
  border-radius: var(--radius-frame);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 2.5px solid transparent;
  background: transparent;
  color: var(--text-muted);
  overflow: hidden;
  transition: border-radius var(--transition-base), border-color var(--transition-fast), background var(--transition-fast);
  flex-shrink: 0;
  margin-bottom: 2px;
  /* Always takes up space even when no server is selected */
  visibility: hidden;
  pointer-events: none;
}
.rail-main-server.has-server {
  visibility: visible;
  pointer-events: all;
  border-color: var(--yellow);
  background: var(--bg-rail);
}
.rail-main-server.has-server:hover {
  border-radius: 10px;
  filter: brightness(1.15);
}
.rail-main-server img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }

/* ══════════════════════════════════════
   SUB-SERVER ICONS
   One per joined server, below main icon
══════════════════════════════════════ */
.rail-sub-server {
  width: 44px; height: 44px;
  border-radius: var(--radius-frame);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 2.5px solid transparent;
  background: var(--bg-card);
  overflow: hidden;
  transition:
    border-color  var(--transition-fast),
    border-radius var(--transition-base);
  flex-shrink: 0;
  margin: 2px 0;
  position: relative;
}
.rail-sub-server:hover  { border-radius: 10px; }
.rail-sub-server.active { border-color: var(--yellow); border-radius: 10px; }
.rail-sub-server img    { width: 100%; height: 100%; object-fit: cover; }

.rail-sub-server-text {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

/* Unread notification dot on sub-server icon */
.rail-notif-dot {
  position: absolute;
  bottom: -1px; right: -1px;
  width: 12px; height: 12px;
  background: var(--red);
  border-radius: 50%;
  border: 2px solid var(--bg-rail);
}

/* ══════════════════════════════════════
   ADD SUB-SERVER BUTTON
══════════════════════════════════════ */
.rail-add {
  width: 44px; height: 44px;
  border-radius: var(--radius-frame);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 2px dashed rgba(255,255,255,0.15);
  background: transparent;
  color: var(--text-muted);
  font-size: 22px;
  font-weight: 300;
  line-height: 1;
  transition:
    border-color  var(--transition-base),
    color         var(--transition-base),
    border-radius var(--transition-base);
  flex-shrink: 0;
  margin: 2px 0;
}
.rail-add:hover {
  border-color: var(--yellow);
  color: var(--yellow);
  border-radius: 10px;
}

/* ══════════════════════════════════════
   BOTTOM BUTTONS
   DM, server list, discovery
   All use .rail-frame-btn
══════════════════════════════════════ */
/* Discovery button — slightly larger than the other bottom buttons
   but smaller than the main server icon (44px) */
.rail-discovery-btn {
  width: 38px; height: 38px;
  border-radius: var(--radius-frame);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  border: 2.5px solid transparent;
  background: transparent;
  transition: color var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
  flex-shrink: 0;
  margin: 2px 0;
}
.rail-discovery-btn:hover { color: var(--text-secondary); }
.rail-discovery-btn.active {
  border-color: var(--yellow);
  background: var(--bg-rail);
  color: var(--yellow);
}

/* ═════════════════════════════════════
   SERVER LIST SLIDE-OVER PANEL
   Appears over the sidebar when the
   server list button is clicked.
══════════════════════════════════════ */
.server-list-panel {
  position: absolute;
  top: 0;
  left: var(--rail-width);
  width: var(--sidebar-width);
  height: 100%;
  background: var(--bg-rail);
  z-index: 100;
  display: flex;
  flex-direction: column;
  transform: translateX(-8px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.2s ease, opacity 0.18s ease;
  border-right: 1px solid var(--border);
  box-shadow: 4px 0 16px rgba(0,0,0,0.4);
  will-change: transform, opacity;
  contain: layout style;
}
.server-list-panel.open {
  transform: translateX(0);
  opacity: 1;
  pointer-events: all;
}

/* Header with title + search */
.server-list-header {
  padding: 14px 12px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.server-list-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 10px;
}

.server-list-search {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 7px 14px;
  font-size: 13px;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition-base);
}
.server-list-search:focus { border-color: var(--border-strong); }
.server-list-search::placeholder { color: var(--text-muted); }

/* Scrollable server list */
.server-list-body {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
  contain: layout style;
}

/* Individual server row */
.server-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  margin: 1px 6px;
  transition: background var(--transition-fast);
}
.server-list-item:hover  { background: var(--bg-hover); }
.server-list-item.active { background: var(--bg-active); }

.server-list-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  border: 2px solid transparent;
  transition: border-color var(--transition-fast);
}
.server-list-item.active .server-list-icon { border-color: var(--yellow); }
.server-list-icon img { width: 100%; height: 100%; object-fit: cover; }

.server-list-info  { flex: 1; min-width: 0; }
.server-list-name  { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.server-list-members { font-size: 12px; color: var(--text-muted); margin-top: 1px; }

/* Create a server row */
.server-list-create {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 14px;
  border-radius: var(--radius-sm);
  margin: 1px 6px;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.server-list-create:hover { background: var(--bg-hover); color: var(--text-primary); }

.server-list-create-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px dashed var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Footer links (Tournaments, My profile, Direct messages) */
.server-list-footer {
  border-top: 1px solid var(--border);
  padding: 8px 6px;
  flex-shrink: 0;
}

.server-list-footer-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast), color var(--transition-fast);
}
.server-list-footer-link:hover { background: var(--bg-hover); color: var(--text-primary); }
.server-list-footer-link-icon  { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }

/* ══════════════════════════════════════
   DISCOVERY PANEL
   Fixed to left edge, hidden off-screen.
   When open: panel slides in AND the app
   shifts right using transform so nothing
   overlaps.
══════════════════════════════════════ */

:root { --discovery-width: 260px; }

.discovery-panel {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--discovery-width);
  height: 100vh;
  background: var(--bg-rail);
  z-index: 50;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  box-shadow: 4px 0 24px rgba(0,0,0,0.5);
  transform: translateX(calc(-1 * var(--discovery-width)));
  transition: transform 0.22s ease;
  pointer-events: none;
  will-change: transform;
  contain: layout style;
}
.discovery-panel.open {
  transform: translateX(0);
  pointer-events: all;
}

/* Shift the entire app right when panel opens */
#page-app {
  transition: transform 0.22s ease;
  will-change: transform;
}
#page-app.discovery-open {
  transform: translateX(var(--discovery-width));
}

/* Scrollable server list at the top */
.disc-server-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0 0;
  contain: layout style;
}

.disc-server-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  margin: 1px 6px;
  transition: background var(--transition-fast);
}
.disc-server-item:hover  { background: var(--bg-hover); }
.disc-server-item.active { background: var(--bg-active); }

.disc-server-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font-display);
  flex-shrink: 0;
  border: 2px solid transparent;
  overflow: hidden;
  transition: border-color var(--transition-fast);
}
.disc-server-icon img { width: 100%; height: 100%; object-fit: cover; display: block; }
.disc-server-item.active .disc-server-icon { border-color: var(--yellow); }

.disc-server-info  { flex: 1; min-width: 0; }
.disc-server-name  { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.disc-server-count { font-size: 12px; color: var(--text-muted); margin-top: 1px; }

/* Create a server row */
.disc-create-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  margin: 1px 6px 12px;
  color: var(--text-secondary);
  font-size: 14px;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.disc-create-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

.disc-create-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1.5px dashed var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Bottom section — locked to bottom */
.disc-footer {
  border-top: 1px solid var(--border);
  padding: 8px 6px;
  flex-shrink: 0;
}

/* Each footer button row */
.disc-footer-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}
.disc-footer-row:hover { background: var(--bg-hover); }

/* The icon button on the left of each footer row */
.disc-footer-icon-btn {
  width: 36px; height: 36px;
  border-radius: var(--radius-frame);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  border: 2.5px solid transparent;
  background: transparent;
  flex-shrink: 0;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}
.disc-footer-icon-btn:hover { color: var(--text-secondary); }
.disc-footer-icon-btn.active { border-color: var(--yellow); color: var(--yellow); }

.disc-footer-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  flex: 1;
  cursor: pointer;
}

/* Discover row has a search bar inline */
.disc-search {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 13px;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition-base);
  font-family: var(--font-body);
}
.disc-search:focus { border-color: var(--border-strong); }
.disc-search::placeholder { color: var(--text-muted); }

/* Backdrop — covers the shifted app area, click closes panel */
.discovery-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: var(--discovery-width);
  right: 0;
  bottom: 0;
  z-index: 49;
}
.discovery-backdrop.open { display: block; }