/* ==========================================================================
   會員中心 · Profile
   延續 dashboard / energy 的資訊卡片版式
   ========================================================================== */

.member-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-bottom: 40px;
}

/* Page header */
.member-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 4px;
}
.member-head h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--nx-ink-900);
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin: 0;
}
.member-head .sub {
  font-size: 14px;
  color: #64748B;
  line-height: 1.5;
}
@media (max-width: 700px) {
  .member-head h1 { font-size: 22px; }
  .member-head .sub { font-size: 13px; }
}

/* ==========================================================================
   Card (資訊卡)
   ========================================================================== */
.mem-card {
  background: #fff;
  border: 1px solid #E5E9F0;
  border-radius: 16px;
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
@media (max-width: 700px) {
  .mem-card {
    padding: 18px 16px;
    border-radius: 14px;
    gap: 14px;
  }
}

/* Card head : 標題 + 附註 / 動作 */
.mem-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.mem-card-head .title {
  font-size: 16px;
  font-weight: 600;
  color: var(--nx-ink-900);
  letter-spacing: -0.005em;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.mem-card-head .title .icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(37, 99, 235, 0.08);
  color: #2563EB;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.mem-card-head .title .icon svg { width: 15px; height: 15px; }
.mem-card-head .note {
  font-size: 12px;
  color: #94A3B8;
  font-family: var(--nx-font-mono);
  letter-spacing: 0.06em;
}

/* ==========================================================================
   Field rows : label + value
   ========================================================================== */
/* ==========================================================================
   Avatar row (更換頭像)
   ========================================================================== */
.mem-avatar-row {
  display: flex;
  align-items: center;
  gap: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid #F1F4F9;
}
.mem-avatar-wrap {
  position: relative;
  width: 76px;
  height: 76px;
  flex-shrink: 0;
}
.mem-avatar {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563EB 0%, #06B6D4 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-family: var(--nx-font-mono, 'JetBrains Mono', monospace);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: 0.02em;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.18);
}
.mem-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.mem-avatar img[hidden] { display: none; }
.mem-avatar.has-image .mem-avatar-initials { display: none; }
.mem-avatar-edit {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #0F172A;
  color: #fff;
  border: 2.5px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s;
  padding: 0;
}
.mem-avatar-edit:hover { background: #2563EB; transform: scale(1.06); }
.mem-avatar-edit svg { width: 14px; height: 14px; }
.mem-avatar-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.mem-avatar-name {
  font-size: 17px;
  font-weight: 600;
  color: var(--nx-ink-900);
  line-height: 1.3;
}
.mem-avatar-hint {
  font-size: 12.5px;
  color: #64748B;
  line-height: 1.5;
}
@media (max-width: 700px) {
  .mem-avatar-row { gap: 14px; padding-bottom: 14px; }
  .mem-avatar-wrap, .mem-avatar { width: 64px; height: 64px; }
  .mem-avatar { font-size: 22px; }
  .mem-avatar-edit { width: 24px; height: 24px; }
  .mem-avatar-edit svg { width: 12px; height: 12px; }
  .mem-avatar-name { font-size: 15.5px; }
  .mem-avatar-hint { font-size: 11.5px; }
}

.mem-fields {
  display: flex;
  flex-direction: column;
  border-top: 1px solid #F1F5F9;
}
.mem-field {
  display: grid;
  grid-template-columns: 140px 1fr;
  align-items: center;
  gap: 20px;
  padding: 14px 4px;
  border-bottom: 1px solid #F1F5F9;
}
.mem-field:last-child { border-bottom: 0; }

.mem-field .label {
  font-size: 13px;
  color: #64748B;
  font-weight: 500;
}
.mem-field .value {
  font-size: 14.5px;
  color: var(--nx-ink-900);
  font-weight: 500;
  min-width: 0;
  word-break: break-all;
}
.mem-field .value.mono {
  font-family: var(--nx-font-mono);
  font-size: 14px;
  letter-spacing: 0.03em;
}
.mem-field .value .mask {
  color: #94A3B8;
  letter-spacing: 0.08em;
  margin-left: 4px;
}

/* 銀行帳號 : RWD 切換
   - 桌機（≥ 701px）：顯示完整帳號
   - 手機（≤ 700px）：僅顯示遮蔽版 812●●●●●●●●●●●● */
.mem-field .value .acct-full   { display: inline; }
.mem-field .value .acct-masked { display: none; }
@media (max-width: 700px) {
  .mem-field .value .acct-full   { display: none; }
  .mem-field .value .acct-masked { display: inline; }
}

/* 只讀提示（極小 chip） */
.mem-readonly {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--nx-font-mono);
  font-size: 10.5px;
  letter-spacing: 0.10em;
  color: #94A3B8;
  padding: 2px 8px;
  border: 1px solid #E5E9F0;
  border-radius: 999px;
  text-transform: uppercase;
  white-space: nowrap;
}
.mem-readonly svg { width: 10px; height: 10px; }

/* 綠色狀態 Badge（已綁定完成 / 成功狀態）
   — 與 dashboard status-chip.is-ready 樣式一致 */
.mem-bound {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--nx-font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: #059669;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.20);
  padding: 4px 10px 4px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.mem-bound .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10B981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18);
  animation: en-pulse 2.4s ease-out infinite;
}
/* 未綁定狀態時隱藏綠色 Badge */
.bank-unbound .mem-bound { display: none; }

/* ==========================================================================
   密碼卡 : 標題 + 說明 + 按鈕
   ========================================================================== */
.mem-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 6px 4px 0;
  flex-wrap: wrap;
}
.mem-inline .desc {
  font-size: 13.5px;
  color: #64748B;
  line-height: 1.55;
  max-width: 520px;
}
.mem-inline .desc b {
  color: var(--nx-ink-900);
  font-weight: 600;
}

/* Buttons ------------------------------------------------------------------- */
.mem-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
  border: 1px solid #E5E9F0;
  background: #fff;
  color: var(--nx-ink-800);
  font-family: inherit;
  letter-spacing: 0.01em;
  text-decoration: none;
  white-space: nowrap;
}
.mem-btn:hover {
  background: #F8FAFC;
  border-color: #CBD5E1;
  color: var(--nx-ink-900);
}
.mem-btn svg { width: 15px; height: 15px; }
.mem-btn.is-primary {
  background: linear-gradient(180deg, #2563EB 0%, #1D4ED8 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.24);
}
.mem-btn.is-primary:hover {
  background: linear-gradient(180deg, #1D4ED8 0%, #1E40AF 100%);
  color: #fff;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.30);
}
.mem-btn.is-danger {
  color: #B91C1C;
  border-color: #FCA5A5;
  background: #fff;
}
.mem-btn.is-danger:hover {
  background: #FEF2F2;
  border-color: #F87171;
  color: #991B1B;
}

/* ==========================================================================
   Empty state : 未綁定提領帳戶
   ========================================================================== */
.mem-empty {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 36px 20px 32px;
  border-top: 1px solid #F1F5F9;
  border-radius: 0;
  text-align: center;
}
.mem-empty .empty-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: #F1F5F9;
  color: #94A3B8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.mem-empty .empty-icon svg { width: 24px; height: 24px; }
.mem-empty .empty-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--nx-ink-800);
  margin-top: 2px;
}
.mem-empty .empty-desc {
  font-size: 13px;
  color: #94A3B8;
  line-height: 1.5;
  max-width: 320px;
}
.mem-empty .mem-btn { margin-top: 4px; }

/* 綁定 / 未綁定切換 */
.bank-bound   .mem-fields { display: flex; }
.bank-bound   .mem-empty  { display: none; }
.bank-unbound .mem-fields { display: none; }
.bank-unbound .mem-empty  { display: flex; }

/* ==========================================================================
   Logout row (最底部登出)
   ========================================================================== */
.mem-logout {
  display: flex;
  justify-content: center;
  padding: 8px 0 12px;
}

/* ==========================================================================
   Modal : 修改登入密碼
   ========================================================================== */
.mem-modal {
  position: fixed;
  inset: 0;
  background: rgba(11, 18, 32, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
  animation: mem-fade .2s ease-out;
}
.mem-modal.is-open { display: flex; }
@keyframes mem-fade { from { opacity: 0; } to { opacity: 1; } }

.mem-modal .modal-card {
  background: #fff;
  border-radius: 18px;
  width: 100%;
  max-width: 440px;
  padding: 26px 28px 22px;
  box-shadow: 0 30px 60px -20px rgba(37, 99, 235, 0.22), 0 12px 30px rgba(15, 23, 42, 0.10);
  animation: mem-pop .22s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes mem-pop {
  from { transform: translateY(10px) scale(0.98); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}
.mem-modal .modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
.mem-modal .modal-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--nx-ink-900);
  letter-spacing: -0.005em;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.mem-modal .modal-title .icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: rgba(37, 99, 235, 0.08);
  color: #2563EB;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.mem-modal .modal-title .icon svg { width: 16px; height: 16px; }
.mem-modal .modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 0;
  background: transparent;
  color: #94A3B8;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .15s ease, color .15s ease;
}
.mem-modal .modal-close:hover {
  background: #F1F5F9;
  color: var(--nx-ink-800);
}
.mem-modal .modal-desc {
  font-size: 13px;
  color: #64748B;
  line-height: 1.55;
  margin: 0 0 18px;
}

/* Form fields */
.mem-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 20px;
}
.mem-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mem-form .lbl {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--nx-ink-700);
}
.mem-form input {
  width: 100%;
  height: 42px;
  border: 1px solid #E5E9F0;
  background: #F8FAFC;
  border-radius: 10px;
  padding: 0 14px;
  font-size: 14px;
  color: var(--nx-ink-900);
  font-family: inherit;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
  outline: none;
}
.mem-form input:hover { border-color: #CBD5E1; }
.mem-form input:focus {
  background: #fff;
  border-color: #2563EB;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.10);
}
.mem-form .hint {
  font-size: 11.5px;
  color: #94A3B8;
  line-height: 1.4;
  padding-left: 2px;
}

.mem-modal .modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.mem-modal .modal-actions .mem-btn { min-width: 88px; justify-content: center; }

@media (max-width: 480px) {
  .mem-modal .modal-card { padding: 22px 20px 18px; border-radius: 16px; }
  .mem-modal .modal-title { font-size: 16px; }
  .mem-modal .modal-actions { flex-direction: column-reverse; }
  .mem-modal .modal-actions .mem-btn { width: 100%; }
}

/* ==========================================================================
   Responsive : mobile
   ========================================================================== */
@media (max-width: 620px) {
  .mem-field {
    grid-template-columns: 108px 1fr;
    gap: 12px;
    padding: 12px 2px;
  }
  .mem-field .label { font-size: 12.5px; }
  .mem-field .value { font-size: 14px; }
  .mem-field .value.mono { font-size: 13.5px; }
  .mem-inline { flex-direction: column; align-items: stretch; }
  .mem-inline .mem-btn { width: 100%; justify-content: center; }
  .mem-card-head { row-gap: 6px; }
}
