/* ============================================
   GameNest.fun — Profile Page Styles
   ============================================ */

/* ---- Layout ---- */
.profile-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 20px;
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 28px;
  min-height: 60vh;
}

.profile-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  text-align: center;
}

/* ---- Sidebar Cards ---- */
.profile-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.profile-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 24px;
  backdrop-filter: blur(12px);
  text-align: center;
}

.card-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 16px;
  text-align: left;
  color: var(--text-primary);
}

/* ---- Avatar & Name ---- */
.profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(108, 99, 255, 0.12);
  border: 3px solid var(--accent-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  margin: 0 auto 12px;
}

.profile-name {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
}

.profile-joined {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.profile-badge {
  margin-top: 12px;
  font-size: 0.82rem;
  color: var(--accent-gold);
  background: rgba(251, 191, 36, 0.1);
  padding: 4px 14px;
  border-radius: 20px;
  display: inline-block;
}

/* ---- Streak ---- */
.streak-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 16px;
}

.streak-item {
  text-align: center;
}

.streak-num {
  display: block;
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--accent-gold);
}

.streak-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.streak-divider {
  width: 1px;
  height: 32px;
  background: var(--border-subtle);
}

/* ---- Streak Calendar ---- */
.streak-calendar {
  display: flex;
  gap: 4px;
  justify-content: center;
  margin-top: 8px;
}

.cal-dot {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--bg-card-hover);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.2s;
}

.cal-done {
  background: rgba(0, 214, 143, 0.15);
  border-color: var(--accent-mint);
  color: var(--accent-mint);
}

/* ---- Stats ---- */
.stat-rows {
  text-align: left;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.88rem;
}

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

.stat-row span:first-child { color: var(--text-secondary); }
.stat-row span:last-child {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent-blue);
}

/* ---- Main Content ---- */
.profile-main {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.profile-section {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 24px;
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 16px;
}

/* ---- Daily Challenge Card ---- */
.daily-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(135deg, rgba(108, 99, 255, 0.08), rgba(0, 214, 143, 0.04));
  border: 1px solid rgba(108, 99, 255, 0.15);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.daily-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: rgba(108, 99, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.daily-info { flex: 1; min-width: 0; }
.daily-info h3 { font-size: 1rem; font-weight: 700; }
.daily-info p { font-size: 0.83rem; color: var(--text-secondary); margin-top: 2px; }

/* ---- Chart Tabs ---- */
.chart-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  padding: 3px;
  width: fit-content;
  border: 1px solid var(--border-subtle);
}

.chart-tab {
  padding: 6px 16px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 500;
  border: none;
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font-body);
}

.chart-tab.active {
  background: var(--accent-blue);
  color: #fff;
}

.chart-tab:hover:not(.active) {
  color: var(--text-primary);
}

.chart-container {
  background: #07070f;
  border-radius: var(--radius-md);
  padding: 4px;
}

.chart-container canvas {
  width: 100%;
  height: 220px;
  display: block;
}

/* ---- Game Records ---- */
.game-records {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.record-empty {
  text-align: center;
  padding: 32px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.record-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border-radius: var(--radius-md);
  transition: background 0.15s;
  cursor: pointer;
}

.record-row:hover { background: var(--bg-card-hover); }

.record-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.record-info { flex: 1; min-width: 0; }
.record-name { font-weight: 600; font-size: 0.9rem; }
.record-meta { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

.record-score {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--accent-blue);
}

/* ---- User Auth Modal ---- */
.user-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
  backdrop-filter: blur(4px);
}

.user-overlay.active { opacity: 1; pointer-events: all; }

.user-modal {
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 36px 32px 28px;
  max-width: 400px;
  width: 90%;
  position: relative;
}

.user-modal h3 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  margin-bottom: 6px;
  text-align: center;
}

.user-modal-sub {
  color: var(--text-secondary);
  font-size: 0.85rem;
  text-align: center;
  margin-bottom: 24px;
}

.user-modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
}

.user-form { text-align: left; }

/* ---- Avatar Picker ---- */
.user-avatar-picker { margin-bottom: 20px; }
.user-avatar-picker label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 8px;
}

.avatar-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.av-opt {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--bg-card);
  border: 2px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.15s;
}

.av-opt:hover { border-color: var(--border-hover); }
.av-selected { border-color: var(--accent-blue); background: rgba(108, 99, 255, 0.1); }

/* ---- User Field ---- */
.user-field { margin-bottom: 20px; }
.user-field label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 6px;
}

.user-field input {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s;
}

.user-field input:focus { border-color: var(--accent-blue); }

.user-actions {
  display: flex;
  gap: 10px;
}

.user-actions .btn-secondary { flex: 1; }

/* ---- User Menu (dropdown) ---- */
.user-menu {
  position: fixed;
  top: 64px;
  right: 20px;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 8px;
  min-width: 180px;
  z-index: 200;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: all 0.2s;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.4);
}

.user-menu.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

.user-menu-header {
  padding: 10px 14px;
  font-weight: 600;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 4px;
}

.user-menu-item {
  display: block;
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  color: var(--text-primary);
  text-decoration: none;
  transition: background 0.1s;
  cursor: pointer;
  border: none;
  background: none;
  font-family: var(--font-body);
  text-align: left;
}

.user-menu-item:hover { background: var(--bg-card); }

.user-menu-danger { color: var(--accent-coral) !important; }
.user-menu-danger:hover { background: rgba(255, 107, 107, 0.1) !important; }

/* ---- Mobile ---- */
@media (max-width: 768px) {
  .profile-page {
    grid-template-columns: 1fr;
    padding: 20px 16px;
  }
  .streak-calendar { gap: 3px; }
  .cal-dot { width: 24px; height: 24px; font-size: 0.6rem; }
  .daily-card { flex-wrap: wrap; }
  .daily-card .btn { width: 100%; justify-content: center; }
  .user-menu { right: 12px; left: 12px; }
}
