/* Synectix Forge - Community section
   Built on top of the site's existing design tokens (css/styles.css).
   Do not redefine colors/type here - reuse the :root variables. */

.community-hero {
  padding: 150px 0 40px;
}

.community-hero h1 {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}

.community-hero p {
  color: var(--text-secondary);
  font-size: 16px;
  max-width: 560px;
}

/* Servers / Users tab switcher */
.lb-tabs {
  display: flex;
  gap: 8px;
  margin: 28px 0 32px;
  border-bottom: 1px solid var(--border);
}

.lb-tab {
  padding: 12px 4px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  margin-right: 20px;
}

.lb-tab.active,
.lb-tab:hover {
  color: var(--text-primary);
}

.lb-tab.active {
  border-bottom-color: var(--accent);
}

/* Search by username or Discord ID */
.lb-search-wrap {
  position: relative;
  max-width: 420px;
  margin-bottom: 20px;
}

.lb-search-wrap svg {
  position: absolute;
  top: 50%;
  left: 14px;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-tertiary);
  pointer-events: none;
}

.lb-search-input {
  width: 100%;
  height: 44px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-primary);
  padding: 0 40px 0 40px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.lb-search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.lb-search-input::placeholder { color: var(--text-tertiary); }

.lb-search-clear {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: var(--text-tertiary);
  background: transparent;
}

.lb-search-clear:hover { color: var(--text-primary); background: var(--card-hover); }
.lb-search-clear svg { width: 14px; height: 14px; position: static; transform: none; }
.lb-search-wrap.has-value .lb-search-clear { display: flex; }

.lb-search-hint {
  font-size: 12.5px;
  color: var(--text-tertiary);
  margin: -12px 0 20px;
}

/* Table shell */
.lb-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--card);
  overflow: hidden;
  margin-bottom: 24px;
}

.lb-table {
  width: 100%;
  border-collapse: collapse;
}

.lb-table thead th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.lb-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.15s var(--ease);
}

.lb-table tbody tr:last-child { border-bottom: none; }
.lb-table tbody tr:hover { background: var(--card-hover); }

.lb-table td {
  padding: 14px 20px;
  font-size: 14px;
  vertical-align: middle;
  white-space: nowrap;
}

.lb-rank {
  font-family: var(--font-mono);
  color: var(--text-tertiary);
  font-size: 13px;
  width: 56px;
}

.lb-entity { width: 100%; white-space: normal; }

.lb-entity-link {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lb-avatar {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.lb-avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-2);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 13px;
}

.lb-entity-name {
  font-weight: 600;
  color: var(--text-primary);
}

/* Rank/level badge - shown right after the entity name (see badges.js).
   Rank 1-3 gets a medal icon; everyone else gets a level-tier icon.
   The gradient background comes from badges.js's RANK_BADGES/BADGE_TIERS
   grad arrays via an inline style, so this class only sets shape/size. */
.lb-rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 12px;
  line-height: 1;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  cursor: default;
}

/* Dedicated Badge column - Users leaderboard only (users.html/users.js).
   The Server leaderboard keeps its badge inline next to the name instead
   (leaderboard.js), so this column class is not used there. */
.lb-badge-col {
  width: 44px;
  text-align: center;
}

.lb-level {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 100px;
  background: var(--accent-dim);
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
}

.lb-stat {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 13.5px;
}

/* Loading / empty / error state */
.lb-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-secondary);
  font-size: 14px;
}

.lb-state-error { color: var(--error); }

/* Skeleton loader row (shown via .lb-skeleton on tbody while first page loads) */
.lb-skeleton-row td {
  padding: 14px 20px;
}
.lb-skeleton-bar {
  height: 14px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--bg-2) 25%, var(--card-hover) 50%, var(--bg-2) 75%);
  background-size: 200% 100%;
  animation: lbShimmer 1.4s ease-in-out infinite;
}
@keyframes lbShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.lb-load-more-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 80px;
}

@media (prefers-reduced-motion: reduce) {
  .lb-skeleton-bar { animation: none; }
}

@media (max-width: 720px) {
  .lb-hide-sm { display: none; }
  .lb-table td, .lb-table th { padding: 12px 14px; }
}

@media (max-width: 560px) {
  .lb-hide-md { display: none; }
}

/* Phase 2 - Auth, dashboard, portal */

.btn-discord {
  background: #5865F2;
  color: #fff;
}
.btn-discord:hover { background: #6874F5; }

.nav-user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-primary);
  margin-right: 4px;
}
.nav-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
}
.nav-avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-2);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
}

.auth-prompt {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--card);
  padding: 40px;
  text-align: center;
  margin-bottom: 40px;
}
.auth-prompt p {
  color: var(--text-secondary);
  margin-bottom: 20px;
}

/* Guild list */
.guild-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 60px;
}
.guild-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card);
}
.guild-card-main {
  display: flex;
  align-items: center;
  gap: 14px;
}
.guild-card-name {
  font-weight: 600;
  font-size: 14.5px;
  margin-bottom: 4px;
}
.guild-role-pill {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 100px;
  background: var(--bg-2);
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 500;
}
.guild-status {
  font-size: 13px;
}
.guild-status-muted { color: var(--text-tertiary); }

/* Portal */
.portal-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}
.portal-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: var(--bg-2);
}
.portal-header h1 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
}

.portal-nav {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
}
.portal-tab {
  background: none;
  border: none;
  padding: 10px 16px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
}
.portal-tab.active,
.portal-tab:hover { color: var(--text-primary); }
.portal-tab.active { border-bottom-color: var(--accent); }

.portal-panel { margin-bottom: 60px; }
.portal-hint {
  color: var(--text-tertiary);
  font-size: 13px;
  margin-top: 16px;
}
.portal-hint a { color: var(--accent-cyan); }

/* Stat cards */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.stat-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card);
}
.stat-label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
}
.stat-value {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}

/* Banner upload */
.banner-upload-zone {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
  margin-bottom: 32px;
  background: var(--bg-2);
}
.banner-preview {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
}
.banner-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-tertiary);
  font-size: 13.5px;
  padding: 24px 0;
}
.banner-placeholder svg { width: 28px; height: 28px; }
.banner-upload-btn { margin-top: 8px; cursor: pointer; }

/* Profile form */
.profile-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 520px;
}
.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
}
.form-field input,
.form-field textarea {
  font-family: inherit;
  font-weight: 400;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  resize: vertical;
}
.form-field input:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.form-hint {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-tertiary);
}

/* Settings */
.settings-block {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card);
  overflow: hidden;
  max-width: 560px;
}
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
.settings-row:last-child { border-bottom: none; }
.settings-row span:first-child { color: var(--text-secondary); }
.mono { font-family: var(--font-mono); font-size: 12.5px; }

.auth-callback-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 20px;
  text-align: center;
}

@media (max-width: 720px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
  .guild-card { flex-direction: column; align-items: flex-start; }
}

/* ==========================================================================
   Public community profile page
   ========================================================================== */

.profile-screen {
  min-height: 100vh;
  padding-bottom: 80px;
}

.profile-banner-wrap {
  width: 100%;
  height: 220px;
  margin-top: 68px; /* clears fixed nav */
  overflow: hidden;
  position: relative;
}
.profile-banner {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.profile-banner-fallback {
  background: linear-gradient(135deg, var(--accent), var(--accent-cyan));
  opacity: 0.25;
}

.profile-header {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  margin-top: -40px;
  position: relative;
  z-index: 2;
  margin-bottom: 20px;
}
.profile-icon {
  width: 88px;
  height: 88px;
  border-radius: 20px;
  object-fit: cover;
  border: 4px solid var(--bg);
  background: var(--bg-2);
  flex-shrink: 0;
}
.profile-header-text { padding-top: 44px; }

.profile-name-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.profile-name-row h1 {
  font-size: 24px;
  font-weight: 700;
}
.partner-badge {
  display: inline-flex;
  padding: 3px 10px;
  border-radius: 100px;
  background: var(--accent-dim);
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
}

.profile-description {
  color: var(--text-secondary);
  font-size: 14.5px;
  line-height: 1.6;
  max-width: 640px;
}

.profile-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 32px;
}
.profile-links .btn i { width: 15px; height: 15px; }

.profile-stats { margin-bottom: 20px; }

@media (max-width: 640px) {
  .profile-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .profile-header-text { padding-top: 0; }
}