/* ============================================
   Public Profile Page — AnkiFlow
   Prefix: profile-
   ============================================ */

.profile-page {
  min-height: 100vh;
  background: var(--bg-primary, #f8f9fb);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

[data-theme="dark"] .profile-page {
  background: #0f0f14;
  color: #e5e7eb;
}

/* Top Bar */
.profile-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--card-bg, #fff);
  border-bottom: 1px solid var(--border, #e5e7eb);
  position: sticky;
  top: 0;
  z-index: 50;
}
[data-theme="dark"] .profile-topbar {
  background: #16161e;
  border-color: #2a2a3a;
}
.profile-back-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: #6366F1;
  font-weight: 600;
  font-size: 14px;
}
.profile-back-btn ion-icon { font-size: 18px; }
.profile-topbar-brand {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary, #1e293b);
}
[data-theme="dark"] .profile-topbar-brand { color: #e5e7eb; }

/* Main Content */
.profile-main {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 20px 40px;
}

/* Hero Section */
.profile-hero {
  position: relative;
  border-radius: 0 0 20px 20px;
  overflow: hidden;
  margin-bottom: 24px;
}
.profile-hero-bg {
  height: 120px;
  width: 100%;
}
.profile-hero-content {
  padding: 0 24px 24px;
  margin-top: -50px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}
.profile-avatar-container {
  position: relative;
  flex-shrink: 0;
}
.profile-avatar-xl {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366F1, #8B5CF6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  font-weight: 700;
  color: #fff;
  overflow: hidden;
  border: 4px solid var(--bg-primary, #f8f9fb);
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}
[data-theme="dark"] .profile-avatar-xl {
  border-color: #0f0f14;
}
.profile-avatar-xl img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.profile-level-badge {
  position: absolute;
  bottom: -4px;
  right: -4px;
  background: linear-gradient(135deg, #F59E0B, #EF4444);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 12px;
  border: 2px solid var(--bg-primary, #f8f9fb);
}
[data-theme="dark"] .profile-level-badge {
  border-color: #0f0f14;
}
.profile-hero-info {
  width: 100%;
  min-width: 0;
  padding-bottom: 4px;
}
.profile-hero-info h1 {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary, #1e293b);
  margin: 0 0 2px;
  line-height: 1.2;
}
[data-theme="dark"] .profile-hero-info h1 { color: #f1f5f9; }
.profile-username {
  font-size: 14px;
  color: #6366F1;
  font-weight: 500;
  display: block;
  margin-bottom: 6px;
}
.profile-role-tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.profile-bio {
  font-size: 14px;
  color: #64748b;
  margin: 8px 0 0;
  line-height: 1.5;
}
[data-theme="dark"] .profile-bio { color: #9ca3af; }

/* Action Buttons */
.profile-action-buttons {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  margin-top: 4px;
}
.profile-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
  font-family: inherit;
}
.profile-btn ion-icon { font-size: 16px; }
.profile-btn-connect {
  background: #6366F1;
  color: #fff;
}
.profile-btn-connect:hover { background: #4F46E5; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(99,102,241,0.3); }
.profile-btn-connect:disabled { opacity: 0.6; cursor: not-allowed; transform: none; box-shadow: none; }
.profile-btn-connected {
  background: #10B98120;
  color: #10B981;
  border: 1px solid #10B98140;
}
.profile-btn-connected:hover { background: #EF444420; color: #EF4444; border-color: #EF444440; }
.profile-btn-pending {
  background: #F59E0B20;
  color: #F59E0B;
  border: 1px solid #F59E0B40;
  cursor: default;
}
.profile-btn-reject {
  background: #EF444415;
  color: #EF4444;
  border: 1px solid #EF444430;
}
.profile-btn-reject:hover { background: #EF444425; }
.profile-btn-reject:disabled { opacity: 0.6; cursor: not-allowed; }
.profile-btn-edit {
  background: var(--card-bg, #fff);
  color: var(--text-primary, #374151);
  border: 1px solid var(--border, #d1d5db);
}
[data-theme="dark"] .profile-btn-edit {
  background: #1e293b;
  color: #e5e7eb;
  border-color: #334155;
}
.profile-btn-edit:hover { border-color: #6366F1; color: #6366F1; }

/* Stats Row */
.profile-stats-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
.profile-stat {
  background: var(--card-bg, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 14px;
  padding: 16px 12px;
  text-align: center;
}
[data-theme="dark"] .profile-stat {
  background: #16161e;
  border-color: #2a2a3a;
}
.profile-stat-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary, #1e293b);
}
[data-theme="dark"] .profile-stat-value { color: #f1f5f9; }
.profile-stat-label {
  font-size: 11px;
  color: #64748b;
  font-weight: 500;
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Sections */
.profile-section {
  background: var(--card-bg, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 16px;
}
[data-theme="dark"] .profile-section {
  background: #16161e;
  border-color: #2a2a3a;
}
.profile-section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary, #1e293b);
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
[data-theme="dark"] .profile-section-title { color: #f1f5f9; }
.profile-section-title ion-icon { font-size: 20px; color: #6366F1; }

/* Achievements */
.profile-achievements {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.profile-ach-item {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #F59E0B08;
  border: 1px solid #F59E0B30;
  border-radius: 10px;
  padding: 8px 14px;
}
[data-theme="dark"] .profile-ach-item {
  background: #F59E0B10;
  border-color: #F59E0B20;
}
.profile-ach-icon {
  font-size: 20px;
}
.profile-ach-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary, #1e293b);
}
[data-theme="dark"] .profile-ach-name { color: #e5e7eb; }

/* Groups */
.profile-groups-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.profile-group-chip-lg {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-primary, #f9fafb);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s;
}
[data-theme="dark"] .profile-group-chip-lg {
  background: #1a1a26;
  border-color: #2a2a3a;
}
.profile-group-chip-lg:hover { border-color: #6366F1; }
.profile-group-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.profile-group-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary, #1e293b);
  flex: 1;
}
[data-theme="dark"] .profile-group-name { color: #e5e7eb; }
.profile-group-role {
  font-size: 11px;
  font-weight: 600;
  color: #6366F1;
  text-transform: capitalize;
  background: #6366F110;
  padding: 2px 8px;
  border-radius: 6px;
}

/* Activity */
.profile-activity {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.profile-activity-item {
  display: flex;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border, #f0f0f0);
  font-size: 13px;
}
[data-theme="dark"] .profile-activity-item {
  border-color: #2a2a3a;
}
.profile-activity-item:last-child { border-bottom: none; }
.profile-activity-type {
  flex: 1;
  color: var(--text-primary, #374151);
  text-transform: capitalize;
}
[data-theme="dark"] .profile-activity-type { color: #e5e7eb; }
.profile-activity-xp {
  font-weight: 700;
  color: #6366F1;
  margin-right: 16px;
}
.profile-activity-date {
  color: #94a3b8;
  font-size: 12px;
}

/* Footer Info */
.profile-footer-info {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 20px;
  color: #94a3b8;
  font-size: 13px;
}
.profile-footer-info ion-icon { font-size: 16px; }

/* Responsive */
@media (max-width: 640px) {
  .profile-hero-content {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
  }
  .profile-stats-row {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  .profile-stats-row .profile-stat:nth-child(4),
  .profile-stats-row .profile-stat:nth-child(5) {
    grid-column: span 1;
  }
  .profile-avatar-xl {
    width: 80px;
    height: 80px;
    font-size: 34px;
  }
  .profile-hero-info h1 { font-size: 20px; }
  .profile-topbar { padding: 12px 16px; }
  .profile-main { padding: 0 12px 40px; }
}
