/* ═══ Profile Page — Skora Duolingo-Style (v2: compact header, purple CTAs) ═══ */

.profile-page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px 64px;
  background: #fff;
}

/* ─── Compact Header (replaces banner) ─── */
.profile-header-compact {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0;
}

.profile-avatar-medium {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
  border: 3px solid #E5E5E5;
}

.profile-header-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.profile-header-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.profile-fullname {
  font-size: 1.5rem;
  font-weight: 800;
  color: #3C3C3C;
  margin: 0;
  line-height: 1.2;
}

.profile-username {
  font-size: 0.92rem;
  color: #AFAFAF;
  margin: 0;
  font-weight: 500;
}

.profile-join-date {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.82rem;
  color: #AFAFAF;
  margin: 4px 0 8px;
}
.profile-join-date .material-symbols-outlined { font-size: 16px; }

.profile-plan-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 999px;
  width: fit-content;
}
.profile-plan-badge--premium {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: #fff;
}
.profile-plan-badge--free {
  background: #F0F0F0;
  color: #AFAFAF;
  border: 1px solid #E5E5E5;
}

/* ─── Two-Column Layout ─── */
.profile-page .profile-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 24px;
  align-items: flex-start;
  padding-top: 28px;
}

@media (max-width: 860px) {
  .profile-page .profile-layout {
    grid-template-columns: 1fr;
    padding-top: 20px;
  }
}

.profile-page .profile-main {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
}

.profile-page .profile-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  align-self: flex-start;
}

/* ─── Card ─── */
.profile-card {
  background: #fff;
  border: 2px solid #E5E5E5;
  border-radius: 16px;
  padding: 22px;
  opacity: 0;
  animation: profileCardIn 0.35s cubic-bezier(0.23,1,0.32,1) both;
}
.profile-card:nth-child(1) { animation-delay: 80ms; }
.profile-card:nth-child(2) { animation-delay: 140ms; }
.profile-card:nth-child(3) { animation-delay: 200ms; }

/* Compact variant for sidebar */
.profile-card--compact {
  padding: 16px 18px;
}
.profile-card--compact .profile-card-title {
  font-size: 1rem;
  margin-bottom: 10px;
}

@keyframes profileCardIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .profile-card { animation: none; opacity: 1; }
}

.profile-card-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #3C3C3C;
  margin: 0 0 16px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.profile-card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ─── Stats Grid 2×2 ─── */
.profile-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.profile-stat-card {
  border: 2px solid #E5E5E5;
  border-radius: 14px;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  opacity: 0;
  animation: profileCardIn 0.3s cubic-bezier(0.23,1,0.32,1) both;
  animation-delay: calc(var(--stagger, 0) * 60ms + 150ms);
}

.profile-stat-icon { font-size: 24px; margin-bottom: 4px; }
.profile-stat-icon--streak { color: #FF9600; }
.profile-stat-icon--quizzes { color: #CE82FF; }
.profile-stat-icon--modules { color: #1CB0F6; }
.profile-stat-icon--days { color: #FF4B4B; }

.profile-stat-number {
  font-size: 1.5rem;
  font-weight: 800;
  color: #3C3C3C;
  line-height: 1;
}

.profile-stat-label {
  font-size: 0.78rem;
  color: #AFAFAF;
  font-weight: 600;
}

/* ─── Subject Progress ─── */
.profile-subjects-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #AFAFAF;
  font-size: 0.85rem;
  padding: 8px 0;
}

.spin-icon {
  animation: spin 1s linear infinite;
  font-size: 20px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.profile-subject-row {
  padding: 14px 0;
  border-bottom: 1px solid #F0F0F0;
  opacity: 0;
  animation: profileCardIn 0.3s cubic-bezier(0.23,1,0.32,1) both;
}
.profile-subject-row:last-child { border-bottom: none; }

.profile-subject-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.profile-subject-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.profile-subject-name {
  flex: 1;
  font-weight: 700;
  font-size: 0.9rem;
  color: #3C3C3C;
}

.profile-subject-pct {
  font-weight: 800;
  font-size: 0.85rem;
}

.profile-subject-bar-track {
  height: 10px;
  background: #E5E5E5;
  border-radius: 999px;
  overflow: hidden;
}

.profile-subject-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.8s cubic-bezier(0.23,1,0.32,1);
}

.profile-subject-meta {
  font-size: 0.75rem;
  color: #AFAFAF;
  margin-top: 6px;
}

/* ─── Achievements ─── */
.profile-card-header-row .profile-card-title {
  margin-bottom: 0;
}

.profile-see-all {
  color: #7c3aed;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-decoration: none;
}

.profile-see-all:hover {
  text-decoration: underline;
}

.profile-achievements,
.achievements-list {
  display: flex;
  flex-direction: column;
  margin-top: 12px;
}

.achievement-row {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 18px 0;
  border-bottom: 1px solid #F0F0F0;
  opacity: 0;
  animation: profileCardIn 0.3s cubic-bezier(0.23,1,0.32,1) both;
  animation-delay: var(--achievement-delay, 0ms);
}

.achievement-row:last-child {
  border-bottom: none;
}

.achievement-row-icon {
  width: 76px;
  height: 76px;
  border-radius: 14px;
  background: var(--achievement-tile);
  color: var(--achievement-icon);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 76px;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.12);
}

.achievement-row-symbol {
  font-size: 34px;
  font-variation-settings: 'FILL' 1, 'wght' 700;
}

.achievement-row-level {
  position: absolute;
  left: 8px;
  bottom: 8px;
  padding: 2px 4px;
  border-radius: 4px;
  color: #fff;
  font-size: 0.48rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  line-height: 1;
  background: rgba(0, 0, 0, 0.18);
}

.achievement-row-body {
  flex: 1;
  min-width: 0;
}

.achievement-row-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.achievement-row-name {
  margin: 0;
  color: #3C3C3C;
  font-size: 1rem;
  font-weight: 800;
}

.achievement-row-progress {
  flex-shrink: 0;
  color: #AFAFAF;
  font-size: 0.82rem;
  font-weight: 800;
}

.achievement-row-bar {
  height: 10px;
  background: #E5E5E5;
  border-radius: 999px;
  overflow: hidden;
}

.achievement-row-bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--achievement-gold, #ffc800);
  transition: width 0.8s cubic-bezier(0.23,1,0.32,1);
}

.achievement-row-description {
  margin: 10px 0 0;
  color: #777777;
  font-size: 0.84rem;
  font-weight: 500;
  line-height: 1.35;
}

.achievement-row--locked .achievement-row-icon {
  filter: grayscale(1);
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.06);
}

.achievement-row--locked .achievement-row-level {
  background: rgba(175, 175, 175, 0.65);
}

.achievement-row--locked .achievement-row-bar-fill {
  width: 0 !important;
}

.achievements-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 28px 24px 64px;
}

.achievements-page-title {
  margin: 0 0 16px;
  color: #3C3C3C;
  font-size: 1.5rem;
  font-weight: 800;
}

.achievements-list-card {
  background: #fff;
  border: 2px solid #E5E5E5;
  border-radius: 16px;
  overflow: hidden;
}

.achievements-list {
  margin-top: 0;
}

.achievements-list .achievement-row {
  padding: 20px;
}

/* ─── Plan Status (compact) ─── */
.plan-status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.plan-status-label { font-weight: 700; font-size: 0.88rem; color: #3C3C3C; }
.plan-status-value { font-size: 0.8rem; font-weight: 600; }
.plan-status-value--active { color: #7c3aed; }
.plan-status-value--urgent { color: #FF4B4B; }
.plan-status-value--free { color: #AFAFAF; }

.plan-days-left { font-size: 0.75rem; color: #AFAFAF; margin-top: 2px; }

.plan-bar-track {
  height: 8px;
  background: #E5E5E5;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 10px;
}
.plan-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #7c3aed, #a855f7);
  transition: width 600ms cubic-bezier(0.23,1,0.32,1);
}
.plan-bar-fill--urgent { background: linear-gradient(90deg, #FF4B4B, #FF9600); }
.plan-bar-fill--full { background: linear-gradient(90deg, #7c3aed, #a855f7); }

.plan-upgrade-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 16px;
  border-radius: 12px;
  background: #7c3aed;
  color: #fff;
  font-weight: 800;
  font-size: 0.82rem;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: none;
  border-bottom: 3px solid #6025c0;
  transition: transform 150ms ease-out, filter 150ms ease-out;
}
.plan-upgrade-cta:hover { filter: brightness(1.1); }
.plan-upgrade-cta:active { transform: scale(0.97); border-bottom-width: 2px; margin-top: 13px; }
.plan-upgrade-cta .material-symbols-outlined { font-size: 16px; }

/* ─── Referrals (compact) ─── */
.profile-referral-stat {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
}

.profile-referral-count {
  font-size: 1.75rem;
  font-weight: 800;
  color: #3C3C3C;
  line-height: 1;
}

.profile-referral-label {
  font-size: 0.85rem;
  color: #AFAFAF;
  font-weight: 600;
}

.profile-referral-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 16px;
  border-radius: 12px;
  background: #7c3aed;
  color: #fff;
  font-weight: 800;
  font-size: 0.82rem;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 3px solid #6025c0;
  transition: transform 150ms ease-out, filter 150ms ease-out;
}
.profile-referral-btn:hover { filter: brightness(1.1); }
.profile-referral-btn:active { transform: scale(0.97); border-bottom-width: 2px; }
.profile-referral-btn .material-symbols-outlined { font-size: 16px; }

/* ─── Grouped List Card (Duolingo-style) ─── */
.profile-card--list {
  padding: 0;
  overflow: hidden;
}

.profile-list-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  cursor: default;
  transition: background 150ms ease-out;
  border-bottom: 1px solid #F0F0F0;
}
.profile-list-item:last-child { border-bottom: none; }
.profile-list-item:hover { background: #FAFAFA; }

.profile-list-icon {
  font-size: 24px;
  color: #D1D5DB;
  flex-shrink: 0;
}

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

.profile-list-title {
  font-weight: 700;
  font-size: 0.92rem;
  color: #3C3C3C;
}

.profile-list-sub {
  font-size: 0.72rem;
  font-weight: 600;
  color: #AFAFAF;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.profile-list-chevron {
  font-size: 20px;
  color: #D1D5DB;
  flex-shrink: 0;
}

/* ─── Empty State ─── */
.profile-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 24px 0;
  color: #AFAFAF;
  text-align: center;
}
.profile-empty-state .material-symbols-outlined { font-size: 32px; opacity: 0.4; }
.profile-empty-state p { margin: 0; font-size: 0.85rem; }

/* ─── Dark mode ─── */
[data-theme="dark"] .profile-page { background: var(--bg-primary); }
[data-theme="dark"] .profile-fullname,
[data-theme="dark"] .profile-stat-number,
[data-theme="dark"] .profile-card-title,
[data-theme="dark"] .profile-subject-name,
[data-theme="dark"] .achievement-row-name,
[data-theme="dark"] .achievements-page-title,
[data-theme="dark"] .plan-status-label,
[data-theme="dark"] .profile-list-title,
[data-theme="dark"] .profile-referral-count { color: var(--text-primary); }

[data-theme="dark"] .profile-username,
[data-theme="dark"] .profile-join-date,
[data-theme="dark"] .profile-stat-label,
[data-theme="dark"] .profile-subject-meta,
[data-theme="dark"] .achievement-row-description,
[data-theme="dark"] .achievement-row-progress,
[data-theme="dark"] .plan-days-left,
[data-theme="dark"] .plan-status-value--free,
[data-theme="dark"] .profile-referral-label,
[data-theme="dark"] .profile-list-sub { color: var(--text-secondary); }

[data-theme="dark"] .profile-card,
[data-theme="dark"] .profile-stat-card,
[data-theme="dark"] .achievements-list-card { background: var(--bg-secondary); border-color: var(--border); }

[data-theme="dark"] .profile-avatar-medium { border-color: var(--border); }

[data-theme="dark"] .profile-plan-badge--free {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border-color: var(--border);
}

[data-theme="dark"] .profile-subject-bar-track,
[data-theme="dark"] .achievement-row-bar,
[data-theme="dark"] .plan-bar-track { background: var(--border); }

[data-theme="dark"] .profile-subject-row,
[data-theme="dark"] .achievement-row,
[data-theme="dark"] .profile-list-item { border-color: var(--border); }

[data-theme="dark"] .profile-list-item:hover { background: var(--bg-primary); }
[data-theme="dark"] .profile-list-icon,
[data-theme="dark"] .profile-list-chevron { color: var(--text-secondary); }

/* ─── Sidebar Legal Footer ─── */
.profile-sidebar-footer {
  text-align: center;
  margin-top: 24px;
  padding: 0 8px;
  font-size: 0.72rem;
  color: #9CA3AF;
  line-height: 1.6;
}

.profile-sidebar-footer a {
  color: #9CA3AF;
  text-decoration: none;
  transition: color 150ms ease;
}

.profile-sidebar-footer a:hover {
  color: #6B7280;
  text-decoration: underline;
}

.profile-sidebar-footer span {
  margin: 0 4px;
}

[data-theme="dark"] .profile-sidebar-footer,
[data-theme="dark"] .profile-sidebar-footer a {
  color: var(--text-secondary);
}

[data-theme="dark"] .profile-sidebar-footer a:hover {
  color: var(--text-primary);
}

/* ─── Mobile ─── */
@media (max-width: 860px) {
  .profile-page { padding: 0 12px 48px; }
  .profile-header-compact { gap: 14px; }
  .profile-avatar-medium { width: 72px; height: 72px; font-size: 1.6rem; }
  .profile-fullname { font-size: 1.25rem; }
  .profile-card { padding: 18px; }
  .profile-card--compact { padding: 14px 16px; }
  .achievement-row { gap: 14px; padding: 16px 0; }
  .achievement-row-icon { width: 64px; height: 64px; flex-basis: 64px; }
  .achievement-row-symbol { font-size: 28px; }
  .achievement-row-name { font-size: 0.94rem; }
  .achievements-page { padding: 20px 12px 48px; }
  .achievements-list .achievement-row { padding: 16px; }
}
