/* Profile page — 2026-04-21 */

:root {
  --p-bg: #f6f7fb;
  --p-surface: #fff;
  --p-text: #1f2940;
  --p-muted: #5b657c;
  --p-line: #e7eaf2;
  --p-primary: #4f6ef7;
  --p-primary-strong: #3d5ae5;
  --p-success: #10b981;
  --p-danger: #dc2626;
  --p-warning: #d97706;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--p-bg);
  color: var(--p-text);
  font-family: 'Nunito', 'Avenir Next', Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

html[lang="my"] body {
  font-family: 'Noto Sans Myanmar', 'Nunito', Inter, system-ui, sans-serif;
  line-height: 1.7;
}

/* ===== Topbar ===== */
.profile-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: var(--p-primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.profile-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  text-decoration: none;
  font-size: 20px;
  font-weight: 700;
  transition: background 0.15s;
}
.profile-back:hover, .profile-back:focus-visible { background: rgba(255, 255, 255, 0.28); outline: none; }

.profile-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  flex: 1;
}

/* ===== Content ===== */
.profile-content {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 16px 60px;
}

.profile-loading {
  text-align: center;
  color: var(--p-muted);
  font-size: 14px;
  margin-top: 40px;
}

/* ===== Cards ===== */
.profile-card {
  background: var(--p-surface);
  border: 1px solid var(--p-line);
  border-radius: 14px;
  padding: 18px 18px 16px;
  margin-bottom: 14px;
}

.profile-card h2 {
  margin: 0 0 12px;
  font-size: 16px;
  color: var(--p-primary-strong);
}

.profile-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--p-line);
  font-size: 14.5px;
}
.profile-row:last-child { border-bottom: 0; padding-bottom: 0; }

.profile-row-label {
  color: var(--p-muted);
  flex-shrink: 0;
  font-weight: 600;
}

.profile-row-value {
  text-align: right;
  color: var(--p-text);
  font-weight: 600;
  word-break: break-word;
}

.profile-verify-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-left: 4px;
  border-radius: 50%;
  background: var(--p-success);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  vertical-align: middle;
}

/* ===== Guest ===== */
.profile-guest-hero {
  text-align: center;
  padding: 16px 8px;
}
.profile-guest-icon {
  font-size: 56px;
  margin-bottom: 10px;
  line-height: 1;
}
.profile-guest-hero h2 { margin: 0 0 8px; font-size: 18px; color: var(--p-text); }
.profile-guest-hero p { margin: 0 0 18px; color: var(--p-muted); font-size: 14.5px; }
.profile-guest-note {
  margin-top: 14px;
  font-size: 12.5px;
  color: var(--p-muted);
}

/* ===== Plan banner ===== */
.profile-plan-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: linear-gradient(135deg, #eef3ff 0%, #e8fff4 100%);
  border-radius: 12px;
  margin-bottom: 12px;
}
.profile-plan-badge {
  flex-shrink: 0;
  padding: 6px 14px;
  background: var(--p-primary);
  color: #fff;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.5px;
}
.profile-plan-badge.is-free { background: #9ca3af; }
.profile-plan-badge.is-n4 { background: var(--p-primary); }
.profile-plan-badge.is-n3 { background: #8b5cf6; }
.profile-plan-badge.is-n2 { background: linear-gradient(135deg, #f59e0b, #dc2626); }
.profile-plan-badge.is-gift { background: linear-gradient(135deg, #ec4899, #f59e0b); }
.profile-plan-desc {
  margin: 0;
  font-size: 14px;
  color: var(--p-text);
  font-weight: 600;
}

/* ===== Stats grid ===== */
.profile-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 10px;
}
.profile-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 8px;
  background: #f9fafb;
  border-radius: 10px;
  border: 1px solid var(--p-line);
}
.profile-stat-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--p-primary-strong);
  line-height: 1;
}
.profile-stat-label {
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--p-muted);
  text-align: center;
  line-height: 1.3;
}

/* ===== Settings ===== */
.profile-setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  font-size: 14.5px;
  font-weight: 600;
}
.profile-select {
  padding: 8px 12px;
  font-size: 14px;
  border: 1.5px solid var(--p-line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font-family: inherit;
}
.profile-select:focus { outline: none; border-color: var(--p-primary); }

.profile-toggle {
  width: 20px;
  height: 20px;
  accent-color: var(--p-primary);
  cursor: pointer;
}

.profile-setting-hint {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--p-muted);
}

/* ===== Buttons ===== */
.profile-btn {
  width: 100%;
  padding: 12px 14px;
  margin-top: 8px;
  font-size: 14.5px;
  font-weight: 700;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.15s, background 0.15s;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.profile-btn:hover { transform: translateY(-1px); }
.profile-btn:disabled { opacity: 0.6; cursor: wait; transform: none; }

.profile-btn-primary {
  background: var(--p-primary);
  color: #fff;
  border: 0;
  box-shadow: 0 4px 14px rgba(79, 110, 247, 0.28);
}
.profile-btn-primary:hover { background: var(--p-primary-strong); }

.profile-btn-secondary {
  background: #fff;
  color: var(--p-text);
  border: 1.5px solid var(--p-line);
}
.profile-btn-secondary:hover { border-color: var(--p-primary); }

.profile-btn-danger {
  background: #fff;
  color: var(--p-danger);
  border: 1.5px solid #fecaca;
}
.profile-btn-danger:hover { background: #fef2f2; border-color: var(--p-danger); }

.profile-action-hint {
  margin: 4px 0 14px;
  font-size: 12.5px;
  color: var(--p-muted);
  text-align: center;
}
.profile-action-hint-danger { color: var(--p-danger); }

.profile-danger-zone h2 { color: var(--p-danger); }

/* ===== Footer ===== */
.legal-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 10px;
  padding: 20px 16px 24px;
  margin-top: 20px;
  font-size: 12.5px;
  color: #7a849b;
  border-top: 1px solid var(--p-line);
}
.legal-footer a {
  color: var(--p-primary);
  text-decoration: none;
  font-weight: 600;
}
.legal-footer a:hover { text-decoration: underline; }
.legal-footer span { color: #c1c8d5; }

@media (max-width: 480px) {
  .profile-content { padding: 16px 12px 40px; }
  .profile-card { padding: 14px 14px 12px; }
  .profile-card h2 { font-size: 15.5px; }
  .profile-row { font-size: 14px; }
  .profile-stat-value { font-size: 20px; }
}

/* ===== Status card (2026-04-21) — luôn hiện, đồng nhất guest + logged-in ===== */
.profile-status-card {
  border-left: 4px solid var(--p-primary);
}
.profile-status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14.5px;
  font-weight: 600;
  padding: 4px 0;
}
.profile-status-dot {
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #9ca3af;
  box-shadow: 0 0 0 3px rgba(156, 163, 175, 0.18);
  transition: background 0.2s, box-shadow 0.2s;
}
.profile-status-label {
  flex: 1;
  word-break: break-word;
}

/* Guest block trong status card */
.profile-guest-block {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--p-line);
  text-align: center;
}
.profile-guest-block[hidden] { display: none; }
.profile-guest-sub {
  margin: 0 0 12px;
  color: var(--p-muted);
  font-size: 14px;
}
.profile-guest-note {
  margin: 10px 0 0;
  font-size: 12.5px;
  color: var(--p-muted);
  font-style: italic;
}

/* ============================================================
   Language switcher (2026-04-22) — mounted by ui/lang-switcher.js
   Styles copy từ styles.css / module.css, điều chỉnh cho topbar nền tím.
   ============================================================ */
.lang-switcher-slot {
  margin-left: auto;
  display: flex;
  align-items: center;
}

.lang-wrap { position: relative; }
.lang-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}
.lang-btn:hover { background: rgba(255, 255, 255, 0.28); }
.lang-btn:active { transform: scale(0.96); }
.lang-btn .lang-flag { font-size: 16px; line-height: 1; }
.lang-btn .lang-code { font-size: 10px; }
.lang-btn .lang-caret { font-size: 9px; opacity: 0.7; }
.lang-btn[aria-expanded="true"] .lang-caret { transform: rotate(180deg); }

.lang-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: max-content;
  background: #fff;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(47,55,82,0.18);
  padding: 3px;
  z-index: 30;
  display: flex;
  flex-direction: column;
}
.lang-menu[hidden] { display: none; }

.lang-option {
  appearance: none;
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  color: #2d3a5b;
  font-size: 13px;
  text-align: left;
  width: 100%;
  white-space: nowrap;
}
.lang-option:hover { background: #fef2ec; }
.lang-option.is-active { background: #ffe8da; color: #d95a2a; font-weight: 700; }
.lang-option-label { flex: 1; }
