/* 全局样式 */
:root {
  --primary-color: #1890ff;
  --secondary-color: #52c41a;
  --background-color: #f0f2f5;
  --card-background: rgba(255, 255, 255, 0.9);
  --text-color: #333;
  --header-footer-bg: rgba(240, 242, 245, 0.9);
  --sidebar-bg: rgba(255, 255, 255, 0.8);
  --card-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  --transition-time: 0.3s;
}

/* 暗色模式 */
body.dark-theme {
  --primary-color: #177ddc;
  --secondary-color: #49aa19;
  --background-color: #141414;
  --card-background: rgba(30, 30, 30, 0.9);
  --text-color: #fff;
  --header-footer-bg: rgba(20, 20, 20, 0.9);
  --sidebar-bg: rgba(30, 30, 30, 0.8);
  --card-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.3);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
  color: var(--text-color);
  background-color: var(--background-color);
  transition: background-color var(--transition-time), color var(--transition-time);
  min-height: 100vh;
  overflow-x: hidden;
}

#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
}

/* 隐藏Vue实例化前的内容 */
[v-cloak] {
  display: none;
}

/* 顶部导航栏 */
.app-header {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background-color: var(--header-footer-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  position: relative;
  z-index: 100;
  transition: background-color var(--transition-time);
}

.logo-container {
  display: flex;
  align-items: center;
}

.logo {
  height: 40px;
  width: auto;
  margin-right: 10px;
  object-fit: contain;
}

.logo-container h1 {
  font-size: 20px;
  font-weight: 600;
}

.datetime-container {
  font-size: 16px;
  font-weight: 500;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.theme-switch {
  margin-left: 4px;
}

.help-button {
  font-size: 16px;
}

/* 主容器 */
.main-container {
  display: flex;
  flex-grow: 1;
  position: relative;
}

/* 侧边栏 */
.sidebar {
  width: 220px;
  background-color: var(--sidebar-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: background-color var(--transition-time), width var(--transition-time);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  z-index: 50;
}

.sidebar-menu {
  height: 100%;
  border-right: none;
  background-color: transparent;
}

/* 主内容区域 */
.content {
  flex-grow: 1;
  padding: 20px;
  overflow-y: auto;
  transition: margin-left var(--transition-time);
}

/* 工具容器 */
.tool-container {
  max-width: 1200px;
  margin: 0 auto;
}

.tool-container h2 {
  margin-bottom: 20px;
  font-weight: 600;
}

/* 卡片网格 */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.heat-grid {
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
}

.tool-card {
  background-color: var(--card-background);
  border-radius: 8px;
  box-shadow: var(--card-shadow);
  transition: all var(--transition-time);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  height: 100%;
}

.tool-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-header h3 {
  font-size: 18px;
  font-weight: 500;
  margin: 0;
}

.card-content {
  padding: 10px 0;
  min-height: 200px;
}

.history-card {
  grid-column: 1 / -1;
}

.result-display {
  padding: 15px;
  border-radius: 5px;
  background-color: rgba(var(--primary-color-rgb), 0.1);
  margin-top: 10px;
}

.result-display h4 {
  margin-bottom: 10px;
  color: var(--primary-color);
}

.empty-result {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 150px;
  color: #999;
}

.pagination-container {
  margin-top: 20px;
  display: flex;
  justify-content: center;
}

/* 底部状态栏 */
.app-footer {
  height: 40px;
  display: flex;
  align-items: center;
  padding: 0 20px;
  background-color: var(--header-footer-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
  position: relative;
  z-index: 100;
  transition: background-color var(--transition-time);
}

/* 动态背景 */
.background-effect {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
}

.background-effect::before,
.background-effect::after {
  content: '';
  position: absolute;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
  opacity: 0.2;
  filter: blur(40px);
  animation: float 15s infinite alternate;
}

.background-effect::before {
  top: 20%;
  left: 20%;
  animation-duration: 20s;
}

.background-effect::after {
  bottom: 20%;
  right: 20%;
  animation-duration: 25s;
  animation-delay: 5s;
}

@keyframes float {
  0% {
    transform: translate(0, 0);
  }
  100% {
    transform: translate(80px, 50px) rotate(180deg);
  }
}

/* 响应式设计 */
@media screen and (max-width: 768px) {
  .sidebar {
    width: 64px;
  }
  
  .card-grid {
    grid-template-columns: 1fr;
  }
}

/* 元素组件样式覆盖 */
.el-button--primary {
  background-color: var(--primary-color);
}

.el-menu {
  border-right: none;
}

/* 帮助对话框样式 */
.help-content {
  max-height: 70vh;
  overflow-y: auto;
  padding: 0 10px;
}

.help-content h3 {
  margin-bottom: 16px;
  color: var(--primary-color);
}

.help-content p {
  margin: 12px 0 12px 20px;
  line-height: 1.6;
}

.help-content p .el-icon {
  vertical-align: middle;
  margin-right: 5px;
}

.help-content .theme-info {
  display: flex;
  align-items: center;
  margin-left: 20px;
}

.help-content ul {
  padding-left: 32px;
  margin: 12px 0 12px 20px;
}

.help-content pre {
  background-color: rgba(0, 0, 0, 0.05);
  padding: 12px;
  border-radius: 4px;
  margin: 12px 0 12px 20px;
  font-family: monospace;
  white-space: pre-wrap;
}

.help-content .el-divider__text {
  font-weight: bold;
  color: var(--primary-color);
}

.help-content .el-collapse {
  margin: 16px 0 16px 20px;
}

.help-content .el-collapse-item__header {
  font-weight: 500;
  font-size: 16px;
}

.help-content .el-collapse-item__content {
  padding-left: 10px;
}

/* LaTeX 公式样式 */
.formula-container {
  margin: 15px 0 15px 30px;
  padding: 15px;
  background-color: rgba(0, 0, 0, 0.03);
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
}

.formula {
  margin: 15px 0;
  font-size: 1.3em;
  overflow-x: auto;
  text-align: center;
  line-height: 1.8;
  padding: 5px 0;
}

/* 确保公式不会太宽导致溢出 */
.katex-display {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 5px 0;
}

/* 深色模式下公式背景调整 */
body.dark-theme .formula-container {
  background-color: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

/* 确保公式在深色模式下的可见性 */
body.dark-theme .katex {
  color: rgba(255, 255, 255, 0.9);
}

.dialog-footer {
  display: flex;
  justify-content: flex-end;
  padding-top: 16px;
}
