/* ============================================
   PROFILE PAGE - Lunaple EN
   User Profile + Luna Memory + Reading History
   ============================================ */

body.page-profile {
  padding-top: var(--header-height);
  padding-bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom, 0px));
}

/* Profile uses the global homepage cosmic background (bg_main.png) — no per-page override. */

/* All profile sections get translucent glass cards.
   Strong blur lets the watercolor bg show through softly while keeping text readable. */
.profile-card,
.profile-edit,
.profile-stats,
.coin-section,
.luna-memory-section,
.history-section,
.profile-links,
.referral-section {
  position: relative;
  z-index: 1;
  background: rgba(255, 255, 255, 0.55) !important;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: var(--radius-lg);
  max-width: var(--content-max);
  margin: 0 auto var(--space-md);
  padding: var(--space-lg);
  box-shadow: 0 4px 20px rgba(91, 168, 168, 0.08);
  backdrop-filter: blur(20px) saturate(1.1);
  -webkit-backdrop-filter: blur(20px) saturate(1.1);
}

/* Mobile: weaker GPU → drop blur, raise opacity instead */
@media (max-width: 767px) {
  .profile-card,
  .profile-edit,
  .profile-stats,
  .coin-section,
  .luna-memory-section,
  .history-section,
  .profile-links,
  .referral-section {
    background: rgba(255, 255, 255, 0.82) !important;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

/* Form fields inside profile-edit — slightly translucent but distinct */
.profile-edit .input,
.profile-edit input,
.profile-edit select,
.profile-edit textarea {
  background: rgba(255, 255, 255, 0.7) !important;
  border: 1px solid rgba(255, 255, 255, 0.5);
  color: var(--text-primary);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
@media (max-width: 767px) {
  .profile-edit .input,
  .profile-edit input,
  .profile-edit select,
  .profile-edit textarea {
    background: rgba(255, 255, 255, 0.9) !important;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}
.profile-edit label {
  color: var(--text-primary);
}
.profile-edit h3 {
  color: var(--text-primary);
}

/* Readability bumps */
.profile-name { color: var(--text-primary); font-weight: 700; }
.profile-stat-num { color: var(--color-primary); font-weight: 700; }
.profile-stat-label { color: var(--text-secondary); font-weight: 500; }
.coin-label { color: var(--text-secondary); font-weight: 500; }
.profile-email { color: var(--text-secondary); }
.memory-text { color: var(--text-primary); }
.profile-link { color: var(--text-primary); font-weight: 500; }
.history-title { color: var(--text-primary); font-weight: 600; }
.history-date { color: var(--text-secondary); }

.divider {
  max-width: var(--content-max);
  margin: var(--space-sm) auto;
}

/* Profile header */
.profile-card {
  text-align: center;
  padding: var(--space-2xl) var(--space-lg) var(--space-lg);
  margin-top: calc(var(--header-height) + var(--space-md)) !important;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--color-primary);
  margin: 0 auto var(--space-md);
}

.profile-avatar-placeholder {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--gradient-cta);
  margin: 0 auto var(--space-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 2rem;
  color: #fff;
}

.profile-name {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: var(--space-xs);
  color: var(--text-primary);
}

.profile-email {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: var(--space-md);
}

/* Stats row */
.profile-stats {
  display: flex;
  justify-content: center;
  gap: var(--space-xl);
  padding: var(--space-lg);
  border-top: none;
  border-bottom: none;
}

.profile-stat {
  text-align: center;
}

.profile-stat-num {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-primary);
}

.profile-stat-label {
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Coin section */
.coin-section {
  padding: var(--space-lg) var(--space-md);
  text-align: center;
}

.coin-display {
  font-family: var(--font-mono);
  font-size: 2rem;
  color: var(--color-secondary);
  margin-bottom: var(--space-sm);
}

.coin-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: var(--space-md);
}

/* Luna Memory Section */
.luna-memory-section {
  padding: var(--space-lg) var(--space-md);
}

.luna-memory-section h2 {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.memory-item {
  padding: var(--space-md);
  margin-bottom: var(--space-sm);
  display: flex;
  gap: var(--space-md);
  align-items: flex-start;
}

.memory-category {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--color-primary-dim);
  color: var(--color-primary);
  white-space: nowrap;
}

.memory-text {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.memory-locked {
  text-align: center;
  padding: var(--space-xl);
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* Reading history */
.history-section {
  padding: var(--space-lg) var(--space-md) var(--space-3xl);
}

.history-section h2 {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: var(--space-md);
}

.history-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  margin-bottom: var(--space-sm);
  cursor: pointer;
}

.history-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.history-icon.tarot { background: var(--color-secondary-dim); color: var(--color-secondary); }
.history-icon.dream { background: var(--color-teal-dim); color: var(--color-teal); }
.history-icon.astrology { background: var(--color-tertiary-dim); color: var(--color-tertiary); }

.history-info { flex: 1; }

.history-title {
  font-size: 0.875rem;
  font-weight: 500;
}

.history-date {
  font-size: 0.6875rem;
  color: var(--text-muted);
}

.history-score {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--color-secondary);
}

/* Settings links */
.profile-links {
  padding: var(--space-lg) var(--space-md);
}

.profile-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.9375rem;
}

.profile-link:last-child { border-bottom: none; }

.profile-link-arrow {
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* Referral section */
.referral-section {
  padding: var(--space-lg) var(--space-md);
}

.referral-code {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  background: var(--bg-surface-1);
  border: 1px solid var(--border-glass);
}

.referral-code-text {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-secondary);
  letter-spacing: 0.1em;
}

.referral-copy-btn {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: var(--color-secondary-dim);
  border: none;
  color: var(--color-secondary);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
}

/* City Dropdown (Profile Edit) */
.bc-city-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-surface-1);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 200px;
  overflow-y: auto;
  z-index: 100;
  display: none;
}

.bc-city-dropdown.open {
  display: block;
}

.bc-city-item {
  padding: 10px 14px;
  font-size: 0.85rem;
  color: var(--text-primary);
  cursor: pointer;
  border-bottom: 1px solid var(--border-subtle);
}

.bc-city-item:hover {
  background: var(--color-primary-dim);
}

.bc-city-item:last-child {
  border-bottom: none;
}

.bc-city-item small {
  color: var(--text-muted);
  display: block;
  font-size: 0.7rem;
}
