/* ============================================
   Account System UI Components
   头像区、用户中心、同步状态、锁定态卡片
   ============================================ */

/* --- Account Avatar (shared across launcher + header) --- */
.account-avatar {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--account-avatar-md);
  height: var(--account-avatar-md);
  border-radius: var(--account-avatar-radius);
  overflow: hidden;
  flex-shrink: 0;
  cursor: pointer;
  transition:
    transform var(--transition-fast),
    box-shadow var(--transition-fast);
}

.account-avatar:hover {
  transform: scale(1.06);
}

.account-avatar--sm {
  width: var(--account-avatar-sm);
  height: var(--account-avatar-sm);
}

.account-avatar--lg {
  width: var(--account-avatar-lg);
  height: var(--account-avatar-lg);
}

.account-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.account-avatar .material-icons,
.account-avatar .material-symbols-outlined {
  font-size: var(--text-display);
  color: color-mix(in srgb, var(--text-invert) 84%, transparent);
}

.account-avatar--sm .material-icons,
.account-avatar--sm .material-symbols-outlined {
  font-size: var(--text-title);
}

/* Avatar default guest background */
.account-avatar--guest {
  background: color-mix(in srgb, var(--account-badge-guest-bg) 78%, var(--surface-glass) 22%);
  border: 1.5px solid color-mix(in srgb, var(--text-invert) 18%, transparent);
}

/* Avatar signed-in state */
.account-avatar--signed-in {
  border: 1.5px solid color-mix(in srgb, var(--status-success) 48%, transparent);
}

/* Avatar premium border */
.account-avatar--premium {
  border: 2px solid color-mix(in srgb, var(--brand-accent-strong) 66%, transparent);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--brand-accent) 20%, transparent),
    var(--shadow-sm);
}

/* Online status dot */
.account-status-dot {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 8px;
  height: 8px;
  border-radius: var(--radius-circle);
  background: var(--status-success);
  border: 1.5px solid var(--surface-main);
}

.account-status-dot--offline {
  background: var(--text-soft);
}

/* --- Account Badge (VIP/Pro chip) --- */
.account-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  letter-spacing: 0.04em;
  line-height: 1.5;
  white-space: nowrap;
}

.account-badge--guest {
  background: var(--account-badge-guest-bg);
  color: var(--account-badge-guest-text);
}

.account-badge--pro {
  background: var(--account-badge-pro-bg);
  color: var(--account-badge-pro-text);
  border: 1px solid var(--account-badge-pro-border);
}

/* --- Account Sync Status Badge --- */
.account-sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  line-height: 1.4;
  white-space: nowrap;
}

.account-sync-badge .material-symbols-outlined {
  font-size: var(--text-body);
}

.account-sync-badge--local {
  background: var(--account-sync-local-bg);
  color: var(--account-sync-local-text);
}

.account-sync-badge--ready {
  background: var(--account-sync-ready-bg);
  color: var(--account-sync-ready-text);
}

.account-sync-badge--synced {
  background: var(--account-sync-done-bg);
  color: var(--account-sync-done-text);
}

.account-sync-badge--conflict {
  background: var(--account-sync-conflict-bg);
  color: var(--account-sync-conflict-text);
}

/* --- Sync Conflict Card --- */
.account-conflict-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--account-sync-conflict-bg);
  border: 1px solid color-mix(in srgb, var(--account-sync-conflict-text) 28%, transparent);
}

.account-conflict-card__times {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: var(--text-caption);
  color: var(--text-muted);
}

.account-conflict-card__actions {
  display: flex;
  gap: 8px;
}

.account-conflict-card__btn {
  flex: 1;
  appearance: none;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  background: var(--surface-elevated);
  color: var(--text-main);
  font-size: var(--text-caption);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.account-conflict-card__btn:hover {
  background: var(--bg-hover);
}

/* --- Account Center Overlay --- */
.account-center-overlay {
  position: fixed;
  inset: 0;
  z-index: 460;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--surface-code) 58%, transparent);
  backdrop-filter: blur(var(--blur-sm));
  -webkit-backdrop-filter: blur(var(--blur-sm));
  opacity: 0;
  visibility: hidden;
  transition:
    opacity var(--transition-slow),
    visibility var(--transition-slow);
}

.account-center-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.account-center-panel {
  position: relative;
  width: min(680px, calc(100vw - 40px));
  max-height: calc(100vh - 60px);
  overflow-y: auto;
  border-radius: var(--radius-lg);
  background: var(--surface-overlay);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-lg), var(--shadow-inset);
  padding: 28px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  transform: translateY(16px) scale(0.97);
  opacity: 0;
  transition:
    transform var(--transition-slow),
    opacity var(--transition-slow);
}

.account-center-overlay.is-open .account-center-panel {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.account-center-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.account-center-title {
  font-size: var(--text-heading);
  font-weight: var(--weight-extrabold);
  color: var(--text-main);
  letter-spacing: 0.02em;
}

.account-center-close {
  appearance: none;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition:
    color var(--transition-fast),
    background var(--transition-fast);
  line-height: 1;
}

.account-center-close:hover {
  color: var(--text-main);
  background: var(--bg-hover);
}

.account-sync-time {
  margin-left: var(--space-xs);
  font-size: var(--text-caption);
  color: var(--text-soft);
}

/* --- Account Card (profile, cloud, entitlement sections) --- */
.account-card {
  border-radius: var(--radius-lg);
  background: var(--account-card-bg);
  border: 1px solid var(--account-card-border);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-shrink: 0;
}

.account-card__header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.account-card__icon {
  font-size: var(--text-display);
  color: var(--icon-muted);
}

.account-card__title {
  font-size: var(--text-subtitle);
  font-weight: var(--weight-bold);
  color: var(--text-main);
}

.account-card__body {
  font-size: var(--text-body);
  color: var(--text-muted);
  line-height: 1.6;
}

/* Profile card layout */
.account-profile-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.account-profile-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.account-profile-name {
  font-size: var(--text-title);
  font-weight: var(--weight-bold);
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-profile-email {
  font-size: var(--text-caption);
  color: var(--text-muted);
}

/* --- Locked Card (Coming Soon) --- */
.account-card--locked {
  position: relative;
  overflow: hidden;
  background: var(--account-locked-bg);
  border-color: var(--account-locked-border);
}

.account-card--locked .account-card__body {
  color: var(--account-locked-text);
}

.account-locked-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  text-align: center;
}

.account-locked-icon {
  font-size: 28px;
  color: var(--account-locked-text);
}

.account-locked-label {
  font-size: var(--text-body);
  font-weight: var(--weight-semibold);
  color: var(--account-locked-text);
}

.account-locked-hint {
  font-size: var(--text-caption);
  color: var(--text-muted);
  line-height: 1.5;
}

/* --- Settings Account Summary Row --- */
.settings-account-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  border: 1px solid var(--border-soft);
  cursor: pointer;
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast);
}

.settings-account-row:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.settings-account-row__info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.settings-account-row__name {
  font-size: var(--text-body);
  font-weight: var(--weight-semibold);
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-account-row__status {
  font-size: var(--text-caption);
  color: var(--text-muted);
}

.settings-account-row__arrow {
  color: var(--text-soft);
  font-size: var(--text-heading);
  flex-shrink: 0;
}

/* --- Responsive Mobile --- */
@media (max-width: 900px) {
  .account-center-panel {
    width: calc(100vw - 24px);
    max-height: calc(100dvh - 32px); /* Use dynamic viewport height for mobile */
    border-radius: var(--radius-md);
    padding: 16px 14px 14px;
    gap: 12px; /* Reduce gap between cards */
  }

  .account-card {
    padding: 12px 14px; /* Reduce padding inside cards */
    gap: 8px; /* Reduce gap inside cards */
  }

  .account-profile-row {
    gap: 10px;
  }
}
