/* ============================================
   profile.css — User profile view
   All rules scoped to .profile-view-shell
   ============================================ */

/* ========== SHELL LAYOUT ========== */

.profile-view-shell {
  display: grid;
  grid-template-columns: 1fr 520px;
  gap: 0;
  min-height: calc(100vh - 52px);
  background: var(--color-canvas);
  align-items: start;
}

/* ========== RIGHT INFO PANEL ========== */

.profile-info-col {
  width: 520px;
  border-left: 1px solid var(--color-border);
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  gap: 0;
  position: sticky;
  top: 52px;
  height: calc(100vh - 52px);
  overflow-y: auto;
  background: var(--color-canvas-subtle);
}

.profile-avatar-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 18px;
}

.profile-avatar {
  width: 152px;
  height: 152px;
  min-width: 152px;
  min-height: 152px;
  border-radius: 50%;
  background: var(--gradient-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 56px;
  color: white;
  font-weight: 700;
  font-family: var(--font-display);
  overflow: hidden;
  flex-shrink: 0;
}

.profile-avatar img {
  width: 152px;
  height: 152px;
  min-width: 152px;
  min-height: 152px;
  object-fit: cover;
  display: block;
  border-radius: 50%;
}

.profile-display-name {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: center;
  color: var(--color-text-primary);
}

.profile-pronouns {
  font-size: 13px;
  color: var(--color-text-muted);
  text-align: center;
  margin-top: 2px;
}

.profile-handle {
  font-size: 15px;
  color: var(--color-text-muted);
  text-align: center;
  margin-top: 2px;
  margin-bottom: 14px;
}

.profile-creator-badge {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: rgba(109, 40, 217, 0.12);
  border: 1px solid rgba(109, 40, 217, 0.3);
  color: var(--color-purple);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  margin: 0 auto 14px;
}

.profile-view-shell.is-creator .profile-creator-badge {
  display: inline-flex;
}

/* ========== STATS ========== */

.profile-stats {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--color-border);
}

.profile-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  cursor: pointer;
}

.profile-stat:hover .profile-stat-num {
  color: var(--color-purple);
}

.profile-stat-num {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text-primary);
  transition: color 0.15s;
}

.profile-stat-label {
  font-size: 10px;
  color: var(--color-text-muted);
  letter-spacing: 0.05em;
}

/* ========== ACTIONS ========== */

.profile-actions {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 16px;
  align-items: center;
}

.profile-btn {
  width: auto;
  padding: 8px 24px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  cursor: pointer;
  font-family: var(--font-display);
  transition: opacity 0.15s;
  text-align: center;
}

.profile-btn-outline {
  background: transparent;
  border: 1.5px solid var(--color-border-strong);
  color: var(--color-text-primary);
}

.profile-btn-outline:hover {
  border-color: var(--color-text-muted);
}

.profile-btn-follow {
  background: transparent;
  border: 1.5px solid var(--color-purple);
  color: var(--color-purple);
}

.profile-btn-follow:hover {
  background: rgba(109, 40, 217, 0.06);
}

.profile-btn-following {
  background: transparent;
  border: 1.5px solid rgba(109, 40, 217, 0.4);
  color: var(--color-purple);
}

.profile-btn-following:hover {
  background: rgba(109, 40, 217, 0.06);
}

.profile-btn-message {
  background: transparent;
  border: 1.5px solid var(--color-border-strong);
  color: var(--color-text-primary);
}

.profile-btn-message:hover {
  border-color: var(--color-text-muted);
}

/* ========== LINKS ========== */

.profile-links {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  margin-bottom: 16px;
}

.profile-link-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--color-purple);
  background: rgba(109, 40, 217, 0.07);
  border: 1px solid rgba(109, 40, 217, 0.15);
  border-radius: var(--radius-pill);
  padding: 5px 11px;
  text-decoration: none;
  transition: background 0.15s;
}

.profile-link-pill:hover {
  background: rgba(109, 40, 217, 0.12);
}

/* ========== CENTER GRID COLUMN ========== */

.profile-grid-col {
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  height: calc(100vh - 52px);
}

/* ========== TABS ========== */

.profile-tabs {
  display: flex;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 18px;
}

.profile-tab {
  padding: 9px 18px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  cursor: pointer;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: none;
  font-family: var(--font-display);
  transition: color 0.15s;
}

.profile-tab.active {
  color: var(--color-text-primary);
  border-bottom-color: var(--color-purple);
}

.profile-tab:hover:not(.active) {
  color: var(--color-text-secondary);
}

/* ========== PAGES GRID ========== */

.profile-pages-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}

.profile-page-card {
  aspect-ratio: 9/16;
  border-radius: 7px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  background: var(--color-canvas-inset);
}

.profile-page-card:hover .profile-page-overlay {
  opacity: 1;
}

.profile-page-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  opacity: 0;
  transition: opacity 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 20px;
}

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

/* ========== EMPTY / PRIVATE STATES ========== */

.profile-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 60px 20px;
  color: var(--color-text-muted);
  text-align: center;
  font-size: 14px;
}

.profile-private-gate {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 60px 20px;
  color: var(--color-text-muted);
  text-align: center;
}

.profile-private-icon {
  font-size: 32px;
  color: var(--color-text-subtle);
  margin-bottom: 4px;
}

.profile-private-text {
  font-size: 14px;
}

/* ========== STICKERS GRID ========== */

.profile-stickers-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.profile-sticker-tile {
  aspect-ratio: 1;
  background: var(--color-canvas-inset);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: background 0.15s;
}

.profile-sticker-tile:hover {
  background: var(--color-canvas-subtle);
}

.profile-sticker-tile img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 8px;
  display: block;
}

/* ========== MOBILE ========== */

@media (max-width: 768px) {

  /* Layout — collapse to single column, identity on top */
  .profile-view-shell {
    display: flex;
    flex-direction: column;
    overflow: visible;
    min-height: unset;
  }

  .profile-info-col {
    order: -1;
    width: 100%;
    border-left: none;
    border-bottom: none;
    position: static;
    height: auto;
    overflow-y: visible;
    padding: 10px 16px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background: #ffffff;
  }

  .profile-grid-col {
    order: 0;
    width: 100%;
    overflow-y: visible;
    height: auto;
    padding-top: 0;
  }

  .profile-tabs {
    margin-bottom: 0;
  }

  /* Avatar — centered, larger */
  .profile-avatar-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 12px;
  }

  .profile-avatar {
    width: 88px;
    height: 88px;
    min-width: 88px;
    min-height: 88px;
  }

  /* Identity text — centered */
  .profile-display-name,
  .profile-pronouns,
  .profile-handle,
  .profile-creator-badge {
    text-align: center;
  }

  /* Stats — centered row */
  .profile-stats {
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap: 32px;
    margin-top: 10px;
    margin-bottom: 0;
    width: 100%;
  }

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

  /* Actions — centered row */
  .profile-actions {
    display: none;
  }

  /* Links — centered */
  .profile-links {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
    width: 100%;
  }

  .profile-tab {
    flex: 1;
  }

  .profile-tab.active::after {
    left: 10%;
    right: 10%;
  }

  /* Post grid — 3 columns */
  .profile-pages-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  /* Lightbox — preserve existing rules */
  .profile-lightbox-modal {
    flex-direction: column;
    height: 95vh;
    width: 95vw;
  }

  .profile-lightbox-image-col {
    width: 100%;
    height: 40vh;
    flex: 0 0 40vh;
  }

  .profile-lightbox-right-col {
    flex: 1;
    min-height: 0;
  }

}

/* ========== LIGHTBOX ========== */

.profile-lightbox-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-lightbox-close {
  position: fixed;
  top: 20px;
  right: 20px;
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  z-index: 1001;
  padding: 4px;
  display: flex;
  align-items: center;
  opacity: 0.7;
  transition: opacity 0.15s;
}

.profile-lightbox-close:hover {
  opacity: 1;
}

.profile-lightbox-modal {
  display: flex;
  width: 90vw;
  max-width: 900px;
  height: 85vh;
  max-height: 600px;
  border-radius: 4px;
  overflow: hidden;
}

.profile-lightbox-image-col {
  flex: 0 0 auto;
  width: calc(85vh * 9 / 16);
  max-width: calc(600px * 9 / 16);
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

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

.profile-lightbox-image-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-canvas-inset);
}

.profile-lightbox-right-col {
  flex: 1;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  border-left: 1px solid #e4e4e7;
  min-width: 0;
}

.profile-lightbox-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid #e4e4e7;
  flex-shrink: 0;
}

.profile-lightbox-header-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--gradient-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: white;
  font-family: var(--font-display);
  overflow: hidden;
  flex-shrink: 0;
}

.profile-lightbox-header-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-lightbox-header-avatar.clickable {
  cursor: pointer;
}

.profile-lightbox-header-info {
  flex: 1;
}

.profile-lightbox-header-name {
  font-size: 13px;
  font-weight: 700;
  color: #18181b;
  font-family: var(--font-display);
  letter-spacing: 0.03em;
}

.profile-lightbox-header-name.clickable {
  cursor: pointer;
}

.profile-lightbox-header-name.clickable:hover {
  text-decoration: underline;
}

.profile-lightbox-header-handle {
  font-size: 11px;
  color: #71717a;
  font-family: var(--font-display);
}

.profile-lightbox-comments-area {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.profile-lightbox-caption {
  display: flex;
  gap: 10px;
}

.profile-lightbox-comment-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--gradient-accent);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: white;
  font-family: var(--font-display);
  overflow: hidden;
}

.profile-lightbox-comment-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-lightbox-caption-body {
  flex: 1;
}

.profile-lightbox-caption-name {
  font-size: 12px;
  font-weight: 700;
  color: #18181b;
  font-family: var(--font-display);
  display: inline;
}

.profile-lightbox-caption-text {
  font-size: 12px;
  color: #3f3f46;
  font-family: var(--font-display);
  display: inline;
  margin-left: 5px;
  line-height: 1.5;
}

.profile-lightbox-caption-time {
  font-size: 10px;
  color: #a1a1aa;
  font-family: var(--font-display);
  margin-top: 4px;
}

.profile-lightbox-divider {
  border: none;
  border-top: 1px solid #f4f4f5;
  margin: 0;
}

.profile-lightbox-comment {
  display: flex;
  gap: 10px;
}

.profile-lightbox-comment-body {
  flex: 1;
}

.profile-lightbox-comment-name {
  font-size: 12px;
  font-weight: 700;
  color: #18181b;
  font-family: var(--font-display);
  display: inline;
}

.profile-lightbox-comment-text {
  font-size: 12px;
  color: #3f3f46;
  font-family: var(--font-display);
  display: inline;
  margin-left: 5px;
  line-height: 1.5;
}

.profile-lightbox-comment-time {
  font-size: 10px;
  color: #a1a1aa;
  font-family: var(--font-display);
  margin-top: 3px;
}

.profile-lightbox-empty-comments {
  font-size: 13px;
  color: #a1a1aa;
  font-family: var(--font-display);
  text-align: center;
  padding: 24px 0;
}

.profile-lightbox-actions {
  padding: 12px 16px 10px;
  border-top: 1px solid #e4e4e7;
  flex-shrink: 0;
}

.profile-lightbox-action-btns {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.profile-lightbox-action-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #71717a;
  display: flex;
  align-items: center;
  padding: 0;
  transition: color 0.15s;
}

.profile-lightbox-action-btn:hover {
  color: #18181b;
}

.profile-lightbox-action-btn.liked {
  color: #e53935;
}

.profile-lightbox-like-count {
  font-size: 12px;
  font-weight: 700;
  color: #18181b;
  font-family: var(--font-display);
  margin-bottom: 4px;
}

.profile-lightbox-timestamp {
  font-size: 10px;
  color: #a1a1aa;
  font-family: var(--font-display);
  margin-bottom: 10px;
}

.profile-lightbox-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid #e4e4e7;
}

.profile-lightbox-input-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--gradient-accent);
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: white;
  font-family: var(--font-display);
}

.profile-lightbox-input-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-lightbox-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: #18181b;
  font-size: 12px;
  font-family: var(--font-display);
}

.profile-lightbox-input::placeholder {
  color: #a1a1aa;
}

.profile-lightbox-post-btn {
  background: none;
  border: none;
  color: var(--color-purple);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font-display);
  padding: 0;
  opacity: 0.4;
  transition: opacity 0.15s;
}

.profile-lightbox-post-btn.active {
  opacity: 1;
}

/* Stickers grid — other profile (v=1) */
#profile-stickers-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 16px;
}

.profile-sticker-card {
  aspect-ratio: 1;
  background: var(--color-canvas-inset);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 8px;
}

/* ========== PEOPLE MODAL ========== */

#people-modal-panel {
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid #e4e4e7;
  width: 500px;
  max-width: calc(100vw - 32px);
  height: 600px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#people-modal-list {
  overflow-y: auto;
  flex: 1;
  padding: 8px 0;
}

.people-modal-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
}

.people-modal-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  flex-shrink: 0;
  overflow: hidden;
  background: #f4f4f5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: #71717a;
}

/* ========== FLIP LIGHTBOX ========== */

#flip-lightbox-backdrop {
  touch-action: none;
}

#flip-lightbox-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(0,0,0,0.4);
}

.people-modal-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.people-modal-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.people-modal-name {
  font-size: 14px;
  font-weight: 600;
  color: #18181b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.people-modal-handle {
  font-size: 12px;
  color: #71717a;
}

.people-modal-follow-btn {
  background: #6D28D9;
  border: none;
  border-radius: 999px;
  padding: 6px 14px;
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.05em;
  color: #ffffff;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
}

.people-modal-follow-btn.is-following {
  background: transparent;
  border: 1.5px solid #d4d4d8;
  color: #71717a;
}

.people-modal-more-btn {
  background: #f4f4f5;
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #71717a;
  flex-shrink: 0;
}

.people-modal-dropdown {
  position: absolute;
  background: #ffffff;
  border: 0.5px solid #e4e4e7;
  border-radius: 10px;
  overflow: hidden;
  z-index: 1300;
  min-width: 160px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.10);
}

.people-modal-dropdown-item {
  padding: 11px 16px;
  font-size: 14px;
  color: #18181b;
  cursor: pointer;
  white-space: nowrap;
}

.people-modal-dropdown-item:hover {
  background: #f4f4f5;
}

.people-modal-dropdown-item.danger {
  color: #dc2626;
}
