/* ============================================
   Profile Tab - 个人中心（对标设计稿 V2）
   ============================================ */

#tab-profile {
  background: #0d0d0d;
  padding-bottom: calc(var(--tabbar-height, 52px) + env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
}

/* ---- 顶部导航栏（与 For You 一致）---- */
.profile-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
  padding: 0 16px;
  padding-top: max(12px, env(safe-area-inset-top, 0px));
  background: rgba(10, 10, 10, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.profile-nav-home {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: none;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.profile-home-img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.profile-nav-title {
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.5px;
}

.profile-nav-settings {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: none;
  border: 0;
  cursor: pointer;
}

.profile-nav-settings:focus-visible {
  outline: 2px solid var(--color-primary, #e94560);
  outline-offset: -2px;
}

/* ---- 用户信息区 ---- */
.profile-user-section {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 18px 8px;
}

/* 方形头像 — 蓝色边框 */
.profile-avatar-box {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  background: rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

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

.profile-user-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.profile-username {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  margin: 0;
  line-height: 1.2;
  display: flex;
  align-items: center;
  gap: 6px;
}

.profile-svip-badge {
  height: 22px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
  vertical-align: middle;
}

.profile-uid {
  font-size: 13px;
  color: #F5F5F5;
  margin: 0;
  line-height: 1.2;
}

/* ---- 会员状态卡片 ---- */
.subscribe-card {
  margin: 14px 16px 0;
  background: url('../assets/images/subscribe.png') center/cover no-repeat;
  border-radius: 14px;
  padding: 20px 18px;
  height: 150px;
  min-height: 150px;
  position: relative;
  overflow: hidden;
}

.subscribe-content {
  position: relative;
  z-index: 2;
  height: 100%;
  min-width: 0;
  display: grid;
  grid-template-rows: 66px 44px;
  gap: 4px;
}

.membership-status {
  min-width: 0;
  display: grid;
  grid-template-rows: 28px 22px 16px;
}

.subscribe-title {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.3px;
  line-height: 16px;
  display: flex;
  align-items: center;
  overflow-wrap: anywhere;
}

.membership-line {
  min-width: 0;
  color: rgba(255, 255, 255, 0.92);
  font-size: 11px;
  line-height: 14px;
  overflow-wrap: anywhere;
}

.membership-line time {
  white-space: nowrap;
}

.membership-action-slot {
  height: 44px;
  display: flex;
  align-items: stretch;
}

.subscribe-btn {
  align-self: flex-start;
  min-width: 44px;
  min-height: 44px;
  max-width: 100%;
  padding: 0 24px;
  background: #fff;
  color: #4C84FB;
  border: none;
  border-radius: 22px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.subscribe-btn:active {
  transform: scale(0.95);
  background: #f0f0f0;
}

/* ---- My Wallet 钱包卡片 ---- */
.wallet-card {
  margin: 14px 16px 0;
  background: #2B2D3C;
  border-radius: 14px;
  padding: 16px 18px;
}

.wallet-label {
  font-size: 13px;
  font-weight: 600;
  color: #999;
  margin-bottom: 12px;
  letter-spacing: 0.3px;
}

.wallet-divider {
  height: 1px;
  background: #5A5A5A;
  margin: 0 8px 12px;
}

/* ---- Help & Feedback ---- */
.feedback-page-body {
  max-width: 720px;
  margin: 0 auto;
}

.feedback-form,
.feedback-item {
  background: #2B2D3C;
  border-radius: 14px;
  padding: 16px;
}

.feedback-form label {
  display: block;
  margin: 0 0 8px;
  color: #ddd;
  font-size: 14px;
  font-weight: 600;
}

.feedback-input {
  width: 100%;
  min-height: 44px;
  box-sizing: border-box;
  margin: 0 0 16px;
  padding: 12px;
  color: #fff;
  background: #1f202b;
  border: 1px solid #505362;
  border-radius: 9px;
  font: inherit;
}

.feedback-required { color: #ff8f8f; }

.feedback-input:focus-visible {
  outline: 2px solid #4C84FB;
  outline-offset: 2px;
}

.feedback-content {
  min-height: 140px;
  resize: vertical;
}

.feedback-submit {
  min-height: 44px;
  padding: 0 22px;
  color: #fff;
  background: #4C84FB;
  border: 0;
  border-radius: 22px;
  font-weight: 700;
}

.feedback-submit:disabled { opacity: .55; }
.feedback-submit:not(:disabled) { cursor: pointer; }
.feedback-status { min-height: 20px; margin: 10px 0 0; color: #aaa; }
.feedback-history { margin-top: 24px; }
.feedback-history h2 { margin: 0 0 12px; color: #fff; font-size: 18px; }
.feedback-list { display: grid; gap: 12px; }
.feedback-item h3 { margin: 0 0 8px; color: #fff; font-size: 16px; }
.feedback-item-content,
.feedback-reply-content { margin: 0; color: #ddd; white-space: pre-wrap; overflow-wrap: anywhere; }
.feedback-item-meta { margin: 10px 0 0; color: #999; font-size: 12px; }
.feedback-reply { margin-top: 14px; padding: 12px; background: #202635; border-left: 3px solid #4C84FB; }
.feedback-reply-label { display: block; margin-bottom: 6px; color: #8fb4ff; font-size: 13px; }

.wallet-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.wallet-balance {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wallet-coin-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.wallet-amount {
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.5px;
}

.wallet-refill-btn {
  padding: 6px 20px;
  background: #fff;
  color: #4C84FB;
  border: none;
  border-radius: 22px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  transition: all 0.15s ease;
}

.wallet-refill-btn:active {
  transform: scale(0.95);
}

.wallet-summary-status,
.wallet-history-status {
  min-height: 18px;
  margin: 8px 0 0;
  color: #aaa;
  font-size: 12px;
}

.wallet-history-list { display: grid; gap: 8px; }
.wallet-history-item {
  display: grid;
  gap: 3px;
  padding: 10px;
  border-radius: 10px;
  background: rgba(255,255,255,0.05);
  color: #bbb;
  font-size: 12px;
}
.wallet-history-item strong { color: #fff; }
.wallet-history-more {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 20px;
  background: transparent;
  color: #fff;
  cursor: pointer;
}

.wallet-transactions-open,
.settings-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 44px;
  padding: 12px 0;
  color: #e8e8e8;
  background: none;
  border: 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.wallet-transactions-open { margin-top: 8px; }

.wallet-transactions-open:active,
.settings-item:active { background: rgba(255,255,255,0.04); }

.wallet-transactions-open:focus-visible,
.settings-item:focus-visible {
  outline: 2px solid var(--color-primary, #e94560);
  outline-offset: -2px;
}

.order-center-body {
  padding-bottom: max(24px, env(safe-area-inset-bottom, 0px));
}

.order-list {
  display: grid;
  gap: 12px;
}

.order-card {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  background: rgba(255,255,255,0.05);
  color: #e8e8e8;
}

.order-card-heading,
.order-card-meta,
.order-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.order-status {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.09);
  color: #ccc;
  font-size: 12px;
}

.order-status[data-status="PAID"] { color: #72d7a0; }
.order-status[data-status="FAILED"],
.order-status[data-status="CANCELED"],
.order-status[data-status="EXPIRED"] { color: #aaa; }
.order-number,
.order-card-meta {
  color: #aaa;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.order-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  padding-top: 4px;
}

.order-action {
  min-width: 96px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid rgba(255,255,255,0.28);
  border-radius: 22px;
  background: transparent;
  color: #fff;
  cursor: pointer;
}

.order-action-primary {
  border-color: var(--color-primary, #e94560);
  background: var(--color-primary, #e94560);
}

.order-action:disabled { opacity: 0.55; cursor: wait; }
.order-action:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .sub-page { animation: none; }
}

/* ---- 功能入口列表 ---- */
.profile-menu-list {
  margin: 18px 16px 0;
  border-radius: 14px;
  overflow: hidden;
}

.pm-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 4px;
  width: 100%;
  min-height: 44px;
  background: none;
  text-align: left;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.12s ease;
}

.pm-item[hidden] {
  display: none !important;
}

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

.pm-item:active {
  background: rgba(255,255,255,0.04);
}

.pm-item:focus-visible,
.sub-back-btn:focus-visible {
  outline: 2px solid var(--color-primary, #e94560);
  outline-offset: -2px;
}

.pm-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.pm-icon {
  color: #aaa;
  flex-shrink: 0;
}

.pm-label {
  font-size: 16px;
  font-weight: 500;
  color: #E8E8E8;
}

.pm-arrow {
  color: #555;
  flex-shrink: 0;
}


/* ============================================
   Profile 子页面通用样式
   ============================================ */

.sub-page {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: var(--z-modal, 200);
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  animation: sub-page-in 0.25s ease;
}

@keyframes sub-page-in {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.sub-page.hidden {
  display: none !important;
}

.sub-page-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 48px;
  padding: 0 16px;
  padding-top: max(12px, env(safe-area-inset-top, 0px));
  background: rgba(10,10,10,0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 5;
}

.sub-back-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
}

.sub-nav-title {
  font-size: 17px;
  font-weight: 700;
  color: #fff;
}

.sub-page-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.settings-page-body {
  padding-bottom: max(24px, env(safe-area-inset-bottom, 0px));
}

.settings-group + .settings-group { margin-top: 24px; }

.settings-group h2 {
  margin: 0 0 6px;
  color: #999;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.settings-item[hidden] { display: none; }

/* ---- 空状态 ---- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 12px;
}

.empty-state p {
  font-size: 14px;
  color: #666;
  margin: 0;
}

/* ---- 收藏列表：三列网格卡片（复用 drama-card） ---- */
#favorites-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 0 10px 32px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  grid-auto-rows: max-content;
}

#favorites-list .empty-state,
#playlist-list .empty-state {
  grid-column: 1 / -1;
  min-height: 50vh;
  padding: 0;
}
#favorites-list .drama-card {
  width: 100%;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  border-radius: 10px;
  overflow: hidden;
  transition: transform 0.15s ease;
  background: transparent;
}

#favorites-list .drama-card:active {
  transform: scale(0.97);
}

#favorites-list .card-poster {
  width: 100%;
  aspect-ratio: 2 / 3;
  height: auto;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  background: #1c1c1e;
}

#favorites-list .card-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

#favorites-list .card-title {
  margin-top: 6px;
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
  padding: 0 2px;
}

#favorites-list .card-ep {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: #6E6E6E;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
  padding: 0 2px;
  margin-top: 2px;
}

#favorites-list .card-badge {
  display: none;
}

/* ---- 播放历史：三列网格卡片（复用 drama-card） ---- */
#playlist-list .drama-card {
  width: 100%;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  border-radius: 10px;
  overflow: hidden;
  transition: transform 0.15s ease;
  background: transparent;
}

#playlist-list .drama-card:active {
  transform: scale(0.97);
}

#playlist-list .card-poster {
  width: 100%;
  aspect-ratio: 2 / 3;
  height: auto;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  background: #1c1c1e;
}

#playlist-list .card-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

#playlist-list .card-title {
  margin-top: 6px;
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
  padding: 0 2px;
}

#playlist-list .card-ep {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: #6E6E6E;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
  padding: 0 2px;
  margin-top: 2px;
}

#playlist-list .card-badge {
  display: none;
}

/* ---- 语言设置页 ---- */
/* 语言页导航 — 标题居中 */
.lang-nav {
  position: relative;
}

.lang-nav-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

/* Language 分区标题 */
.lang-section-title {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  margin: 0;
  padding: 20px 16px 8px;
}

.lang-list {
  padding: 0;
}

.lang-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.12s ease;
}

.lang-option:last-child {
  border-bottom: none;
}

.lang-option:active {
  background: rgba(255,255,255,0.04);
}

.lang-name {
  font-size: 15px;
  color: #E8E8E8;
}

.lang-check {
  font-size: 18px;
  color: #3B82F6;
  font-weight: 700;
}

.lang-option:not(.active) .lang-check {
  visibility: hidden;
}

.lang-option.active .lang-name {
  color: #3B82F6;
  font-weight: 600;
}

/* ---- 法律文档阅读页 ---- */
.legal-content {
  flex: 1;
  overflow: hidden;
  padding: 0;
  min-height: 0;
  scrollbar-width: none;
}
.legal-content::-webkit-scrollbar {
  display: none;
}

.legal-document-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--bg-primary);
}

/* ============================================
   Google 登录 - Sign In 按钮 + 登录弹窗
   ============================================ */

/* Profile 用户区的 Sign In 按钮 */
.profile-signin-btn {
  margin-left: auto;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: var(--color-primary, #e94560);
  border: none;
  border-radius: 16px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s ease;
  flex-shrink: 0;
  min-height: 44px;
}

.profile-signin-btn:active {
  opacity: 0.8;
}

@media (min-width: 768px) {
  #tab-profile > .profile-nav,
  #tab-profile > .profile-user-section {
    width: 100%;
    max-width: 720px;
    margin-right: auto;
    margin-left: auto;
  }

  #tab-profile > .subscribe-card,
  #tab-profile > .wallet-card,
  #tab-profile > .profile-menu-list {
    width: calc(100% - 32px);
    max-width: 720px;
    margin-right: auto;
    margin-left: auto;
  }
}

/* 登录弹窗 - 全屏蒙层 */
.login-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.login-modal.hidden {
  display: none;
}

/* 底部 sheet 卡片 */
.login-modal-card {
  width: 100%;
  max-width: 480px;
  background: #1a1a24;
  border-radius: 20px 20px 0 0;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
}

.login-modal-title {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  margin: 0;
}

.login-modal-subtitle {
  font-size: 13px;
  color: #aaa;
  text-align: center;
  margin: 0 0 8px;
  line-height: 1.5;
}

.google-signin-btn {
  width: 280px;
  max-width: 100%;
  height: 44px;
  min-height: 44px;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 8px 0;
}

.google-auth-options {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.google-auth-options[hidden] {
  display: none;
}

.google-link-notice {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  border: 1px solid rgba(255, 184, 77, 0.55);
  border-radius: 12px;
  background: rgba(255, 184, 77, 0.1);
  color: #f6f1e7;
  font-size: 13px;
  line-height: 1.45;
}

.google-link-notice[hidden] {
  display: none;
}

.google-link-notice strong,
.google-link-notice span {
  display: block;
}

.google-link-notice strong {
  margin-bottom: 4px;
  color: #ffcb7a;
  font-size: 14px;
}

.email-auth-form {
  display: grid;
  gap: 10px;
  margin-top: 8px;
  width: 100%;
}

.email-auth-form[hidden] {
  display: none;
}

.email-auth-label {
  color: #d8d8d8;
  font-size: 13px;
  text-align: left;
}

.email-auth-input {
  width: 100%;
  border: 1px solid #3b3b3b;
  border-radius: 10px;
  background: #101018;
  color: #fff;
  padding: 12px;
  box-sizing: border-box;
}

.email-auth-password {
  position: relative;
}

.email-auth-password .email-auth-input {
  padding-right: 44px;
}

.email-auth-password button {
  position: absolute;
  top: 50%;
  right: 2px;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  padding: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.eye-icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: #8a8a8a;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.email-auth-password button .eye-icon--off {
  display: none;
}

.email-auth-password button[aria-pressed="true"] .eye-icon {
  display: none;
}

.email-auth-password button[aria-pressed="true"] .eye-icon--off {
  display: block;
}

.email-auth-submit {
  border: 0;
  border-radius: 10px;
  background: #fff;
  color: #111;
  font-weight: 700;
  padding: 12px;
}

.email-auth-submit:disabled {
  opacity: .55;
}

.email-auth-links {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.email-auth-links[hidden] {
  display: none;
}

.email-auth-links button {
  border: 0;
  background: transparent;
  color: #b8b8b8;
  font-size: 12px;
  min-height: 44px;
  padding: 4px 0;
}

.email-auth-hint,
.email-auth-status,
.verification-guidance {
  color: #aaa;
  font-size: 12px;
  line-height: 1.4;
}

.verification-guidance {
  margin: 0;
  text-align: left;
}

.verification-guidance strong {
  color: #fff;
  overflow-wrap: anywhere;
}

.email-auth-status {
  margin: 4px 0 0;
}

#google-signin-status {
  box-sizing: border-box;
  flex: 0 0 4.2em;
  width: 100%;
  height: 4.2em;
  overflow: hidden;
  text-align: center;
}

#google-signin-status.google-signin-status-empty {
  visibility: hidden;
}

.login-divider {
  color: #777;
  font-size: 12px;
  margin-top: 4px;
  text-align: center;
}

.login-modal-close {
  margin-top: 8px;
  padding: 10px 24px;
  font-size: 14px;
  color: #aaa;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  cursor: pointer;
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
}

.login-modal-close:active {
  background: rgba(255, 255, 255, 0.04);
}
