/* ===== 主题 CSS 变量（默认：暗色） ===== */
:root {
  --bg-primary: #1a1a2e;
  --bg-card: #242435;
  --bg-card-hover: #2a2a40;
  --text-primary: #e0e0e0;
  --text-secondary: #a0a0b8;
  --text-heading: #ffffff;
  --border-color: #333355;
  --accent-color: #409eff;
  --up-color: #f56c6c;
  --down-color: #67c23a;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
  --btn-bg: #333355;
  --btn-text: #a0a0b8;
  --btn-active-bg: #409eff;
  --btn-active-text: #ffffff;
  --header-text: #ffffff;
}

/* ===== 暗色主题 ===== */
body.theme-dark {
  --bg-primary: #1a1a2e;
  --bg-card: #242435;
  --bg-card-hover: #2a2a40;
  --text-primary: #e0e0e0;
  --text-secondary: #a0a0b8;
  --text-heading: #ffffff;
  --border-color: #333355;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
  --btn-bg: #333355;
  --btn-text: #a0a0b8;
  --btn-active-bg: #409eff;
  --btn-active-text: #ffffff;
  --header-text: #ffffff;
}

/* ===== 护眼暖色主题 ===== */
body.theme-warm {
  --bg-primary: #d2e9d3;
  --bg-card: #e8f5e9;
  --bg-card-hover: #dcedc8;
  --text-primary: #2c3e2d;
  --text-secondary: #5a7d5c;
  --text-heading: #1b3a1c;
  --border-color: #b8d4ba;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  --btn-bg: #c8e6c9;
  --btn-text: #4a6b4c;
  --btn-active-bg: #66bb6a;
  --btn-active-text: #ffffff;
  --header-text: #1b3a1c;
}

/* ===== 全局样式 ===== */
body {
  background-color: var(--bg-primary);
  margin: 0;
  padding: 0;
  transition: background-color 0.3s ease;
  min-height: 100vh;
}

#app {
  padding: 20px;
}

/* ===== 顶部标题栏 ===== */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.app-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--header-text);
  margin: 0;
  letter-spacing: 1px;
  transition: color 0.3s ease;
}

/* ===== 主题切换按钮组 ===== */
.theme-switcher {
  display: flex;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.theme-btn {
  padding: 8px 20px;
  font-size: 14px;
  border: none;
  cursor: pointer;
  background: var(--btn-bg);
  color: var(--btn-text);
  transition: all 0.25s ease;
  outline: none;
  font-family: inherit;
  letter-spacing: 0.5px;
}

.theme-btn:first-child {
  border-right: 1px solid var(--border-color);
}

.theme-btn.active {
  background: var(--btn-active-bg);
  color: var(--btn-active-text);
  font-weight: 600;
}

.theme-btn:hover:not(.active) {
  background: var(--bg-card-hover);
}

/* ===== Element UI 卡片覆盖 ===== */
.el-card {
  background-color: var(--bg-card) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 10px !important;
  color: var(--text-primary) !important;
  transition: all 0.3s ease !important;
  box-shadow: var(--shadow) !important;
}

.el-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35) !important;
}

body.theme-warm .el-card:hover {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12) !important;
}

.el-card__body {
  padding: 20px !important;
}

/* ===== 卡片内文字样式 ===== */
.text {
  font-size: 15px;
  line-height: 2;
  font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
  color: var(--text-primary);
  transition: color 0.3s ease;
}

/* ===== 股票名称加粗高亮 ===== */
.grid-content .text br:first-of-type {
  display: block;
}

/* 涨跌颜色标注 */
.text .up {
  color: var(--up-color);
  font-weight: 600;
}

.text .down {
  color: var(--down-color);
  font-weight: 600;
}

/* ===== 网格布局 ===== */
.el-row {
  margin-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
}

.el-row .el-card {
  min-width: 100%;
  height: 100%;
  margin-right: 20px;
  transition: all 0.3s ease;
}

.el-col {
  margin-bottom: 20px;
}

.item {
  padding: 0;
}

.box-card {
  width: 100%;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .app-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .app-title {
    font-size: 20px;
  }

  .text {
    font-size: 13px;
  }
}

/* ===== 删除模式 - 减号徽标 ===== */
.delete-badge {
  position: absolute;
  top: -8px;
  left: -8px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #ff3b30;
  color: #ff3b30;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: bold;
  cursor: pointer;
  z-index: 10;
  line-height: 1;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
  user-select: none;
}

.delete-badge:hover {
  transform: scale(1.2);
  background: #ff3b30;
  color: #fff;
}

/* 删除模式下卡片抖动效果 */
body.theme-dark .card-wrapper.card-shaking,
body.theme-warm .card-wrapper.card-shaking {
  animation: shake 0.3s ease-in-out infinite alternate;
}

@keyframes shake {
  0% { transform: rotate(-0.5deg); }
  100% { transform: rotate(0.5deg); }
}
