/* ============================================================
   Beekix Profile — Hydro-Organic Design System
   ============================================================ */

/* ── Design Tokens ── */
.profile-page {
  --ho-primary: #1e3a5f;
  --ho-primary-light: #2b5ea7;
  --ho-accent: #00bfa6;
  --ho-accent-soft: rgba(0, 191, 166, 0.12);
  --ho-ocean-deep: #0a1628;
  --ho-ocean-mid: #1b2d4a;
  --ho-surface: #f0f7ff;
  --ho-surface-elevated: #ffffff;
  --ho-glass: rgba(255, 255, 255, 0.72);
  --ho-glass-border: rgba(255, 255, 255, 0.25);
  --ho-text-primary: #0f172a;
  --ho-text-secondary: #475569;
  --ho-text-muted: #94a3b8;
  --ho-shadow-sm: 0 2px 8px rgba(30, 58, 95, 0.06);
  --ho-shadow-md: 0 4px 20px rgba(30, 58, 95, 0.08);
  --ho-shadow-lg: 0 8px 40px rgba(30, 58, 95, 0.12);
  --ho-shadow-glow: 0 0 30px rgba(0, 191, 166, 0.15);
  --ho-radius-sm: 12px;
  --ho-radius-md: 18px;
  --ho-radius-lg: 24px;
  --ho-radius-full: 9999px;
  --ho-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  font-family: 'Be Vietnam Pro', sans-serif;
}

/* ── Page Container ── */
.profile-page {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

/* ── Hero Section ── */
.profile-hero {
  position: relative;
  background: linear-gradient(135deg, var(--ho-primary) 0%, var(--ho-primary-light) 50%, var(--ho-accent) 100%);
  border-radius: var(--ho-radius-lg);
  padding: 40px 36px 36px;
  color: #fff;
  overflow: hidden;
  box-shadow: var(--ho-shadow-lg);
}

.profile-hero::before {
  content: '';
  position: absolute;
  top: -60%;
  right: -20%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(0, 191, 166, 0.25) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.profile-hero::after {
  content: '';
  position: absolute;
  bottom: -40%;
  left: -10%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.08) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.profile-hero-content {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 28px;
}

.profile-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.9);
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.profile-hero-info h1 {
  margin: 0;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.profile-hero-username {
  margin: 4px 0 0;
  font-size: 14px;
  opacity: 0.75;
  font-weight: 500;
}

.profile-hero-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 12px;
  font-size: 13px;
  opacity: 0.85;
}

.profile-hero-meta span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.profile-hero-meta .material-symbols-outlined {
  font-size: 16px;
}

.profile-hero-role {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--ho-radius-full);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  backdrop-filter: blur(4px);
}

/* ── Stat Cards ── */
.profile-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.profile-stat-card {
  position: relative;
  background: var(--ho-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--ho-glass-border);
  border-radius: var(--ho-radius-md);
  padding: 24px 20px;
  box-shadow: var(--ho-shadow-sm);
  transition: transform var(--ho-transition), box-shadow var(--ho-transition);
  overflow: hidden;
}

.profile-stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--ho-shadow-md);
}

.profile-stat-card::after {
  content: '';
  position: absolute;
  top: -20px;
  right: -20px;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  opacity: 0.08;
  pointer-events: none;
}

.profile-stat-card--quizzes::after { background: #6366f1; }
.profile-stat-card--tests::after  { background: #f59e0b; }
.profile-stat-card--decks::after  { background: #10b981; }

.profile-stat-value {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 32px;
  font-weight: 800;
  color: var(--ho-text-primary);
  line-height: 1;
}

.profile-stat-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ho-text-secondary);
  margin-top: 6px;
}

.profile-stat-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--ho-radius-sm);
  margin-bottom: 14px;
  font-size: 22px;
}

.profile-stat-icon--quizzes { background: rgba(99, 102, 241, 0.1); color: #6366f1; }
.profile-stat-icon--tests   { background: rgba(245, 158, 11, 0.1);  color: #f59e0b; }
.profile-stat-icon--decks   { background: rgba(16, 185, 129, 0.1);  color: #10b981; }

/* ── Section Headers ── */
.profile-section {
  margin-top: 32px;
}

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

.profile-section-header h2 {
  margin: 0;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--ho-text-primary);
}

.profile-section-header .material-symbols-outlined {
  font-size: 22px;
  color: var(--ho-primary-light);
}

/* ── Glass Panel (generic container) ── */
.profile-glass-panel {
  background: var(--ho-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--ho-glass-border);
  border-radius: var(--ho-radius-lg);
  padding: 24px;
  box-shadow: var(--ho-shadow-sm);
}

/* ── Current Focus ── */
.profile-focus {
  display: flex;
  align-items: center;
  gap: 20px;
}

.profile-focus-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ho-accent), #059669);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 24px;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(0, 191, 166, 0.3);
}

.profile-focus-info { flex: 1; min-width: 0; }

.profile-focus-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--ho-text-primary);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-focus-type {
  font-size: 12px;
  color: var(--ho-text-muted);
  margin-top: 2px;
  text-transform: capitalize;
}

.profile-focus-progress {
  margin-top: 10px;
}

.profile-progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(0, 0, 0, 0.06);
  border-radius: var(--ho-radius-full);
  overflow: hidden;
}

.profile-progress-fill {
  height: 100%;
  border-radius: var(--ho-radius-full);
  background: linear-gradient(90deg, var(--ho-accent), #059669);
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.profile-focus-pct {
  font-size: 13px;
  font-weight: 700;
  color: var(--ho-accent);
}

/* ── Achievements ── */
.profile-achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
}

.profile-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 20px 12px;
  border-radius: var(--ho-radius-md);
  background: var(--ho-surface-elevated);
  border: 1px solid rgba(0, 0, 0, 0.05);
  transition: transform var(--ho-transition), box-shadow var(--ho-transition);
}

.profile-badge:hover {
  transform: translateY(-2px);
  box-shadow: var(--ho-shadow-sm);
}

.profile-badge--locked {
  opacity: 0.45;
  filter: grayscale(0.6);
}

.profile-badge-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 10px;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #fff;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.profile-badge--locked .profile-badge-icon {
  background: #e2e8f0;
  color: #94a3b8;
  box-shadow: none;
}

.profile-badge-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--ho-text-primary);
}

/* ── Analytics: Two-Column Grid ── */
.profile-analytics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* ── Radar Chart ── */
.profile-radar-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 260px;
}

.profile-radar-wrap svg {
  width: 100%;
  max-width: 280px;
  height: auto;
}

.profile-radar-label {
  font-size: 11px;
  fill: var(--ho-text-secondary);
  font-weight: 600;
}

.profile-radar-polygon {
  fill: rgba(0, 191, 166, 0.15);
  stroke: var(--ho-accent);
  stroke-width: 2;
}

.profile-radar-grid {
  fill: none;
  stroke: rgba(0, 0, 0, 0.06);
  stroke-width: 1;
}

.profile-radar-axis {
  stroke: rgba(0, 0, 0, 0.06);
  stroke-width: 1;
}

.profile-radar-dot {
  fill: var(--ho-accent);
  stroke: #fff;
  stroke-width: 2;
}

/* ── Heatmap ── */
.profile-heatmap-wrap {
  overflow-x: auto;
  padding: 4px;
}

.profile-heatmap {
  display: flex;
  gap: 3px;
}

.profile-heatmap-week {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.profile-heatmap-cell {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.04);
  transition: background var(--ho-transition);
}

.profile-heatmap-cell[data-level="1"] { background: rgba(0, 191, 166, 0.2); }
.profile-heatmap-cell[data-level="2"] { background: rgba(0, 191, 166, 0.4); }
.profile-heatmap-cell[data-level="3"] { background: rgba(0, 191, 166, 0.65); }
.profile-heatmap-cell[data-level="4"] { background: var(--ho-accent); }

.profile-heatmap-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-size: 11px;
  color: var(--ho-text-muted);
}

.profile-heatmap-legend-cell {
  width: 12px;
  height: 12px;
  border-radius: 2px;
}

.profile-heatmap-months {
  display: flex;
  gap: 3px;
  margin-bottom: 6px;
  font-size: 10px;
  color: var(--ho-text-muted);
  font-weight: 600;
}

.profile-heatmap-day-labels {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-right: 6px;
  font-size: 10px;
  color: var(--ho-text-muted);
  font-weight: 500;
}

.profile-heatmap-day-labels span {
  height: 14px;
  line-height: 14px;
}

/* ── Public Content Tabs & Grid ── */
.profile-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.profile-tab {
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  border-radius: var(--ho-radius-full);
  background: transparent;
  color: var(--ho-text-secondary);
  cursor: pointer;
  transition: all var(--ho-transition);
  font-family: inherit;
}

.profile-tab:hover {
  background: rgba(0, 0, 0, 0.04);
}

.profile-tab--active {
  background: var(--ho-primary);
  color: #fff;
}

.profile-content-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.profile-content-card {
  background: var(--ho-surface-elevated);
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: var(--ho-radius-md);
  padding: 20px;
  transition: transform var(--ho-transition), box-shadow var(--ho-transition);
  cursor: pointer;
}

.profile-content-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--ho-shadow-md);
}

.profile-content-card-type {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--ho-radius-full);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.profile-content-card-type--quiz       { background: rgba(99, 102, 241, 0.1); color: #6366f1; }
.profile-content-card-type--test       { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }
.profile-content-card-type--flashcard  { background: rgba(16, 185, 129, 0.1); color: #10b981; }

.profile-content-card-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--ho-text-primary);
  margin: 0 0 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.profile-content-card-meta {
  font-size: 12px;
  color: var(--ho-text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.profile-content-card-meta .material-symbols-outlined {
  font-size: 14px;
}

/* ── Educator Public Section (expandable) ── */
.profile-edu-expand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 18px 24px;
  background: linear-gradient(135deg, rgba(30, 58, 95, 0.05) 0%, rgba(0, 191, 166, 0.05) 100%);
  border: 1px dashed rgba(30, 58, 95, 0.15);
  border-radius: var(--ho-radius-md);
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--ho-primary-light);
  transition: all var(--ho-transition);
}

.profile-edu-expand:hover {
  background: linear-gradient(135deg, rgba(30, 58, 95, 0.08) 0%, rgba(0, 191, 166, 0.08) 100%);
  border-color: rgba(30, 58, 95, 0.25);
}

.profile-edu-expand .material-symbols-outlined {
  font-size: 20px;
  transition: transform var(--ho-transition);
}

.profile-edu-expand--open .material-symbols-outlined {
  transform: rotate(180deg);
}

.profile-edu-content {
  display: none;
  margin-top: 16px;
}

.profile-edu-content--open {
  display: block;
}

/* ── Empty State ── */
.profile-empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--ho-text-muted);
}

.profile-empty .material-symbols-outlined {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.4;
}

.profile-empty p {
  font-size: 14px;
  margin: 0;
}

/* ── No Focus State ── */
.profile-no-focus {
  text-align: center;
  padding: 20px;
  color: var(--ho-text-muted);
  font-size: 14px;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .profile-page {
    padding: 16px 12px 40px;
  }

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

  .profile-hero-content {
    flex-direction: column;
    text-align: center;
  }

  .profile-hero-meta {
    justify-content: center;
    flex-wrap: wrap;
  }

  .profile-hero-info h1 {
    font-size: 22px;
  }

  .profile-stats {
    grid-template-columns: 1fr 1fr;
  }

  .profile-analytics-grid {
    grid-template-columns: 1fr;
  }

  .profile-content-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 480px) {
  .profile-stats {
    grid-template-columns: 1fr;
  }

  .profile-hero-content {
    gap: 16px;
  }

  .profile-avatar {
    width: 80px;
    height: 80px;
    font-size: 32px;
  }
}

/* ── Dark Mode Overrides ── */
[data-theme="dark"] .profile-page {
  --ho-surface: #0f172a;
  --ho-surface-elevated: #1e293b;
  --ho-glass: rgba(30, 41, 59, 0.72);
  --ho-glass-border: rgba(255, 255, 255, 0.08);
  --ho-text-primary: #f1f5f9;
  --ho-text-secondary: #94a3b8;
  --ho-text-muted: #64748b;
  --ho-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --ho-shadow-md: 0 4px 20px rgba(0, 0, 0, 0.3);
  --ho-shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .profile-badge { background: #1e293b; border-color: rgba(255, 255, 255, 0.06); }
[data-theme="dark"] .profile-content-card { background: #1e293b; border-color: rgba(255, 255, 255, 0.06); }
[data-theme="dark"] .profile-heatmap-cell { background: rgba(255, 255, 255, 0.04); }
[data-theme="dark"] .profile-radar-grid { stroke: rgba(255, 255, 255, 0.08); }
[data-theme="dark"] .profile-radar-axis { stroke: rgba(255, 255, 255, 0.08); }
[data-theme="dark"] .profile-radar-label { fill: #94a3b8; }
