/* ── Profile Page Styles ── */
.profile-main {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 20px 100px;
  position: relative;
  z-index: 1;
}

/* Input Card */
.profile-input-card { text-align: center; }
.profile-input-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 1.2rem;
  font-weight: 800;
  margin-bottom: 8px;
}
.profile-input-sub {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 24px;
}
.profile-form { display: flex; flex-direction: column; gap: 14px; }
.profile-input-row {
  display: flex;
  align-items: center;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 14px;
  transition: border-color 0.2s;
}
.profile-input-row:focus-within { border-color: var(--accent2); }
.at-symbol {
  color: var(--accent2);
  font-weight: 700;
  font-size: 1.1rem;
  margin-right: 4px;
}
.profile-input-row input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  padding: 14px 0;
  outline: none;
}

/* Loading */
.profile-loading { text-align: center; padding: 48px 28px; }

/* Profile Header */
.profile-header-card { overflow: visible; }
.profile-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}
.profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 3px solid var(--accent2);
  object-fit: cover;
  flex-shrink: 0;
}
.profile-info { flex: 1; min-width: 0; }
.profile-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}
.profile-fullname { font-size: 1.2rem; font-weight: 800; }
.verified-badge {
  background: #3b82f6;
  color: #fff;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 800;
}
.profile-username {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-bottom: 8px;
}
.profile-bio {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 8px;
}
.profile-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.profile-tag {
  background: rgba(124,58,237,0.1);
  border: 1px solid rgba(124,58,237,0.25);
  color: var(--accent2);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.72rem;
  font-weight: 600;
}

/* Stats Row */
.profile-stats-row {
  display: flex;
  justify-content: space-around;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}
.profile-stat {
  text-align: center;
}
.profile-stat-value {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text);
}
.profile-stat-label {
  font-size: 0.72rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

/* Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.metric-item {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
}
.metric-value {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 4px;
}
.metric-value.high { color: var(--green); }
.metric-value.mid { color: var(--yellow); }
.metric-value.low { color: var(--red); }
.metric-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.metric-desc {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-top: 4px;
  line-height: 1.3;
}

/* Chart */
.chart-wrap {
  height: 200px;
  display: flex;
  align-items: flex-end;
  gap: 4px;
  padding: 10px 0;
  overflow-x: auto;
}
.chart-bar-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 40px;
  flex: 1;
}
.chart-bar {
  width: 100%;
  max-width: 32px;
  border-radius: 4px 4px 0 0;
  transition: height 0.5s ease;
  min-height: 4px;
}
.chart-bar.views { background: var(--accent2); }
.chart-bar.likes { background: var(--green); opacity: 0.7; }
.chart-bar-label {
  font-size: 0.6rem;
  color: var(--text-dim);
  white-space: nowrap;
}
.chart-legend {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
}
.chart-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.chart-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

/* Hashtags Cloud */
.hashtags-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.hashtag-chip {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.8rem;
  color: var(--text);
  font-weight: 500;
  transition: all 0.2s;
}
.hashtag-chip:hover {
  border-color: var(--accent2);
  color: var(--accent2);
}
.hashtag-count {
  color: var(--text-dim);
  font-size: 0.7rem;
  margin-left: 4px;
}

/* Recent Posts Grid */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.post-item {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.post-thumb {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  background: var(--bg);
}
.post-stats {
  padding: 8px 10px;
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-muted);
}
.post-stat { display: flex; align-items: center; gap: 3px; }

@media (max-width: 480px) {
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .posts-grid { grid-template-columns: repeat(2, 1fr); }
  .profile-avatar { width: 56px; height: 56px; }
}


/* ── Blurred Preview + Unlock ── */
#blurredPreview {
  position: relative;
}
.blurred-section {
  filter: blur(6px);
  pointer-events: none;
  user-select: none;
}
.blurred-text {
  filter: blur(4px);
}
.profile-avatar-placeholder {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--bg3), var(--accent));
  opacity: 0.5;
  flex-shrink: 0;
}

/* Unlock Overlay */
.unlock-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  padding: 20px;
}
.unlock-card {
  background: rgba(17,17,24,0.95);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 28px;
  text-align: center;
  max-width: 380px;
  width: 100%;
  box-shadow: 0 16px 48px rgba(0,0,0,0.5);
  backdrop-filter: blur(20px);
  animation: cardIn 0.5s ease;
}
.unlock-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
}
.unlock-title {
  font-size: 1.2rem;
  font-weight: 800;
  margin-bottom: 8px;
}
.unlock-sub {
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.5;
  margin-bottom: 24px;
}


/* ── Skeleton Loading ── */
@keyframes skeletonPulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}
.skeleton-card { padding: 24px; }
.skeleton-header { display: flex; gap: 14px; margin-bottom: 20px; }
.skeleton-circle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--bg3);
  animation: skeletonPulse 1.5s ease-in-out infinite;
  flex-shrink: 0;
}
.skeleton-lines { flex: 1; display: flex; flex-direction: column; gap: 8px; justify-content: center; }
.skeleton-line {
  height: 12px;
  border-radius: 6px;
  background: var(--bg3);
  animation: skeletonPulse 1.5s ease-in-out infinite;
}
.skeleton-line.w30 { width: 30%; }
.skeleton-line.w40 { width: 40%; }
.skeleton-line.w60 { width: 60%; }
.skeleton-line.w80 { width: 80%; }
.skeleton-stats {
  display: flex;
  justify-content: space-around;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}
.skeleton-stat {
  width: 60px;
  height: 40px;
  border-radius: 8px;
  background: var(--bg3);
  animation: skeletonPulse 1.5s ease-in-out infinite;
}
.skeleton-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.skeleton-metric {
  height: 80px;
  border-radius: var(--radius-sm);
  background: var(--bg3);
  animation: skeletonPulse 1.5s ease-in-out infinite;
}
.skeleton-chart {
  height: 160px;
  border-radius: var(--radius-sm);
  background: var(--bg3);
  animation: skeletonPulse 1.5s ease-in-out infinite;
}
.skeleton-hint {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.82rem;
  margin-top: 16px;
  animation: skeletonPulse 2s ease-in-out infinite;
}

/* ── Post Thumb Fallback ── */
.post-thumb-wrap {
  width: 100%;
  aspect-ratio: 1;
  background: linear-gradient(135deg, var(--bg3), rgba(124,58,237,0.1));
  display: flex;
  align-items: center;
  justify-content: center;
}
.post-thumb-fallback {
  font-size: 1.5rem;
  opacity: 0.6;
}
.post-item {
  text-decoration: none;
  color: inherit;
  display: block;
  transition: transform 0.2s, border-color 0.2s;
}
.post-item:hover {
  transform: translateY(-2px);
  border-color: var(--accent2);
}

/* ── Avatar Fallback ── */
.profile-avatar-fallback {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}


/* ── Edit Username Button ── */
.edit-username-btn {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  margin-left: 4px;
}
.edit-username-btn:hover {
  background: rgba(168,85,247,0.1);
  border-color: var(--accent2);
  color: var(--accent2);
}

/* ── Change Username Popup ── */
.popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  padding: 20px;
  animation: fadeIn 0.2s ease;
}
.popup-overlay[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.popup-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 28px;
  max-width: 380px;
  width: 100%;
  position: relative;
  box-shadow: 0 16px 48px rgba(0,0,0,0.5);
  animation: cardIn 0.3s ease;
}
.popup-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}
.popup-close:hover {
  background: rgba(239,68,68,0.1);
  border-color: var(--red);
  color: var(--red);
}
.popup-title {
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 8px;
}
.popup-sub {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 20px;
  line-height: 1.4;
}
