/* Profile Layout — the layout root spans the main content area edge-to-edge
   (cancelling .view-container's 2rem padding) so the banner sits flush with
   the viewport top, the sidebar rail and the scrollbar; each inner section
   re-applies its own 1500px centering. */
.profile-layout {
  margin: calc(-1 * var(--space-8)) calc(-1 * var(--space-8)) 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

@media (max-width: 768px) {
  .profile-layout { margin: 0; }
}

/* ============================================
   PROFILE HEADER — banner with identity, actions row
   ============================================ */
.profile-header {
  padding: 0;
  overflow: visible;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.profile-banner {
  position: relative;
  height: 280px;
  background: var(--bg-tertiary);
  overflow: hidden;
}

.profile-banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.profile-banner-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 30%, rgba(0, 0, 0, 0.65) 100%);
}

.profile-banner.no-image .profile-banner-scrim {
  display: none;
}

/* No banner picture: identity flows as a normal block in theme colors */
.profile-banner.no-image {
  height: auto;
  background: none;
}

.profile-banner.no-image .profile-banner-identity {
  position: static;
  padding: 24px 32px 0;
  color: var(--text-primary);
}

.profile-banner.no-image .profile-banner-text h1 {
  color: var(--text-primary);
  text-shadow: none;
}

.profile-banner.no-image .profile-banner-bio {
  color: var(--text-secondary);
  text-shadow: none;
}

.profile-banner-identity {
  position: absolute;
  left: 32px;
  right: 32px;
  bottom: 24px;
  display: flex;
  align-items: flex-end;
  gap: 20px;
  color: #fff;
}

.profile-banner-identity .profile-avatar-large,
.profile-banner-identity .profile-avatar-fallback {
  width: 104px;
  height: 104px;
  border: 4px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  flex-shrink: 0;
}

.profile-banner-text {
  min-width: 0;
}

.profile-banner-text h1 {
  font-size: 28px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
  line-height: 1.2;
  margin: 0 0 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.45);
}

.profile-banner-bio {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.92);
  line-height: 1.5;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.45);
}

.profile-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 32px;
  border-bottom: 1px solid var(--border);
  /* Re-center the row content inside the full-bleed header */
  max-width: 1500px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.profile-header-actions-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.profile-details-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-sans);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.profile-details-toggle:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

.profile-details-toggle svg {
  transition: transform 0.2s ease;
}

.profile-details-toggle.open svg {
  transform: rotate(180deg);
}

.profile-social-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 280px;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s;
}

.profile-social-chip:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

.profile-social-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Social chip pinned to the banner's bottom-right corner.
   Dark glass so it stays readable on light banner images. */
.profile-banner:not(.no-image) .profile-banner-social {
  position: absolute;
  right: 24px;
  bottom: 24px;
  z-index: 2;
  max-width: 200px;
  background: rgba(0, 0, 0, 0.45);
  border-color: rgba(255, 255, 255, 0.4);
  color: #fff;
  backdrop-filter: blur(6px);
}

.profile-banner:not(.no-image) .profile-banner-social:hover {
  background: rgba(0, 0, 0, 0.65);
  border-color: #fff;
  color: #fff;
}

/* Keep the identity text clear of the corner chip */
.profile-banner:has(.profile-banner-social):not(.no-image) .profile-banner-identity {
  padding-right: 216px;
}

/* No banner picture: chip flows under the identity, right-aligned */
.profile-banner.no-image .profile-banner-social {
  position: static;
  display: flex;
  width: fit-content;
  margin: 0 32px 16px auto;
}

.profile-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

.profile-avatar-large {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--border);
}

.profile-avatar-fallback {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--gradient-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  font-weight: 800;
  border: 3px solid var(--border);
}

.profile-action-btn {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.profile-follow-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--brand-primary);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.profile-follow-btn:hover {
  background: var(--brand-primary-hover);
}

.profile-follow-btn.following {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border-color: var(--border);
}

.profile-follow-btn.following:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.profile-follow-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.profile-ping-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.profile-ping-btn:hover {
  background: var(--brand-primary);
  color: white;
  border-color: var(--brand-primary);
  transform: scale(1.05);
}

.profile-details-panel {
  display: none;
  padding: 20px 32px 24px;
  /* Re-center panel content inside the full-bleed header */
  max-width: 1500px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.profile-details-panel.open {
  display: block;
}

.profile-details-panel .profile-feature-btn {
  margin-top: 20px;
  width: 100%;
  justify-content: center;
}

.profile-details-stats {
  display: flex;
  gap: 32px;
  padding: 20px 24px;
  background: var(--bg-tertiary);
  border-radius: 14px;
  flex-wrap: wrap;
}

.profile-stat {
  display: flex;
  flex-direction: column;
}

.profile-stat .stat-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
}

.profile-stat .stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-top: 2px;
}

/* ============================================
   TAGS — skill & interest pills (details modal)
   ============================================ */
.tag-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
}

.tag-primary {
  background: var(--brand-primary-light);
  color: var(--brand-primary);
}

.tag-secondary {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

/* ============================================
   STREAK STATS — inside the details accordion
   ============================================ */
.streak-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.streak-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px;
  background: var(--bg-tertiary);
  border-radius: 12px;
  text-align: center;
}

.streak-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--brand-primary);
  line-height: 1;
  margin-bottom: 6px;
}

.streak-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

/* ============================================
   QR & SHARE — inside the details accordion
   ============================================ */
.portfolio-qr-img {
  position: relative;
  width: 80px;
  height: 80px;
  flex-shrink: 0;
}

.portfolio-qr-img img.qr {
  width: 100%;
  height: 100%;
  border-radius: 10px;
  background: white;
  display: block;
}

.portfolio-qr-img .qr-logo {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 22px;
  height: 22px;
  background: white;
  border-radius: 50%;
  padding: 3px;
  object-fit: contain;
}

.details-share-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.details-share-row .portfolio-qr-img {
  width: 72px;
  height: 72px;
}

.details-share-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.details-share-info .verify-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.details-share-info .verify-hint {
  font-size: 13px;
  color: var(--text-muted);
}

.profile-share-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.profile-share-url {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.profile-share-copy {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.profile-share-copy:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

.profile-share-copy.copied {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
  background: var(--brand-primary-light);
}

/* QR large view */
#qr-large-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.qr-large-box {
  background: var(--surface);
  border-radius: 16px;
  padding: 28px;
  text-align: center;
  max-width: 400px;
  width: 100%;
}

.qr-large-box h3 {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.qr-large-wrap {
  position: relative;
  width: 260px;
  height: 260px;
  margin: 0 auto;
}

.qr-large-wrap img.qr {
  width: 100%;
  height: 100%;
  border-radius: 12px;
  background: white;
  display: block;
}

.qr-large-wrap .qr-logo-large {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 56px;
  height: 56px;
  background: white;
  border-radius: 50%;
  padding: 8px;
  object-fit: contain;
}

.qr-large-url {
  margin-top: 14px;
  font-size: 12px;
  color: var(--text-muted);
  word-break: break-all;
  font-family: var(--font-mono);
}

.qr-large-actions {
  margin-top: 18px;
  display: flex;
  gap: 10px;
  justify-content: center;
}

/* ============================================
   GLIIMS SECTION — transparent shell, XpLoRe-sized feed
   ============================================ */
.profile-projects-section {
  background: none;
  border: none;
  border-radius: 0;
  padding: 0 24px;
  overflow: visible;
  /* Center the section content inside the edge-to-edge .profile-layout */
  max-width: 1500px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.profile-projects-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0;
  border-bottom: none;
  gap: 12px;
}

.profile-projects-header h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.profile-feature-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--brand-primary);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  font-family: var(--font-sans);
  white-space: nowrap;
}

.profile-feature-btn:hover {
  background: var(--brand-primary-hover);
  transform: translateY(-1px);
}

.profile-feature-btn svg {
  flex-shrink: 0;
}

.profile-filter-wrap {
  position: relative;
}

.profile-filter-btn,
.profile-gear-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.profile-filter-btn:hover,
.profile-gear-btn:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

.profile-filter-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  min-width: 160px;
  z-index: 600;
  overflow: hidden;
}

.profile-filter-dropdown.active {
  display: block;
}

.profile-filter-item {
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.profile-filter-item:last-child {
  border-bottom: none;
}

.profile-filter-item:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.profile-filter-item.active {
  color: var(--brand-primary);
  background: var(--brand-primary-light);
  font-weight: 600;
}

/* ============================================
   DETAILS PANEL — inline accordion under the banner
   ============================================ */
.profile-details-group {
  margin-top: 20px;
}

.profile-details-group h4 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 10px;
  font-weight: 700;
}

/* ============================================
   DETAILS ACCORDION — streak & QR/share
   ============================================ */
.details-acc {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.details-acc + .details-acc {
  margin-top: 10px;
}

.details-acc-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-sans);
}

.details-acc-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.details-acc-title svg {
  color: var(--brand-primary);
  flex-shrink: 0;
}

.details-acc-chevron {
  color: var(--text-muted);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.details-acc.open .details-acc-chevron {
  transform: rotate(180deg);
}

.details-acc-body {
  display: none;
  padding: 0 16px 16px;
}

.details-acc.open .details-acc-body {
  display: block;
}

/* Gliims feed — same wide masonry as the XpLoRe feed */
.profile-gliims-feed {
  width: 100%;
  min-width: 0;
}

/* ============================================
   TRASH LIST
   ============================================ */
.profile-trash-note {
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  margin: 0 0 14px;
}

.profile-trash-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
}

.profile-trash-cover {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.profile-trash-cover-empty {
  background: var(--surface-2);
}

.profile-trash-text {
  min-width: 0;
  flex: 1 1 auto;
}

.profile-trash-title {
  font-weight: var(--fw-medium);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-trash-meta,
.profile-trash-reason,
.profile-trash-locked {
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  margin-top: 3px;
}

.profile-trash-restore {
  flex: 0 0 auto;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-full);
  background: var(--primary);
  color: #fff;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  cursor: pointer;
}

.profile-trash-restore:disabled {
  opacity: .5;
  cursor: default;
}

@media (max-width: 768px) {
  .profile-trash-row {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .profile-trash-action {
    width: 100%;
  }

  .profile-trash-restore {
    width: 100%;
  }
}

/* ============================================
   SEARCH DROPDOWN
   ============================================ */
#profile-search-dropdown {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  min-width: 100%;
  z-index: 1000;
  overflow: hidden;
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  #profile-search-dropdown {
    top: auto !important;
    bottom: 110%;
  }

  .profile-banner {
    height: 200px;
  }

  .profile-banner-identity {
    left: 16px;
    right: 16px;
    bottom: 16px;
    gap: 12px;
  }

  .profile-banner-identity .profile-avatar-large,
  .profile-banner-identity .profile-avatar-fallback {
    width: 72px;
    height: 72px;
    border-width: 3px;
  }

  .profile-banner-text h1 {
    font-size: 20px;
  }

  .profile-header-actions {
    padding: 12px 16px;
  }

  .profile-social-chip {
    max-width: 200px;
  }

  .profile-details-panel {
    padding: 16px;
  }

  .profile-details-stats {
    flex-wrap: wrap;
    gap: 20px;
    padding: 16px;
  }

  .profile-stat {
    flex: 1;
    min-width: calc(50% - 10px);
  }

  .profile-projects-section {
    padding: 0 8px;
  }

  .profile-projects-header {
    flex-wrap: wrap;
  }

  .profile-banner:not(.no-image) .profile-banner-social {
    right: 16px;
    bottom: 16px;
    max-width: 150px;
  }

  .profile-banner:has(.profile-banner-social):not(.no-image) .profile-banner-identity {
    padding-right: 150px;
  }

  .qr-large-actions {
    flex-direction: column;
  }

  .qr-large-actions .btn-secondary,
  .qr-large-actions .btn-primary {
    width: 100%;
  }

  .streak-stats {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .streak-item {
    padding: 12px;
  }

  .streak-value {
    font-size: 24px;
  }
}
