/* 个人中心 / 表单 / 弹窗 — 深色主题通用组件（对齐 yqyclient） */

:root {
  --primary-color: #ffd370;
  --secondary-color: #409eff;
  --text-color: #c0d4ff;
  --text-light: #8898bb;
  --border-color: rgba(255, 211, 112, 0.18);
  --bg-color: rgba(17, 26, 46, 0.85);
  --white: #fff;
  --danger-color: #f56c6c;
  --success-color: #67c23a;
  --warning-color: #e6a23c;
}

/* ---------- 个人中心布局 ---------- */
.user-center {
  display: flex;
  gap: 24px;
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 30px 0 50px;
}

.user-sidebar {
  width: 220px;
  flex-shrink: 0;
}

.user-main {
  flex: 1;
  min-width: 0;
}

.sidebar-menu {
  background: rgba(17, 26, 46, 0.75);
  border: 1px solid rgba(255, 211, 112, 0.12);
  border-radius: 12px;
  overflow: hidden;
}

.sidebar-menu a {
  display: block;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(255, 211, 112, 0.08);
  color: #c0d4ff;
  text-decoration: none;
  transition: all 0.25s;
  font-size: 14px;
}

.sidebar-menu a:last-child {
  border-bottom: none;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
  background: rgba(255, 211, 112, 0.08);
  color: #ffd370;
}

.page-header {
  background: rgba(17, 26, 46, 0.75);
  border: 1px solid rgba(255, 211, 112, 0.12);
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 20px;
}

.page-header h1 {
  font-size: 20px;
  font-weight: 600;
  color: #ffd370;
}

.page-header p {
  font-size: 14px;
  color: var(--text-light);
  margin-top: 6px;
}

/* ---------- 按钮 / 表单 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 24px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s;
  text-align: center;
  text-decoration: none;
  line-height: 1.4;
}

.btn-primary {
  background: linear-gradient(90deg, #ffb74d, #ffd370);
  color: #111;
}

.btn-primary:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(64, 158, 255, 0.2);
  border: 1px solid rgba(64, 158, 255, 0.45);
  color: #66b1ff;
}

.btn-outline {
  background: transparent;
  border: 1px solid rgba(255, 211, 112, 0.35);
  color: #ffd370;
}

.btn-outline:hover {
  background: rgba(255, 211, 112, 0.1);
}

.btn-danger {
  background: rgba(245, 108, 108, 0.2);
  border: 1px solid rgba(245, 108, 108, 0.45);
  color: #f56c6c;
}

.btn-small {
  padding: 6px 14px;
  font-size: 12px;
}

.btn-large {
  padding: 14px 32px;
  font-size: 16px;
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-color);
}

.form-control {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 14px;
  transition: border-color 0.25s;
  background: rgba(26, 37, 64, 0.85);
  color: #fff;
}

.form-control:focus {
  outline: none;
  border-color: rgba(255, 211, 112, 0.55);
}

.form-control:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

textarea.form-control {
  resize: vertical;
  min-height: 120px;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

/* ---------- 卡片 / 网格 ---------- */
.card {
  background: rgba(17, 26, 46, 0.75);
  border: 1px solid rgba(255, 211, 112, 0.12);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.25s, box-shadow 0.25s;
}

.card:hover {
  border-color: rgba(255, 211, 112, 0.22);
}

.card .card-body {
  padding: 20px;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: #ffd370;
  margin-bottom: 8px;
}

.card-text {
  font-size: 14px;
  color: var(--text-light);
}

.grid {
  display: grid;
  gap: 16px;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ---------- 商品网格 ---------- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.product-card {
  background: rgba(17, 26, 46, 0.75);
  border: 1px solid rgba(255, 211, 112, 0.12);
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.25s;
}

.product-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 211, 112, 0.28);
}

.product-image {
  width: 100%;
  height: 180px;
  object-fit: cover;
  display: block;
}

.product-info {
  padding: 14px;
}

.product-title {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-title a {
  color: #c0d4ff;
  text-decoration: none;
}

.product-title a:hover {
  color: #ffd370;
}

.product-price {
  font-size: 18px;
  font-weight: 600;
  color: #ffd370;
  margin-bottom: 6px;
}

.product-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-light);
}

/* ---------- 徽章 / 空状态 / 分页 ---------- */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
}

.badge-primary { background: rgba(64, 158, 255, 0.2); color: #66b1ff; }
.badge-success { background: rgba(103, 194, 58, 0.2); color: #85ce61; }
.badge-danger { background: rgba(245, 108, 108, 0.2); color: #f56c6c; }
.badge-warning { background: rgba(230, 162, 60, 0.2); color: #ebb563; }
.badge-default { background: rgba(136, 152, 187, 0.2); color: #8898bb; }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  background: rgba(17, 26, 46, 0.5);
  border: 1px dashed rgba(255, 211, 112, 0.15);
  border-radius: 12px;
}

.empty-state .icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.7;
}

.empty-state p {
  color: var(--text-light);
  margin-bottom: 20px;
}

.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 211, 112, 0.15);
  color: #c0d4ff;
  text-decoration: none;
  font-size: 14px;
}

.pagination a:hover {
  border-color: rgba(255, 211, 112, 0.4);
  color: #ffd370;
}

.pagination .current {
  background: rgba(255, 211, 112, 0.15);
  border-color: rgba(255, 211, 112, 0.35);
  color: #ffd370;
}

/* ---------- 标签页 ---------- */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid rgba(255, 211, 112, 0.12);
}

.tab-item {
  padding: 12px 24px;
  color: var(--text-light);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: all 0.25s;
  font-size: 14px;
}

.tab-item:hover,
.tab-item.active {
  color: #ffd370;
  border-bottom-color: #ffd370;
}

/* ---------- 弹窗 ---------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(4, 11, 27, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
  padding: 20px;
}

.modal.show {
  opacity: 1;
  visibility: visible;
}

.modal-dialog {
  background: rgba(17, 26, 46, 0.98);
  border: 1px solid rgba(255, 211, 112, 0.2);
  border-radius: 16px;
  width: 100%;
  max-width: 520px;
  overflow: hidden;
  transform: scale(0.95) translateY(10px);
  transition: transform 0.25s;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

.modal.show .modal-dialog {
  transform: scale(1) translateY(0);
}

.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid rgba(255, 211, 112, 0.12);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 18px;
  font-weight: 600;
  color: #ffd370;
}

.modal-close {
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: var(--text-light);
  background: none;
  border: none;
  padding: 0 4px;
}

.modal-close:hover {
  color: #ffd370;
}

.modal-body {
  padding: 22px;
}

.modal-footer {
  padding: 16px 22px;
  border-top: 1px solid rgba(255, 211, 112, 0.12);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ---------- 充值弹窗 ---------- */
.recharge-modal-step {
  display: none;
}

.recharge-modal-step.active {
  display: block;
}

.payment-methods {
  display: flex;
  gap: 12px;
}

.payment-method {
  flex: 1;
  padding: 14px;
  border: 2px solid rgba(255, 211, 112, 0.15);
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #c0d4ff;
  transition: all 0.25s;
}

.payment-method:has(input:checked) {
  border-color: #ffd370;
  background: rgba(255, 211, 112, 0.08);
}

.payment-method input {
  accent-color: #ffd370;
}

.js-recharge-open {
  cursor: pointer;
}

/* 充值弹窗紧凑布局，避免出现滚动条 */
#rechargeModal .modal-dialog {
  max-width: 460px;
}

#rechargeModal .modal-header {
  padding: 14px 18px;
}

#rechargeModal .modal-body {
  padding: 16px 18px;
}

#rechargeModal .modal-footer {
  padding: 12px 18px;
}

#rechargeModal .recharge-packages {
  gap: 10px;
  margin-bottom: 12px;
}

#rechargeModal .package-item {
  padding: 12px 8px;
}

#rechargeModal .package-credits .credits-num {
  font-size: 22px;
}

#rechargeModal .package-price {
  font-size: 17px;
}

#rechargeModal .recharge-tip {
  padding: 10px 12px;
  margin-bottom: 12px !important;
  font-size: 12px;
}

#rechargeModal .form-group {
  margin-bottom: 12px;
}

#rechargeModal .form-group label {
  margin-bottom: 6px;
  font-size: 13px;
}

#rechargeModal .form-control {
  padding: 10px 12px;
}

#rechargeModal .payment-method {
  padding: 10px 12px;
}

#rechargeModal .pay-amount {
  padding: 14px 16px;
  margin: 12px 0;
}

#rechargeModal .amount-value {
  font-size: 22px;
}

.recharge-qr-box {
  text-align: center;
  margin: 12px 0 16px;
  padding: 12px;
  background: #fff;
  border-radius: 12px;
  display: inline-block;
  width: 100%;
  box-sizing: border-box;
}

.recharge-qr-box img {
  display: block;
  margin: 0 auto;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  top: 90px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  background: rgba(17, 26, 46, 0.95);
  border: 1px solid rgba(255, 211, 112, 0.25);
  color: #fff;
  border-radius: 8px;
  font-size: 14px;
  z-index: 3000;
  animation: toastIn 0.3s ease;
}

.toast.success {
  border-color: rgba(103, 194, 58, 0.5);
  color: #85ce61;
}

.toast.error {
  border-color: rgba(245, 108, 108, 0.5);
  color: #f56c6c;
}

.toast.info {
  border-color: rgba(64, 158, 255, 0.5);
  color: #66b1ff;
}

@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, -10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

html.modal-open,
body.modal-open {
  overflow: hidden;
}

/* ---------- 个人中心补充 ---------- */
.user-stats-grid a.stat-card {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: border-color 0.25s, transform 0.25s;
}

.user-stats-grid a.stat-card:hover {
  border-color: rgba(255, 211, 112, 0.35);
  transform: translateY(-2px);
}

.credits-card .credits-btn {
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.user-profile-card {
  margin-bottom: 25px;
}

.user-main .user-stats-grid {
  margin-bottom: 0;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 12px;
}

/* ---------- 响应式 ---------- */
@media (max-width: 992px) {
  .product-grid,
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .user-center {
    flex-direction: column;
    width: 95%;
    padding-top: 20px;
  }

  .user-sidebar {
    width: 100%;
  }

  .sidebar-menu {
    display: flex;
    flex-wrap: wrap;
  }

  .sidebar-menu a {
    flex: 1 1 45%;
    border-bottom: none;
    border-right: 1px solid rgba(255, 211, 112, 0.08);
    text-align: center;
    padding: 12px 10px;
  }

  .product-grid,
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .payment-methods {
    flex-direction: column;
  }
}
