/* 晶体矿物学习平台 - 全局基础样式 */
/* 此文件通过 master.html 在所有页面引入 */
/* 注意：此文件的样式需要能够覆盖 Tailwind CSS 的重置样式 */

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

html {
  font-family: "Source Han Sans CN", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  /* 始终显示滚动条，防止页面内容因滚动条出现/消失而跳动 */
  overflow-y: scroll;
}

body {
  font-family: inherit;
  font-size: inherit;
  color: #333333;
  background-color: #F5F8FC;
  line-height: inherit;
}

/* 全局链接样式 - 使用更高优先级 */
a,
a:link,
a:visited {
  text-decoration: none;
  color: inherit;
  transition: color 0.3s ease;
}

a:hover,
a:focus {
  color: #2A5DAA;
}

/* 全局按钮样式 */
button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}

/* 表单元素样式 - 覆盖 Tailwind 重置 */
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  color: inherit;
}

/* 全局图片样式 */
img {
  max-width: 100%;
  height: auto;
}

/* 全局列表样式 */
ul, ol {
  list-style: none;
}

/* 主要内容区 */
.main-content {
  padding: 24px;
  max-width: 1600px;
  margin: 0 auto;
  min-height: calc(100vh - 200px);
}

/* 通用容器居中 - 补充 Tailwind container 类 */
.container {
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding-left: 24px;
  padding-right: 24px;
}

/* 通用卡片样式 */
.card {
  background: #FFFFFF;
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.3s, box-shadow 0.3s;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* 通用区块标题 */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.section-header h2 {
  font-size: 24px;
  color: #333333;
}

/* 通用"查看更多"链接 */
.more-link {
  color: #2A5DAA;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.more-link:hover {
  color: #1E4A8C;
}

/* 通用主题色按钮 */
.btn-primary {
  display: inline-block;
  padding: 10px 24px;
  background: #2A5DAA;
  color: #FFFFFF;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  transition: background-color 0.3s;
  text-decoration: none;
}

.btn-primary:hover {
  background: #1E4A8C;
  color: #FFFFFF;
}

/* 通用次要按钮 */
.btn-secondary {
  display: inline-block;
  padding: 10px 24px;
  background: transparent;
  color: #2A5DAA;
  border: 1px solid #2A5DAA;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s;
  text-decoration: none;
}

.btn-secondary:hover {
  background: #2A5DAA;
  color: #FFFFFF;
}

/* 通用标签样式 */
.tag {
  display: inline-block;
  padding: 4px 12px;
  background: rgba(42, 93, 170, 0.1);
  color: #2A5DAA;
  border-radius: 12px;
  font-size: 12px;
}

/* 通用难度标签 */
.difficulty {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 4px 12px;
  background: rgba(0, 0, 0, 0.6);
  color: #FFFFFF;
  border-radius: 12px;
  font-size: 12px;
}

/* 通用价格样式 */
.price {
  color: #FF6B6B;
  font-size: 16px;
  font-weight: bold;
}

/* 图片占位符 */
.img-placeholder {
  background-color: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.img-placeholder img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 延迟加载图片淡入效果 */
.lazy-load {
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}

.lazy-load[src] {
  opacity: 1;
}

/* 离线提示 */
.offline-message {
  background-color: #fff3cd;
  color: #856404;
  padding: 10px 20px;
  text-align: center;
  font-size: 14px;
  border-bottom: 1px solid #ffc107;
}

/* 面包屑导航 */
.breadcrumb {
  padding: 12px 0;
  font-size: 14px;
  color: #666;
}

.breadcrumb a {
  color: #2A5DAA;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

/* 分页样式 */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 24px;
}

.pagination a,
.pagination button {
  padding: 8px 16px;
  border: 1px solid #ddd;
  border-radius: 4px;
  color: #333;
  background: #fff;
  transition: all 0.3s;
}

.pagination a:hover,
.pagination button:hover {
  border-color: #2A5DAA;
  color: #2A5DAA;
}

.pagination .active {
  background: #2A5DAA;
  color: #fff;
  border-color: #2A5DAA;
}

/* 响应式工具类 */
@media screen and (max-width: 768px) {
  .main-content {
    padding: 16px;
  }
  
  .section-header h2 {
    font-size: 20px;
  }
}
