/*
 * DeepSeek 余额监控 PWA — 样式表
 *
 * 设计规范来源：文档/03-设计规范.md
 * 设计理念：深色科技风，一眼看到余额，简单克制
 */

/* ===== 基础重置 ===== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ===== 页面底色 ===== */
html, body {
  height: 100%;
  background-color: #0F0F1A;        /* 深蓝黑底色 */
  color: #FFFFFF;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  /* 用系统默认字体，加载最快、在各平台显示最自然 */
  -webkit-font-smoothing: antialiased;   /* 字体更清晰 */
  -moz-osx-font-smoothing: grayscale;
}

body {
  display: flex;
  justify-content: center;
  align-items: flex-start;           /* 卡片从顶部开始，不强制居中 */
  padding: 40px 16px;                /* 手机端留白 */
  min-height: 100vh;                 /* 保证至少占满一屏 */
}

/* ===== 卡片容器 ===== */
.card {
  width: 100%;
  max-width: 400px;                  /* 适配手机，但不无限拉宽 */
  min-width: 320px;
  background-color: #1A1A2E;         /* 卡片比底色稍亮，形成层次 */
  border: 1px solid #2A2A4A;         /* 微妙边框 */
  border-radius: 16px;               /* 圆角 */
  padding: 24px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  animation: cardSlideIn 0.4s ease-out; /* 首次加载从下滑入 */
}

@keyframes cardSlideIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== 卡片头部 ===== */
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.card-title {
  font-size: 14px;
  font-weight: 400;
  color: #9CA3AF;                    /* 灰色，不抢眼 */
  letter-spacing: 0.5px;
}

/* ===== 刷新按钮 ===== */
.refresh-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: #9CA3AF;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;         /* 悬停过渡 */
  /* 增大点击区域（对手机触屏友好） */
  -webkit-tap-highlight-color: transparent;
}

.refresh-btn:hover {
  color: #FFFFFF;
  background-color: rgba(255, 255, 255, 0.08);
}

.refresh-btn:active {
  transform: scale(0.9);             /* 按下时缩小，像真按钮 */
}

/* 加载中——图标旋转 */
.refresh-btn.loading .refresh-icon {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ===== 余额显示区 ===== */
.balance-section {
  text-align: center;
  margin-bottom: 20px;
}

.balance-currency {
  font-size: 20px;
  font-weight: 400;
  color: #9CA3AF;
  vertical-align: top;
  margin-right: 4px;
}

.balance-number {
  font-size: 56px;
  font-weight: 700;
  color: #FFFFFF;
  line-height: 1.1;
  /* 数字变化时的微动画 */
  transition: transform 0.3s ease-out;
}

/* 余额更新时短暂放大（JS 会临时加这个类） */
.balance-number.pulse {
  transform: scale(1.06);
}

/* 错误状态下余额显示 */
.balance-number.error {
  color: #F59E0B;                    /* 橙色 */
}

/* ===== 进度条 ===== */
.progress-section {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.progress-bar {
  flex: 1;
  height: 6px;
  background-color: #2A2A4A;         /* 底色（未使用部分） */
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background-color: #4F46E5;         /* 靛蓝色（已使用部分） */
  border-radius: 3px;
  transition: width 0.6s ease;       /* 数值变化时平滑过渡 */
  min-width: 0;
}

.progress-text {
  font-size: 13px;
  color: #9CA3AF;
  white-space: nowrap;
  min-width: 42px;
  text-align: right;
}

/* ===== 详情行 ===== */
.details {
  margin-bottom: 16px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);  /* 极淡分割线 */
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-label {
  font-size: 13px;
  color: #9CA3AF;
}

.detail-value {
  font-size: 13px;
  color: #FFFFFF;
  font-weight: 500;
}

/* 账户状态：可用=绿色 */
.detail-value.status-ok {
  color: #10B981;
}

/* 账户状态：不可用=红色 */
.detail-value.status-error {
  color: #EF4444;
}

/* ===== 错误提示 ===== */
.error-message {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background-color: rgba(245, 158, 11, 0.1);   /* 橙色半透明背景 */
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 8px;
  margin-bottom: 16px;
  animation: fadeIn 0.3s ease;
}

.error-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.error-text {
  font-size: 13px;
  color: #F59E0B;
  line-height: 1.4;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ===== 刷新时间 ===== */
.refresh-time {
  text-align: center;
  font-size: 12px;
  color: #6B7280;                    /* 比次要文字更淡 */
}

/* ===== 响应式适配 ===== */

/* 小屏手机（< 360px） */
@media (max-width: 359px) {
  body {
    padding: 16px 8px;
  }

  .card {
    padding: 20px 16px;
    border-radius: 12px;
  }

  .balance-number {
    font-size: 44px;
  }

  .balance-currency {
    font-size: 18px;
  }
}

/* 大屏 / 桌面端 */
@media (min-width: 768px) {
  body {
    align-items: center;             /* 大屏时卡片垂直居中 */
    background: linear-gradient(135deg, #0F0F1A 0%, #1A1A3E 100%);
  }
}
