.profile-public-page {
  background: var(--section-bg-color);
  color: var(--p-color);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  max-width: 100%;
}

html,
body {
  overflow-x: hidden;
  width: 100%;
}

html.profile-modal-open,
body.profile-modal-open {
  overflow: hidden;
  height: 100%;
}

.profile-public-page::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: calc(var(--profile-hero-offset, 32px) + 360px);
  background-image: linear-gradient(15deg, var(--brand-gradient-start) 0%, var(--brand-gradient-end) 100%);
  z-index: 0;
}

.profile-topbar-shell {
  position: relative;
  z-index: 2;
  background-image: linear-gradient(15deg, var(--brand-gradient-start) 0%, var(--brand-gradient-end) 100%);
  border-bottom: none;
}

.profile-public-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 28px;
  border-bottom: 1px solid var(--navbar-border-color);
  background: var(--white-color);
}

.profile-nav-logo {
  font-family: var(--display-font-family);
  font-weight: var(--font-weight-bold);
  color: var(--dark-color);
  text-decoration: none;
  letter-spacing: 0.3px;
}

.profile-nav-links {
  display: flex;
  gap: 16px;
}

.profile-nav-links a {
  color: var(--p-color);
  text-decoration: none;
  font-weight: var(--font-weight-medium);
}

.profile-nav-links a:hover {
  color: var(--secondary-color);
}

.profile-public-shell {
  max-width: 1200px;
  margin: 0 auto;
  --profile-hero-offset: 32px;
  padding: var(--profile-hero-offset) 18px 80px;
  width: min(1200px, 100%);
  box-sizing: border-box;
  position: relative;
  z-index: 1;
}

.profile-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: min(1164px, 100%);
  margin: 0 auto;
  padding: 14px 18px;
  box-sizing: border-box;
}

.profile-topbar-left {
  display: flex;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
}

.profile-topbar-right {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.profile-topbar-link {
  text-decoration: none;
  color: #ffffff;
  font-weight: var(--font-weight-regular);
  font-size: 15px;
}

.profile-topbar-link:hover {
  color: rgba(255, 255, 255, 0.85);
}


.profile-topbar-icon {
  width: auto;
  height: auto;
  border-radius: 0;
  border: none;
  background: transparent;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  padding: 6px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.profile-topbar-icon:hover {
  transform: translateY(-1px);
  color: rgba(255, 255, 255, 0.85);
}

.profile-status {
  width: fit-content;
  max-width: 100%;
  margin: 0 auto 20px;
  padding: 12px 16px;
  border-radius: 12px;
  background: #ffffff;
  color: #0f172a;
  font-size: 0.95rem;
  font-weight: var(--font-weight-semibold);
  border-left: 4px solid #783dd2;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.16);
}

.profile-header {
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  position: relative;
  z-index: 0;
}

.profile-hero {
  position: relative;
  padding: 40px 0 40px;
  display: flex;
  justify-content: center;
  margin-bottom: 26px;
  background: transparent;
  z-index: 1;
}

.profile-hero-card {
  z-index: 1;
}

.profile-hero-card {
  position: relative;
  width: min(1164px, 100%);
  box-sizing: border-box;
  background: var(--white-color);
  border-radius: 32px;
  padding: 92px 48px 34px;
  text-align: center;
  box-shadow: 0 28px 60px rgba(15, 23, 42, 0.12);
  border: 1px solid rgba(15, 23, 42, 0.06);
  box-sizing: border-box;
}

.profile-hero-top {
  position: absolute;
  top: 22px;
  left: 28px;
  right: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.profile-hero-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.profile-avatar-wrap {
  position: absolute;
  top: -60px;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 120px;
  border-radius: 999px;
  background: var(--white-color);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 18px 35px rgba(15, 23, 42, 0.16);
}

.profile-avatar {
  width: 112px;
  height: 112px;
  border-radius: 999px;
  border: 4px solid var(--white-color);
  object-fit: cover;
  background: var(--white-color);
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.12);
}

.profile-hero-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.profile-name {
  font-size: 38px;
  font-weight: var(--font-weight-bold);
  margin: 0;
  color: var(--dark-color);
}

.profile-username {
  display: none;
}

.profile-location {
  font-size: 16px;
  color: #6b7280;
}

.profile-bio {
  margin: 6px 0 0;
  font-size: 16px;
  color: var(--p-color);
}

.profile-school {
  font-size: 15px;
  color: #8b90a1;
  margin: 0;
}

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

.profile-social a {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(255, 108, 132, 0.3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #ff6c84;
  background: rgba(255, 108, 132, 0.08);
  text-decoration: none;
  transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.profile-social a:hover {
  transform: translateY(-2px);
  background: rgba(255, 108, 132, 0.16);
  box-shadow: 0 8px 16px rgba(255, 108, 132, 0.2);
}

.profile-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(255, 108, 132, 0.3);
  background: rgba(255, 108, 132, 0.08);
  color: #ff6c84;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  text-decoration: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.profile-icon-btn:hover {
  transform: translateY(-2px);
  background: rgba(255, 108, 132, 0.16);
  box-shadow: 0 8px 16px rgba(255, 108, 132, 0.2);
  color: #ff6c84;
}

.profile-icon-btn:active {
  transform: translateY(0);
  background: rgba(255, 108, 132, 0.2);
  color: #ff6c84;
}

.profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 16px;
}

.profile-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 8px 16px;
  background: #7c3aed;
  color: #fff;
  border: 1px solid transparent;
  font-weight: var(--font-weight-semibold);
  text-decoration: none;
  font-size: 13px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.profile-action-btn:hover {
  background: #6d28d9;
  box-shadow: 0 10px 20px rgba(124, 58, 237, 0.25);
  transform: translateY(-1px);
}

.profile-action-btn.is-following {
  background: rgba(124, 58, 237, 0.12);
  color: #5b21b6;
  border-color: rgba(124, 58, 237, 0.3);
  box-shadow: none;
  transform: none;
}

.profile-header-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  padding: 18px 0 0;
  margin: 24px 0 0;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
}

.profile-stat {
  background: transparent;
  border-radius: 16px;
  padding: 8px 4px;
  text-align: center;
  border: none;
  box-shadow: none;
}

button.profile-stat {
  cursor: pointer;
  transition: transform 0.2s ease;
}

button.profile-stat:hover {
  transform: translateY(-2px);
}

.profile-stat-value {
  font-size: 24px;
  font-weight: var(--font-weight-bold);
  color: var(--dark-color);
}

.profile-stat-label {
  display: block;
  margin-top: 4px;
  font-size: 14px;
  color: var(--p-color);
}

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

.profile-tab {
  border: none;
  background: transparent;
  padding: 10px 16px;
  font-weight: var(--font-weight-semibold);
  color: var(--p-color);
  border-bottom: 3px solid transparent;
}

.profile-tab.is-active {
  color: var(--secondary-color);
  border-bottom-color: var(--secondary-color);
}

.profile-panel {
  background: var(--white-color);
  border-radius: 24px;
  padding: 24px;
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.08);
}

.profile-panel + .profile-panel {
  margin-top: 20px;
}

.profile-panel-header {
  display: none;
}

.profile-panel-title {
  font-weight: var(--font-weight-bold);
  color: var(--dark-color);
  font-size: 18px;
}

.profile-sort {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--p-color);
}

.profile-sort select {
  min-width: 160px;
}

.profile-lessons-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  justify-content: start;
}

.profile-lesson-card {
  background: #fdfbff;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(107, 52, 196, 0.12);
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.profile-lesson-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.12);
}

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

.profile-lesson-card.is-loading {
  pointer-events: none;
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.08);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06);
}

.skeleton-block {
  position: relative;
  overflow: hidden;
  background: #f0f2f5;
  border-radius: 10px;
}

.skeleton-block::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, rgba(240, 242, 245, 0), rgba(255, 255, 255, 0.85), rgba(240, 242, 245, 0));
  animation: profile-skeleton 1.4s linear infinite;
}

body.dark-mode .skeleton-block {
  background: #1f2937;
}

body.dark-mode .skeleton-block::after {
  background: linear-gradient(90deg, rgba(31, 41, 55, 0), rgba(148, 163, 184, 0.4), rgba(31, 41, 55, 0));
}

.profile-skeleton-line {
  height: 14px;
  width: 75%;
  margin-bottom: 10px;
}

.profile-skeleton-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.profile-skeleton-line-short {
  width: 52%;
}

.profile-skeleton-chip {
  height: 10px;
  width: 68px;
  border-radius: 999px;
}

@keyframes profile-skeleton {
  100% {
    transform: translateX(100%);
  }
}

.profile-lesson-body {
  padding: 14px 16px 18px;
}

.profile-lesson-title {
  font-weight: var(--font-weight-semibold);
  font-size: 16px;
  margin-bottom: 8px;
  color: var(--dark-color);
}

.profile-lesson-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 13px;
  color: var(--p-color);
}

.profile-lesson-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.profile-empty {
  text-align: center;
  margin-top: 18px;
  color: var(--p-color);
}

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

.profile-list-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(107, 52, 196, 0.12);
  background: #fdfbff;
}

.profile-list-link {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 auto;
  text-decoration: none;
  color: inherit;
}

.profile-list-avatar {
  width: 46px;
  height: 46px;
  border-radius: 999px;
  object-fit: cover;
  background: var(--white-color);
  border: 2px solid rgba(107, 52, 196, 0.18);
}

.profile-list-name {
  font-weight: var(--font-weight-semibold);
  color: var(--dark-color);
}

.profile-list-username {
  font-size: 13px;
  color: var(--secondary-color);
}

.profile-list-actions {
  margin-left: auto;
}

.profile-follow-btn {
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 14px;
}

.profile-follow-btn.is-following {
  background: var(--secondary-color);
  color: var(--white-color);
  border-color: var(--secondary-color);
}

.profile-load-more {
  margin: 16px auto 0;
  display: block;
  border-radius: 999px;
  padding: 10px 20px;
  border: 1px solid rgba(107, 52, 196, 0.3);
  background: transparent;
  color: var(--secondary-color);
}

.profile-empty-state {
  background: var(--white-color);
  border-radius: 24px;
  padding: 40px;
  text-align: center;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
}

.profile-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 2000;
  overscroll-behavior: contain;
}

.profile-modal-card {
  background: var(--white-color);
  border-radius: 20px;
  padding: 18px 20px 20px;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.2);
}

.profile-edit-card {
  max-width: 680px;
  max-height: 85vh;
  overflow: auto;
  scrollbar-width: none;
}

.profile-edit-card::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.profile-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.profile-modal-close {
  border: none;
  background: transparent;
  font-size: 20px;
  color: var(--p-color);
}

.profile-modal-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.profile-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  color: var(--p-color);
}

.profile-field input,
.profile-field textarea,
.profile-field select {
  border-radius: 12px;
  border: 1px solid rgba(107, 52, 196, 0.25);
  padding: 10px 12px;
  font-size: 14px;
}

.profile-field-note {
  font-size: 12px;
  color: #8b90a1;
}

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

.profile-edit-form.profile-modal-body {
  padding: 18px 20px 20px;
}

.profile-edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.profile-toggle-field {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

.profile-toggle-field input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

.profile-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

.profile-modal-actions .profile-action-btn {
  background: #7c3aed;
  color: #ffffff;
  border: 1px solid transparent;
}

.profile-modal-actions .profile-action-btn:hover {
  background: #6d28d9;
  box-shadow: 0 10px 20px rgba(124, 58, 237, 0.25);
}

.profile-report-submit {
  font-size: 13px;
  padding: 8px 14px;
}

body.dark-mode .profile-public-page,
body.dark-mode.profile-public-page {
  background: #0f172a;
  color: #e2e8f0;
}

body.dark-mode .profile-topbar-shell {
  background-image: linear-gradient(15deg, var(--brand-gradient-start) 0%, var(--brand-gradient-end) 100%);
  border-bottom: none;
}

body.dark-mode .profile-public-nav,
body.dark-mode .profile-hero-card,
body.dark-mode .profile-panel,
body.dark-mode .profile-empty-state,
body.dark-mode .profile-modal-card {
  background: #111827;
  color: #e2e8f0;
}

body.dark-mode .profile-hero-card {
  border-color: rgba(148, 163, 184, 0.2);
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.45);
}

body.dark-mode .profile-panel {
  border-radius: 32px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.45);
}

body.dark-mode .profile-lesson-card,
body.dark-mode .profile-list-item {
  background: #111827;
  border-color: rgba(148, 163, 184, 0.25);
}

body.dark-mode .profile-lesson-title {
  color: #f8fafc;
}

body.dark-mode .profile-lesson-meta {
  color: #cbd5f5;
}

body.dark-mode .profile-nav-logo,
body.dark-mode .profile-name,
body.dark-mode .profile-stat-value,
body.dark-mode .profile-panel-title,
body.dark-mode .profile-list-name {
  color: #f8fafc;
}

body.dark-mode .profile-location,
body.dark-mode .profile-school {
  color: #cbd5f5;
}

body.dark-mode .profile-bio {
  color: #e2e8f0;
}

body.dark-mode .profile-tab,
body.dark-mode .profile-stat-label,
body.dark-mode .profile-status {
  color: #cbd5f5;
}

body.dark-mode .profile-status {
  background: rgba(15, 23, 42, 0.95);
  color: #f8fafc;
  border-left-color: #a78bfa;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.45);
}

body.dark-mode .profile-field input,
body.dark-mode .profile-field textarea,
body.dark-mode .profile-field select {
  background: #0b1220;
  color: #e2e8f0;
  border-color: rgba(148, 163, 184, 0.35);
}

body.dark-mode .profile-field-note {
  color: #9ca3af;
}

body.dark-mode .profile-edit-form.profile-modal-body {
  background: #111827;
}

body.dark-mode .profile-field {
  color: #cbd5f5;
}

body.dark-mode .profile-modal-header h3 {
  color: #f8fafc;
}

body.dark-mode .profile-modal-close {
  color: #e2e8f0;
}

body.dark-mode .profile-field input::placeholder,
body.dark-mode .profile-field textarea::placeholder {
  color: #94a3b8;
}

body.dark-mode .profile-social a,
body.dark-mode .profile-icon-btn {
  background: rgba(15, 23, 42, 0.7);
  border-color: rgba(148, 163, 184, 0.3);
  color: #fda4af;
}

body.dark-mode .profile-icon-btn:hover {
  background: rgba(255, 108, 132, 0.2);
  box-shadow: 0 8px 16px rgba(255, 108, 132, 0.25);
}

body.dark-mode .profile-icon-btn:active {
  background: rgba(255, 108, 132, 0.28);
  box-shadow: none;
}

body.dark-mode .profile-topbar-link {
  color: #f8fafc;
}

body.dark-mode .profile-topbar-link:hover {
  color: #e2e8f0;
}

body.dark-mode .profile-topbar-icon {
  background: transparent;
  border-color: transparent;
  color: #f8fafc;
  box-shadow: none;
}

body.dark-mode .profile-topbar-icon:hover {
  color: rgba(255, 255, 255, 0.85);
}

@media (max-width: 900px) {
  .profile-hero {
    padding: 24px 0 32px;
  }

  .profile-hero-card {
    padding: 86px 28px 28px;
  }

  .profile-hero-top {
    position: static;
    margin-bottom: 12px;
    justify-content: center;
    flex-wrap: wrap;
  }

  .profile-icon-btn {
    margin-left: 0;
  }

  .profile-header-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .profile-lessons-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .profile-topbar {
    flex-direction: row;
    align-items: center;
    gap: 10px;
  }

  .profile-topbar-left {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .profile-topbar-left::-webkit-scrollbar {
    display: none;
  }

  .profile-topbar-right {
    flex-shrink: 0;
  }

  .profile-topbar-link {
    font-size: 13px;
  }

  .profile-topbar-icon {
    font-size: 18px;
    padding: 4px;
  }

  .profile-edit-grid {
    grid-template-columns: 1fr;
  }
  .profile-public-nav {
    flex-direction: column;
    gap: 10px;
  }

  .profile-panel-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .profile-hero {
    padding: 24px 0 28px;
  }

  .profile-hero-card {
    padding: 80px 20px 24px;
  }

  .profile-avatar-wrap {
    width: 104px;
    height: 104px;
    top: -52px;
  }

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

  .profile-lessons-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
