/* ========================================
   攒股吃息 — 浅色投资风格主题
   ======================================== */

/* CSS 变量 */
:root {
  --bg-primary: #f8f9fb;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #fafbfc;
  --bg-input: #f4f5f7;
  --border-color: #e5e7eb;
  --border-light: #d1d5db;

  --text-primary: #1a1d29;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;

  --accent-gold: #d4a00a;
  --accent-gold-light: #f0b90b;
  --accent-gold-bg: rgba(240, 185, 11, 0.08);
  --accent-blue: #3b82f6;
  --accent-green: #10b981;
  --accent-red: #ef4444;
  --accent-purple: #8b5cf6;

  --gradient-gold: linear-gradient(135deg, #d4a00a 0%, #f0b90b 100%);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.1);
  --shadow-gold: 0 4px 16px rgba(240, 185, 11, 0.15);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 全局重置 */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
    'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent-gold);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--accent-gold-light);
}

::selection {
  background: rgba(240, 185, 11, 0.2);
  color: var(--text-primary);
}

/* 滚动条 */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ========================================
   导航栏
   ======================================== */
.navbar {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 0 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.navbar .logo {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent-gold);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.navbar .logo i {
  color: var(--accent-gold-light);
}

.navbar .nav-links {
  display: flex;
  gap: 0.25rem;
  list-style: none;
}

.navbar .nav-links a {
  color: var(--text-secondary);
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  font-size: 0.9rem;
}

.navbar .nav-links a:hover {
  color: var(--text-primary);
  background: var(--accent-gold-bg);
}

.navbar .user-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* 移动端汉堡菜单 */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.5rem;
}

/* ========================================
   容器
   ======================================== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* ========================================
   卡片
   ======================================== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.card-header i {
  color: var(--accent-gold);
  font-size: 0.95rem;
}

/* ========================================
   统计卡片网格
   ======================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  text-align: center;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-gold);
  opacity: 0;
  transition: var(--transition);
}

.stat-card:hover {
  border-color: var(--accent-gold-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-gold);
}

.stat-card:hover::before {
  opacity: 1;
}

.stat-card .stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.75rem;
  font-size: 1.1rem;
}

.stat-card .stat-icon.gold { background: rgba(240, 185, 11, 0.1); color: var(--accent-gold); }
.stat-card .stat-icon.blue { background: rgba(59, 130, 246, 0.1); color: var(--accent-blue); }
.stat-card .stat-icon.green { background: rgba(16, 185, 129, 0.1); color: var(--accent-green); }
.stat-card .stat-icon.red { background: rgba(239, 68, 68, 0.1); color: var(--accent-red); }
.stat-card .stat-icon.purple { background: rgba(139, 92, 246, 0.1); color: var(--accent-purple); }

.stat-card .stat-value {
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
  font-variant-numeric: tabular-nums;
}

.stat-card .stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ========================================
   按钮
   ======================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  line-height: 1.5;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--gradient-gold);
  color: #fff;
  box-shadow: 0 2px 8px rgba(212, 160, 10, 0.2);
}

.btn-primary:hover {
  box-shadow: 0 4px 14px rgba(212, 160, 10, 0.35);
  color: #fff;
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  border-color: var(--border-light);
  background: var(--bg-card-hover);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.08);
  color: var(--accent-red);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.15);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 0.5rem;
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: var(--bg-input);
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 0.875rem 2rem;
  font-size: 1rem;
}

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: var(--radius-sm);
}

.btn .spinner {
  width: 16px;
  height: 16px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* ========================================
   表单
   ======================================== */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.7rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: var(--transition);
  font-family: inherit;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-muted);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent-gold-light);
  box-shadow: 0 0 0 3px rgba(240, 185, 11, 0.1);
  background: #fff;
}

.form-group select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%239ca3af' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

/* ========================================
   表格
   ======================================== */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

table th {
  background: var(--bg-primary);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

table th:first-child {
  border-radius: var(--radius-sm) 0 0 0;
}

table th:last-child {
  border-radius: 0 var(--radius-sm) 0 0;
}

table td {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.875rem;
  vertical-align: middle;
}

table tbody tr {
  transition: var(--transition);
}

table tbody tr:hover {
  background: var(--accent-gold-bg);
}

table tbody tr:last-child td {
  border-bottom: none;
}

/* 表格内输入框 */
table input[type="number"] {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 0.35rem 0.5rem;
  font-size: 0.825rem;
  width: 85px;
  transition: var(--transition);
}

table input[type="number"]:focus {
  outline: none;
  border-color: var(--accent-gold-light);
  box-shadow: 0 0 0 2px rgba(240, 185, 11, 0.1);
  background: #fff;
}

/* ========================================
   收益颜色
   ======================================== */
.positive {
  color: var(--accent-green) !important;
}

.negative {
  color: var(--accent-red) !important;
}

/* ========================================
   模态框
   ======================================== */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  padding: 1rem;
}

.modal.active {
  display: flex;
  animation: fadeIn 0.2s ease;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-header h2 i {
  color: var(--accent-gold);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.modal-close:hover {
  color: var(--text-primary);
  background: var(--bg-input);
}

/* ========================================
   提示消息
   ======================================== */
.alert {
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: slideDown 0.3s ease;
}

.alert-success {
  background: rgba(16, 185, 129, 0.08);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.alert-error {
  background: rgba(239, 68, 68, 0.08);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-info {
  background: rgba(59, 130, 246, 0.08);
  color: #2563eb;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

/* ========================================
   加载动画
   ======================================== */
.loading-spinner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.spinner-ring {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-top-color: var(--accent-gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

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

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

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========================================
   搜索下拉
   ======================================== */
.search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  max-height: 220px;
  overflow-y: auto;
  z-index: 50;
  box-shadow: var(--shadow-lg);
  display: none;
}

.search-dropdown.active {
  display: block;
  animation: slideDown 0.2s ease;
}

.search-item {
  padding: 0.7rem 1rem;
  cursor: pointer;
  transition: var(--transition);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.search-item:hover {
  background: var(--accent-gold-bg);
}

.search-item .stock-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.search-item .symbol {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 0.9rem;
}

.search-item .name {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.search-item .market {
  font-size: 0.7rem;
  color: var(--accent-gold);
  background: var(--accent-gold-bg);
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-weight: 500;
  white-space: nowrap;
}

/* ========================================
   认证页面（登录/注册）
   ======================================== */
.auth-container {
  max-width: 420px;
  margin: 4rem auto;
}

.auth-container .card {
  padding: 2rem;
}

.auth-container .card-header {
  text-align: center;
  justify-content: center;
  font-size: 1.2rem;
  margin-bottom: 1.5rem;
}

.auth-container .btn {
  width: 100%;
  padding: 0.75rem;
}

.auth-container .auth-link {
  text-align: center;
  margin-top: 1.25rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* ========================================
   仪表板
   ======================================== */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.dashboard-header h1 {
  font-size: 1.4rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dashboard-header h1 i {
  color: var(--accent-gold);
}

.dashboard-actions {
  display: flex;
  gap: 0.75rem;
}

/* ========================================
   首页 Hero
   ======================================== */
.hero {
  text-align: center;
  padding: 4rem 1rem 2.5rem;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--accent-gold-bg);
  border: 1px solid rgba(240, 185, 11, 0.2);
  color: var(--accent-gold);
  padding: 0.375rem 1rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
  margin-bottom: 1.5rem;
}

.hero h1 {
  font-size: 2.75rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.hero h1 .highlight {
  background: var(--gradient-gold);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 480px;
  margin: 0 auto 2rem;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.25rem;
  margin-top: 3rem;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: var(--transition);
  text-align: left;
  box-shadow: var(--shadow-sm);
}

.feature-card:hover {
  border-color: var(--accent-gold-light);
  transform: translateY(-3px);
  box-shadow: var(--shadow-gold);
}

.feature-card .feature-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  margin-bottom: 0.875rem;
}

.feature-card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.375rem;
  color: var(--text-primary);
}

.feature-card p {
  font-size: 0.825rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ========================================
   页脚
   ======================================== */
.footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 3rem;
}

/* ========================================
   空状态
   ======================================== */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 3rem;
  margin-bottom: 1rem;
  color: var(--border-light);
}

.empty-state p {
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

/* ========================================
   股票标签
   ======================================== */
.stock-symbol {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 0.9rem;
}

.stock-name {
  color: var(--text-secondary);
  font-size: 0.8rem;
}

/* ========================================
   持仓操作按钮
   ======================================== */
.holding-actions {
  display: flex;
  gap: 0.375rem;
  flex-wrap: wrap;
  align-items: center;
}

.holding-actions .btn {
  white-space: nowrap;
}

/* ========================================
   响应式
   ======================================== */
@media (max-width: 768px) {
  .navbar {
    padding: 0 1rem;
    flex-wrap: wrap;
    height: auto;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
  }

  .menu-toggle {
    display: block;
  }

  .navbar .nav-links {
    display: none;
    width: 100%;
    flex-direction: column;
    gap: 0.25rem;
    padding-top: 0.5rem;
  }

  .navbar .nav-links.active {
    display: flex;
  }

  .navbar .nav-links a {
    padding: 0.625rem 0.75rem;
  }

  .container {
    padding: 1rem;
  }

  .hero h1 {
    font-size: 1.85rem;
  }

  .hero p {
    font-size: 0.95rem;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  .stat-card .stat-value {
    font-size: 1.3rem;
  }

  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
  }

  /* 移动端卡片式表格 */
  .table-responsive table thead {
    display: none;
  }

  .table-responsive table,
  .table-responsive table tbody,
  .table-responsive table tr,
  .table-responsive table td {
    display: block;
    width: 100%;
  }

  .table-responsive table tr {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 0.75rem;
    box-shadow: var(--shadow-sm);
  }

  .table-responsive table td {
    border: none;
    padding: 0.3rem 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
  }

  .table-responsive table td::before {
    content: attr(data-label);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 500;
  }

  .modal-content {
    padding: 1.25rem;
    margin: 0.5rem;
  }

  .features-grid {
    grid-template-columns: 1fr;
  }

  .hero-actions {
    flex-direction: column;
    align-items: center;
  }

  .hero-actions .btn {
    width: 100%;
    max-width: 280px;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== 个人中心页面 ===== */
.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 1.5rem;
}

.profile-info {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-light);
}

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

.info-label {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.info-value {
  font-weight: 600;
  color: var(--text-primary);
}

.btn-danger {
  background: var(--accent-red);
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
}

/* 验证码输入 */
.code-input {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.code-input input {
  flex: 1;
  min-width: 0;
}

.code-input .btn {
  width: auto !important;
  padding: 0 14px;
  font-size: 0.82rem;
  flex-shrink: 0;
}

.code-input .btn:disabled {
  opacity: 0.5;
}

/* 响应式 */
@media (max-width: 768px) {
  .profile-grid {
    grid-template-columns: 1fr;
  }
}
