/* Facebook-style profile page */

.profile-page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 12px 48px;
  width: 100%;
  min-width: 0;
}

.profile-page[hidden] {
  display: none !important;
}

.profile-shell {
  width: 100%;
}

.profile-cover-wrap {
  position: relative;
  border-radius: 0 0 12px 12px;
  overflow: hidden;
  background: linear-gradient(135deg, #6c4dff 0%, #db2777 55%, #f59e0b 100%);
  height: 280px;
}

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

.profile-cover--empty {
  width: 100%;
  height: 100%;
}

.profile-cover__edit {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 2;
}

.profile-header {
  display: flex;
  align-items: flex-end;
  gap: 20px;
  padding: 0 16px 16px;
  margin-top: -44px;
  position: relative;
  z-index: 1;
  flex-wrap: wrap;
}

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

.profile-avatar {
  width: 168px;
  height: 168px;
  border-radius: 50%;
  border: 4px solid var(--card-bg, #fff);
  background: var(--page-bg);
  object-fit: cover;
  display: block;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.profile-header__info {
  flex: 1;
  min-width: 200px;
  padding-bottom: 8px;
  padding-top: 52px;
}

.profile-header__name {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.profile-header__meta {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.profile-header__stats {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 2px;
}

.profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding-bottom: 12px;
  margin-left: auto;
}

.profile-tabs {
  display: flex;
  gap: 4px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--card-bg);
  position: sticky;
  top: 56px;
  z-index: 5;
  overflow-x: auto;
  padding: 0 8px;
  margin-top: 4px;
  scrollbar-width: none;
}

.profile-tabs::-webkit-scrollbar {
  display: none;
}

.profile-tab {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 14px 16px;
  cursor: pointer;
  position: relative;
  white-space: nowrap;
  border-radius: 8px 8px 0 0;
}

.profile-tab:hover {
  background: var(--page-bg);
  color: var(--text-primary);
}

.profile-tab--active {
  color: var(--primary, #6c4dff);
}

.profile-tab--active::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--primary, #6c4dff);
}

.profile-body {
  padding: 16px 0 0;
}

.profile-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
  align-items: start;
}

.profile-intro-card,
.profile-about-card,
.profile-friends-grid,
.profile-photos-grid,
.profile-posts-col,
.profile-guest-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

.profile-intro-card h3,
.profile-about-card h3,
.profile-section-title {
  margin: 0 0 12px;
  font-size: 1.1rem;
  font-weight: 700;
}

.profile-intro__bio {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin: 0 0 12px;
  white-space: pre-wrap;
  word-break: break-word;
}

.profile-intro__row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.profile-intro__row .material-symbols-rounded,
.profile-intro__row i {
  flex-shrink: 0;
  margin-top: 2px;
}

.profile-intro__photos {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin-top: 12px;
}

.profile-intro__photos img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}

.profile-empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}

.profile-empty h3 {
  margin: 0 0 8px;
  color: var(--text-primary);
}

.profile-empty p {
  margin: 0 0 16px;
}

.profile-posts-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.profile-about-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.profile-about-list li {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}

.profile-about-list li:last-child {
  border-bottom: none;
}

.profile-about-list strong {
  min-width: 100px;
  color: var(--text-muted);
  font-weight: 600;
}

.profile-friends-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.profile-friend-card {
  text-align: center;
  padding: 12px 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--page-bg);
}

.profile-friend-card img {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 8px;
  display: block;
}

.profile-friend-card strong {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.profile-photos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
}

.profile-photos-grid a,
.profile-photos-grid button {
  display: block;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 8px;
  overflow: hidden;
}

.profile-photos-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}

.profile-guest-card {
  text-align: center;
  padding: 48px 24px;
  max-width: 480px;
  margin: 24px auto;
}

.profile-guest-card img {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  margin: 0 auto 16px;
  border: 3px solid var(--border);
}

.profile-guest-card h2 {
  margin: 0 0 8px;
}

.profile-guest-card p {
  color: var(--text-muted);
  margin: 0 0 20px;
}

.profile-edit-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.profile-edit-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.profile-edit-form input[type="text"],
.profile-edit-form textarea {
  font: inherit;
  font-weight: 400;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--page-bg);
  color: var(--text-primary);
  resize: vertical;
}

.profile-edit-form input[type="file"] {
  font-weight: 400;
  font-size: 0.85rem;
}

.profile-edit-previews {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
}

.profile-edit-previews img.profile-edit-avatar-prev {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
}

.profile-edit-previews img.profile-edit-cover-prev {
  width: 160px;
  height: 64px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: linear-gradient(135deg, #6c4dff, #db2777);
}

.profile-loading {
  text-align: center;
  padding: 64px 20px;
  color: var(--text-muted);
}

body.is-profile-view .sidebar-left {
  /* keep sidebar available */
}

body.is-profile-view #viewProfile {
  display: block;
}

@media (max-width: 900px) {
  .profile-layout {
    grid-template-columns: 1fr;
  }

  .profile-cover-wrap {
    height: 200px;
    border-radius: 0;
  }

  .profile-avatar {
    width: 128px;
    height: 128px;
  }

  .profile-header {
    margin-top: -36px;
    flex-direction: column;
    align-items: flex-start;
  }

  .profile-header__info {
    padding-top: 0;
  }

  .profile-actions {
    margin-left: 0;
    width: 100%;
  }

  .profile-header__name {
    font-size: 1.4rem;
  }

  .profile-tabs {
    top: 0;
  }
}
