/**
 * Profile page — role-based sections in order, premium aesthetics.
 * Load after dashboard.css and responsive-content.css.
 */

/* ----- Header: striking gradient and typography ----- */
.app-main-inner .profile-header {
  padding: 32px 20px 28px;
  background: var(--app-surface);
  border-bottom: none;
  position: relative;
  overflow: hidden;
}
.app-main-inner .profile-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--app-gradient-mesh);
  opacity: 0.85;
  pointer-events: none;
}
.app-main-inner .profile-header::after {
  background: linear-gradient(180deg, transparent 0%, var(--app-bg) 85%);
  opacity: 0.95;
}
.app-main-inner .profile-avatar {
  width: 96px;
  height: 96px;
  font-size: 2.25rem;
  margin-bottom: 16px;
  box-shadow: var(--app-shadow-lg), 0 0 0 4px rgba(255, 255, 255, 0.6), 0 0 32px -8px var(--app-primary-glow);
  transition: transform var(--app-duration) var(--app-ease);
  position: relative;
  overflow: hidden;
}
.app-main-inner .profile-avatar-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}
.app-main-inner .profile-avatar #profile-avatar-letter {
  position: relative;
  z-index: 1;
}
.app-main-inner .profile-avatar:hover {
  transform: scale(1.03);
}
.app-dark .app-main-inner .profile-avatar {
  box-shadow: var(--app-shadow-lg), 0 0 0 4px rgba(24, 24, 27, 0.9), 0 0 32px -8px var(--app-primary-glow);
}
.app-main-inner .profile-name {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  margin-bottom: 6px;
  background: linear-gradient(135deg, var(--app-text) 0%, var(--app-text-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.app-dark .app-main-inner .profile-name {
  background: linear-gradient(135deg, #f8fafc 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  background-clip: text;
}
.app-main-inner .profile-bio {
  font-size: 0.9375rem;
  color: var(--app-text-secondary);
  margin-bottom: 12px;
  max-width: 280px;
  margin-left: auto;
  margin-right: auto;
}
.app-main-inner .streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--app-radius-full);
  font-size: 0.8125rem;
  font-weight: 700;
  background: var(--app-warm-soft);
  color: #b45309;
  border: 1px solid rgba(245, 158, 11, 0.3);
  box-shadow: 0 2px 8px -2px rgba(245, 158, 11, 0.25);
}
.app-dark .app-main-inner .streak-badge {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.35);
}

/* ----- Value section: progress at a glance (student) ----- */
.app-main-inner .profile-value-section .profile-value-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.app-main-inner .profile-value-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: var(--app-bg);
  border: 1px solid var(--app-border-soft);
  border-radius: var(--app-radius-lg);
  text-decoration: none;
  color: inherit;
  transition: background var(--app-duration) var(--app-ease), border-color var(--app-duration) var(--app-ease),
    box-shadow var(--app-duration) var(--app-ease);
}
.app-main-inner .profile-value-item.profile-value-cta {
  background: linear-gradient(135deg, var(--app-primary-soft) 0%, rgba(139, 92, 246, 0.08) 100%);
  border-color: rgba(99, 102, 241, 0.25);
}
.app-main-inner .profile-value-item.profile-value-cta:hover {
  box-shadow: var(--app-shadow-card);
  border-color: rgba(99, 102, 241, 0.35);
}
.app-main-inner .profile-value-icon {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: var(--app-radius-md);
  background: var(--app-surface);
  border: 1px solid var(--app-border-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}
.app-main-inner .profile-value-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.app-main-inner .profile-value-body strong {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--app-text);
}
.app-main-inner .profile-value-body span {
  font-size: 0.8125rem;
  color: var(--app-text-secondary);
  line-height: 1.4;
}
.app-main-inner .profile-value-arrow {
  font-size: 1.25rem;
  color: var(--app-primary);
}
.app-main-inner .profile-value-link {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--app-primary);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: var(--app-radius-md);
  background: var(--app-primary-soft);
  transition: background var(--app-duration-fast) var(--app-ease);
}
.app-main-inner .profile-value-link:hover {
  background: rgba(99, 102, 241, 0.2);
}

/* ----- Secret sauce: what makes us different (School, Parent) ----- */
.app-main-inner .profile-secret-sauce .profile-sauce-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.app-main-inner .profile-secret-sauce .profile-sauce-list li {
  position: relative;
  padding-left: 24px;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--app-text-secondary);
}
.app-main-inner .profile-secret-sauce .profile-sauce-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.5em;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--app-gradient-primary);
}
.app-main-inner .profile-secret-sauce .profile-sauce-list li strong {
  color: var(--app-text);
  font-weight: 700;
}

/* ----- Win the day: prove-it accountability (student) ----- */
.app-main-inner .profile-win-the-day-desc {
  margin-bottom: 18px;
}
.app-main-inner .profile-win-the-day-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.app-main-inner .profile-win-the-day-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  background: var(--app-bg);
  border: 1px solid var(--app-border-soft);
  border-radius: var(--app-radius-lg);
  transition: border-color var(--app-duration) var(--app-ease), box-shadow var(--app-duration) var(--app-ease);
}
.app-main-inner .profile-win-the-day-item:hover {
  border-color: rgba(99, 102, 241, 0.2);
  box-shadow: 0 4px 12px -4px rgba(99, 102, 241, 0.15);
}
.app-main-inner .profile-win-the-day-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}
.app-main-inner .profile-win-the-day-body {
  flex: 1;
  min-width: 0;
}
.app-main-inner .profile-win-the-day-body strong {
  display: block;
  font-size: 0.9375rem;
  color: var(--app-text);
  margin-bottom: 2px;
}
.app-main-inner .profile-win-the-day-meta {
  font-size: 0.8125rem;
  color: var(--app-text-secondary);
}
.app-main-inner .profile-win-the-day-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--app-radius-full);
  flex-shrink: 0;
}
.app-main-inner .profile-win-the-day-badge-pending {
  background: var(--app-bg);
  color: var(--app-text-secondary);
  border: 1px solid var(--app-border-soft);
}
.app-main-inner .profile-win-the-day-badge-proved {
  background: rgba(34, 197, 94, 0.15);
  color: #15803d;
  border: 1px solid rgba(34, 197, 94, 0.35);
}
.app-main-inner .profile-win-the-day-badge-verified {
  background: rgba(99, 102, 241, 0.15);
  color: var(--app-primary);
  border: 1px solid rgba(99, 102, 241, 0.35);
}
.app-main-inner .profile-win-the-day-prove {
  flex-shrink: 0;
  padding: 8px 14px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--app-primary);
  background: var(--app-primary-soft);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: var(--app-radius-md);
  cursor: pointer;
  transition: background var(--app-duration) var(--app-ease), transform var(--app-duration) var(--app-ease);
}
.app-main-inner .profile-win-the-day-prove:hover {
  background: rgba(99, 102, 241, 0.2);
  transform: translateY(-1px);
}
.app-main-inner .profile-win-the-day-item[data-status="proved"] .profile-win-the-day-prove,
.app-main-inner .profile-win-the-day-item[data-status="verified"] .profile-win-the-day-prove {
  display: none;
}
.app-main-inner .profile-win-the-day-item-custom[data-status="proved"] .profile-win-the-day-prove,
.app-main-inner .profile-win-the-day-item-custom[data-status="verified"] .profile-win-the-day-prove {
  display: inline-block;
}
.app-main-inner .profile-win-the-day-item-custom .profile-win-the-day-prove {
  font-size: 0.8125rem;
}
.app-dark .profile-win-the-day-badge-proved {
  background: rgba(34, 197, 94, 0.2);
  color: #4ade80;
  border-color: rgba(74, 222, 128, 0.35);
}

/* Win the day — prove-it overlay */
.profile-win-the-day-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.profile-win-the-day-sheet {
  background: var(--app-surface);
  border-radius: var(--app-radius-xl);
  padding: 24px;
  max-width: 420px;
  width: 100%;
  box-shadow: var(--app-shadow-lg);
  border: 1px solid var(--app-border-soft);
}
.profile-win-the-day-sheet-title {
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--app-text);
}
.profile-win-the-day-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--app-text);
  margin-bottom: 8px;
}
.profile-win-the-day-textarea {
  width: 100%;
  padding: 12px 14px;
  font-size: 0.9375rem;
  line-height: 1.5;
  border: 1px solid var(--app-border-soft);
  border-radius: var(--app-radius-md);
  background: var(--app-bg);
  color: var(--app-text);
  resize: vertical;
  margin-bottom: 18px;
  box-sizing: border-box;
}
.profile-win-the-day-textarea:focus {
  outline: none;
  border-color: var(--app-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}
.profile-win-the-day-sheet-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* ----- Section cards: each role-based block in clear order ----- */
.app-main-inner .page-content {
  padding: var(--app-space-lg) 20px 20px;
  padding-top: 0;
}
.app-main-inner .page-content .topic-group,
.app-main-inner .profile-guest-card.topic-group,
.app-main-inner .profile-account-user-card.topic-group {
  margin-top: var(--app-space-lg);
  margin-bottom: 0;
  padding: var(--app-space-lg) 20px;
  background: var(--app-surface);
  border-radius: var(--app-radius-xl);
  border: 1px solid var(--app-border-soft);
  box-shadow: var(--app-shadow-md);
  position: relative;
  overflow: hidden;
  transition: box-shadow var(--app-duration) var(--app-ease), border-color var(--app-duration) var(--app-ease);
}
.app-main-inner .page-content .topic-group::before,
.app-main-inner .profile-guest-card.topic-group::before,
.app-main-inner .profile-account-user-card.topic-group::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--app-gradient-primary);
  opacity: 0.9;
}
.app-main-inner .page-content .topic-group:hover,
.app-main-inner .profile-guest-card.topic-group:hover,
.app-main-inner .profile-account-user-card.topic-group:hover {
  box-shadow: var(--app-shadow-card);
  border-color: rgba(99, 102, 241, 0.2);
}
.app-main-inner .page-content .topic-group-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--app-primary);
  text-transform: none;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
  padding-right: 12px;
}
.app-main-inner .page-content .page-subtitle {
  font-size: 0.875rem;
  color: var(--app-text-secondary);
  line-height: 1.5;
  margin-bottom: 16px;
}

/* ----- Stats: premium metric cards ----- */
.app-main-inner .page-content .profile-stats {
  margin-top: var(--app-space-lg);
  margin-bottom: 0;
  gap: 16px;
  padding: 0;
}
.app-main-inner .page-content .profile-stat {
  padding: 22px 16px;
  background: var(--app-surface);
  border-radius: var(--app-radius-lg);
  border: 1px solid var(--app-border-soft);
  box-shadow: var(--app-shadow-md);
  transition: transform var(--app-duration) var(--app-ease), box-shadow var(--app-duration) var(--app-ease),
    border-color var(--app-duration) var(--app-ease);
}
.app-main-inner .page-content .profile-stat:hover {
  transform: translateY(-2px);
  box-shadow: var(--app-shadow-card);
  border-color: rgba(99, 102, 241, 0.2);
}
.app-main-inner .page-content .profile-stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: var(--app-gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.app-main-inner .page-content .profile-stat-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--app-text-secondary);
  margin-top: 6px;
}

/* ----- Wallet & earnings (student, mentor, parent) ----- */
.app-main-inner .profile-wallet-section {
  margin-top: 24px;
}
.app-main-inner .profile-wallet-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  margin-bottom: 16px;
}
.app-main-inner .profile-wallet-stat {
  flex: 1;
  min-width: 100px;
  padding: 16px 18px;
  background: var(--app-surface);
  border-radius: var(--app-radius-lg);
  border: 1px solid var(--app-border-soft);
  box-shadow: var(--app-shadow-md);
}
.app-main-inner .profile-wallet-value {
  display: block;
  font-size: 1.375rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--app-text);
}
.app-main-inner .profile-wallet-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--app-text-secondary);
  margin-top: 4px;
  display: block;
}
.app-main-inner .profile-wallet-earning-details {
  margin-bottom: 16px;
  padding: 14px 18px;
  background: var(--app-surface);
  border: 1px solid var(--app-border-soft);
  border-radius: var(--app-radius-md);
}
.app-main-inner .profile-wallet-earning-details strong {
  font-size: 0.9375rem;
  color: var(--app-text);
}
.app-main-inner .profile-wallet-earning-details p {
  font-size: 0.875rem;
  color: var(--app-text-secondary);
  line-height: 1.5;
  margin: 8px 0 0;
}
.app-main-inner .profile-wallet-actions .flow-card {
  text-decoration: none;
  color: inherit;
}
.app-main-inner .profile-wallet-actions .flow-card:hover {
  border-color: var(--app-primary);
  background: var(--app-primary-soft);
}

.app-main-inner .profile-recent-flags-wrap {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--app-border-soft);
}
.app-main-inner .profile-recent-flags-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--app-text);
  margin-bottom: 4px;
}
.app-main-inner .profile-recent-flags {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
}
.app-main-inner .profile-recent-flag-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  font-size: 0.875rem;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: var(--app-surface);
  border: 1px solid var(--app-border-soft);
  border-radius: var(--app-radius-md);
}
.app-main-inner .profile-recent-flag-mock {
  font-weight: 600;
  color: var(--app-text);
}
.app-main-inner .profile-recent-flag-q {
  font-weight: 600;
  color: var(--app-primary);
}
.app-main-inner .profile-recent-flag-status {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--app-radius-full);
  margin-left: auto;
}
.app-main-inner .profile-flag-status-flagged { background: var(--app-primary-soft); color: var(--app-primary); }
.app-main-inner .profile-flag-status-pending { background: var(--app-warm-soft); color: var(--app-warm); }
.app-main-inner .profile-flag-status-approved,
.app-main-inner .profile-flag-status-added_to_wallet { background: var(--app-success-soft); color: var(--app-success); }
.app-main-inner .profile-flag-status-pending_payout { background: var(--app-primary-soft); color: var(--app-primary); }
.app-main-inner .profile-recent-flags-link {
  display: inline-block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--app-primary);
  text-decoration: none;
}
.app-main-inner .profile-recent-flags-link:hover {
  text-decoration: underline;
}

/* ----- Flow cards inside profile sections ----- */
.app-main-inner .page-content .flow-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  margin-bottom: 12px;
  background: var(--app-bg);
  border: 1px solid var(--app-border-soft);
  border-radius: var(--app-radius-lg);
  text-decoration: none;
  color: inherit;
  transition: background var(--app-duration) var(--app-ease), border-color var(--app-duration) var(--app-ease),
    box-shadow var(--app-duration) var(--app-ease), transform var(--app-duration) var(--app-ease);
}
.app-main-inner .page-content .flow-card:last-child {
  margin-bottom: 0;
}
.app-main-inner .page-content .flow-card:hover {
  background: var(--app-primary-soft);
  border-color: rgba(99, 102, 241, 0.25);
  box-shadow: var(--app-shadow-card);
  transform: translateY(-2px);
}
.app-main-inner .page-content .flow-card-icon {
  width: 52px;
  height: 52px;
  min-width: 52px;
  min-height: 52px;
  border-radius: var(--app-radius-md);
  background: var(--app-surface);
  border: 1px solid var(--app-border-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--app-duration) var(--app-ease), background var(--app-duration) var(--app-ease);
}
.app-main-inner .page-content .flow-card:hover .flow-card-icon {
  background: rgba(99, 102, 241, 0.12);
  transform: scale(1.05);
}
.app-main-inner .page-content .flow-card-icon img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}
.app-main-inner .page-content .flow-card-text strong {
  display: block;
  font-size: 1rem;
  font-weight: 700;
  color: var(--app-text);
  margin-bottom: 2px;
}
.app-main-inner .page-content .flow-card-text span {
  font-size: 0.8125rem;
  color: var(--app-text-secondary);
}
.app-main-inner .page-content .flow-card-arrow {
  font-size: 1.25rem;
  color: var(--app-text-muted);
  transition: color var(--app-duration-fast) var(--app-ease), transform var(--app-duration-fast) var(--app-ease);
}
.app-main-inner .page-content .flow-card:hover .flow-card-arrow {
  color: var(--app-primary);
  transform: translateX(4px);
}

/* ----- Exam section: collapsible categories ----- */
.app-main-inner .profile-exams-section .profile-exam-collapse {
  border-radius: var(--app-radius-md);
  margin-bottom: 12px;
  box-shadow: var(--app-shadow);
}
.app-main-inner .profile-exams-section .profile-exam-collapse[open] {
  box-shadow: var(--app-shadow-card);
}
.app-main-inner .profile-exams-section .profile-exam-category-title {
  padding: 16px 18px;
  font-size: 0.875rem;
  border-radius: var(--app-radius-md);
}
.app-main-inner .profile-exams-section .profile-exam-chips {
  padding: 14px 18px 18px;
  gap: 10px;
}
.app-main-inner .profile-course-item {
  padding: 10px 16px;
  border-radius: var(--app-radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  transition: background var(--app-duration-fast) var(--app-ease), color var(--app-duration-fast) var(--app-ease);
}

/* ----- Guest card & account card ----- */
.app-main-inner .profile-guest-card.topic-group {
  margin-top: var(--app-space-lg);
  padding: var(--app-space-lg) 20px;
  border: 1px solid rgba(99, 102, 241, 0.25);
  background: linear-gradient(165deg, var(--app-primary-soft) 0%, rgba(139, 92, 246, 0.08) 100%);
}
.app-main-inner .profile-guest-card .topic-group-title {
  color: var(--app-primary);
}
.app-main-inner .profile-account-user-card.topic-group {
  margin-top: var(--app-space-lg);
}

/* ----- Bottom actions ----- */
.app-main-inner .profile-actions {
  padding: 24px 20px 32px;
  gap: 14px;
}
.app-main-inner .profile-action-btn {
  padding: 18px 24px;
  border-radius: var(--app-radius-lg);
  font-size: 1rem;
  font-weight: 600;
  box-shadow: var(--app-shadow-md);
}
.app-main-inner .profile-action-btn:hover {
  box-shadow: var(--app-shadow-card-hover);
  transform: translateY(-2px);
}

/* ----- Dark mode ----- */
.app-dark .app-main-inner .page-content .topic-group,
.app-dark .app-main-inner .profile-guest-card.topic-group,
.app-dark .app-main-inner .profile-account-user-card.topic-group {
  background: var(--app-surface);
  border-color: var(--app-border-soft);
}
.app-dark .app-main-inner .page-content .flow-card {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--app-border-soft);
}
.app-dark .app-main-inner .page-content .flow-card:hover {
  background: var(--app-primary-soft);
}

/* Settings: role switcher */
.settings-item-role-switcher {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.settings-role-select {
  margin-left: auto;
  padding: 6px 10px;
  border-radius: var(--app-radius, 8px);
  border: 1px solid var(--app-border-soft, #e2e8f0);
  font-size: 0.9375rem;
  background: var(--app-surface, #fff);
  color: var(--app-text, #0f172a);
}
