/* ========================== 头部导航栏样式 ========================== */
/* 头部样式 */
.head {
  background: linear-gradient(135deg, #e63946, #c1121f);
  border-bottom: none;
  padding: 20px 0;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  position: sticky;
  top: 0;
  z-index: 100;
}

.hline {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.hleft {
  display: flex;
  align-items: center;
  gap: 20px;
}

.hleft span:first-child {
  font-size: 32px;
  font-weight: 800;
  color: #fff3cd;
  text-shadow: 2px 2px 6px rgba(0,0,0,0.4);
  font-family: 'Arial Black', 'Microsoft YaHei', sans-serif;
  letter-spacing: 2px;
  text-transform: uppercase;
  background: linear-gradient(45deg, #fff3cd, #ffd93d);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hleft span:last-child {
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  text-shadow: 2px 2px 6px rgba(0,0,0,0.4);
  font-family: 'Microsoft YaHei', 'Arial', sans-serif;
  letter-spacing: 3px;
  padding: 5px 15px;
  background: rgba(255,255,255,0.15);
  border-radius: 25px;
  border: 1px solid rgba(255,255,255,0.3);
  white-space: nowrap;
}

.hright {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-shrink: 0;
}

.hright a {
  color: #fff;
  text-decoration: none;
  font-size: 16px;
  font-weight: 600;
  transition: all 0.3s ease;
  padding: 8px 16px;
  border-radius: 25px;
  text-shadow: 1px 1px 3px rgba(0,0,0,0.3);
  font-family: 'Microsoft YaHei', 'Arial', sans-serif;
  letter-spacing: 1px;
  position: relative;
  overflow: hidden;
  white-space: nowrap;
  flex-shrink: 0;
}

.hright a::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.6s ease;
}

.hright a:hover::before {
  left: 100%;
}

.hright a:hover {
  background: rgba(255,255,255,0.25);
  transform: translateY(-4px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.25);
  color: #fff3cd;
}

/* ========================== 样式重置 (Reset) ========================== */
/* 清除默认边距、内边距，统一盒模型 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent; /* 清除移动端点击高亮 */
}

/* 统一body字体、行高、背景色，防止页面溢出 */
body {
  font-family: "Microsoft Yahei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: #333;
  background-color: #fff;
  overflow-x: hidden;
}

/* 清除列表默认样式 */
ul, ol, li {
  list-style: none;
}

/* 清除链接默认样式 */
a {
  text-decoration: none;
  color: #333;
  transition: color 0.2s ease; /* 过渡动画 */
}
a:hover {
  color: #0066cc;
}

/* 统一图片样式 */
img {
  display: block;
  max-width: 100%;
  height: auto;
  border: none;
}

/* 清除表单元素默认样式 */
input, button, textarea, select {
  font-family: inherit;
  font-size: inherit;
  border: none;
  outline: none;
  background: transparent;
}

/* 清除浮动 (优化版：移除IE6/7兼容) */
.clearfix::after {
  content: "";
  display: block;
  clear: both;
  height: 0;
  visibility: hidden;
}

/* ========================== 通用布局类 ========================== */
/* 容器：居中、限制最大宽度 */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 15px;
}

/* 弹性布局 - 水平居中 */
.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 弹性布局 - 水平两端对齐 */
.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* 弹性布局 - 垂直列排列 */
.flex-column {
  display: flex;
  flex-direction: column;
}

/* 块级元素水平居中 */
.m-auto {
  margin-left: auto;
  margin-right: auto;
}

/* ========================== 常用工具类 ========================== */
/* 隐藏元素 (视觉+屏幕阅读器) */
.hide {
  display: none !important;
}

/* 视觉隐藏 (保留屏幕阅读器可访问) */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* 文本溢出省略 (单行) - 通用兼容 */
.text-ellipsis {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 文本溢出省略 (多行) - 优化版（兼容webkit+Firefox降级） */
.text-ellipsis-multi {
  /* Webkit/Chrome/Safari/Edge 优先 */
  display: -webkit-box;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  /* Firefox 12+ 兼容（需固定高度） */
  display: -moz-box;
  -moz-box-orient: vertical;
  /* 通用基础设置 */
  overflow: hidden;
  line-height: 1.5; /* 固定行高，便于计算高度 */
  max-height: 3em; /* 2行 * 1.5行高 = 3em，Firefox降级方案 */
}

/* 光标样式 */
.cursor-pointer {
  cursor: pointer;
}

/* ========================== 响应式基础 ========================== */
/* 平板端适配 (768px - 1024px) */
@media (max-width: 1024px) {
  /* 平板端容器调整 */
  .container {
    max-width: 95%;
    padding: 0 20px;
  }
  
  /* 平板端导航栏调整 */
  .head {
    padding: 12px 0;
  }
  
  .hline {
    padding: 0 15px;
  }
  
  .hleft span:first-child {
    font-size: 28px;
  }
  
  .hleft span:last-child {
    font-size: 20px;
    padding: 4px 12px;
  }
  
  .hright {
    gap: 12px;
  }
  
  .hright a {
    font-size: 14px;
    padding: 6px 12px;
  }
  
  /* 平板端按钮调整 */
  .btn {
    padding: 8px 16px;
    font-size: 14px;
  }
  
  /* 平板端标题调整 */
  h1 {
    font-size: 24px;
  }
  
  h2 {
    font-size: 20px;
  }
  
  h3 {
    font-size: 18px;
  }
  
  /* 平板端内容区域调整 */
  .main-content {
    padding: 15px;
  }
  
  /* 平板端弹性布局调整 */
  .flex-between {
    flex-wrap: wrap;
    gap: 10px;
  }
  
  .flex-center {
    flex-wrap: wrap;
    gap: 10px;
  }
  
  /* 平板端表单元素调整 */
  input, button, textarea, select {
    font-size: 14px;
  }
  
  /* 平板端卡片样式调整 */
  .card {
    margin-bottom: 20px;
    padding: 15px;
  }
}

/* 手机端适配 (768px以下) */
@media (max-width: 768px) {
  /* 手机端容器调整 */
  .container {
    max-width: 100%;
    padding: 0 15px;
  }
  
  /* 手机端隐藏 */
  .hide-mobile {
    display: none !important;
  }
  
  /* 手机端多行省略调整行数 */
  .text-ellipsis-multi {
    line-clamp: 1;
    max-height: 1.5em;
  }
  
  /* 手机端导航栏调整 */
  .head {
    padding: 10px 0;
  }
  
  .hline {
    flex-direction: column;
    gap: 10px;
    padding: 0 10px;
    align-items: center;
  }
  
  .hleft {
    justify-content: center;
    gap: 10px;
  }
  
  .hleft span:first-child {
    font-size: 24px;
  }
  
  .hleft span:last-child {
    font-size: 16px;
    padding: 3px 10px;
  }
  
  .hright {
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    width: 100%;
    max-width: 400px;
  }
  
  .hright a {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 15px;
    flex: 1 1 80px;
    text-align: center;
  }
  
  /* 手机端按钮调整 */
  .btn {
    padding: 6px 12px;
    font-size: 14px;
    width: 100%;
    max-width: 260px;
    margin: 0 auto;
  }
  
  .btn-block {
    padding: 8px;
  }
  
  /* 手机端标题调整 */
  h1 {
    font-size: 18px;
    text-align: center;
    margin-bottom: 8px;
  }
  
  h2 {
    font-size: 16px;
    text-align: center;
    margin-bottom: 6px;
  }
  
  h3 {
    font-size: 15px;
    text-align: center;
    margin-bottom: 5px;
  }
  
  /* 手机端内容区域调整 */
  .main-content {
    padding: 6px;
  }
  
  /* 手机端表单调整 */
  .form-group {
    margin-bottom: 10px;
  }
  
  .form-control {
    height: 38px;
    font-size: 14px;
    padding: 0 12px;
  }
  
  /* 手机端卡片调整 */
  .info-card {
    padding: 10px;
    margin-bottom: 10px;
  }
  
  /* 手机端网格布局调整 */
  .post-list {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  
  /* 手机端按钮容器调整 */
  .post-button-container {
    flex-direction: column;
    gap: 6px;
    align-items: center;
  }
  
  /* 手机端排序选项调整 */
  .sort-options {
    padding: 10px;
  }
  
  .sort-options span {
    display: block;
    margin-bottom: 6px;
    text-align: center;
  }
  
  .sort-btn {
    margin: 3px;
    padding: 5px 12px;
    font-size: 12px;
  }
  
  /* 手机端弹性布局调整 */
  .flex-between {
    flex-direction: column;
    align-items: center;
    gap: 6px;
  }
  
  .flex-center {
    flex-direction: column;
    gap: 6px;
  }
  
  /* 手机端表单元素调整 */
  input, button, textarea, select {
    font-size: 14px;
    width: 100%;
  }
  
  /* 手机端卡片样式调整 */
  .card {
    margin-bottom: 10px;
    padding: 8px;
  }
}

@media (min-width: 769px) {
  /* 桌面端隐藏 */
  .hide-pc {
    display: none !important;
  }
}

/* ========================== 通用动画 (可选) ========================== */
/* 淡入动画 */
.fade-in {
  animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ========================== 按钮样式 ========================== */
/* 主按钮样式 */
.btn {
  display: inline-block;
  padding: 10px 20px;
  font-size: 16px;
  font-weight: 500;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}

/* 主按钮 - 蓝色 */
.btn-primary {
  background-color: #0088ff;
  color: white;
}

.btn-primary:hover {
  background-color: #0066cc;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 136, 255, 0.3);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(0, 136, 255, 0.3);
}

/* 次要按钮 - 灰色 */
.btn-secondary {
  background-color: #f5f5f5;
  color: #333;
  border: 1px solid #ddd;
}

.btn-secondary:hover {
  background-color: #e8e8e8;
  border-color: #ccc;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn-secondary:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* 全宽按钮 */
.btn-block {
  display: block;
  width: 100%;
  padding: 12px;
}

/* ========================================================================
   移动端紧凑化样式（全局）
   适用范围：手机端（<=768px）所有页面的按钮、间距、内容排布
   设计原则：按钮缩小为可点击即可，间距更紧凑，内容更密集
   ======================================================================== */
@media (max-width: 768px) {
  /* ---------- 按钮紧凑化 ---------- */
  /* 通用按钮：更小的padding和字号 */
  .btn,
  .btn-block,
  button:not(.theme-toggle):not(.hamburger):not(.lang-switch button) {
    padding: 5px 10px !important;
    font-size: 13px !important;
    border-radius: 6px !important;
    line-height: 1.4 !important;
  }

  /* 按钮不再强制全宽 - 允许并排显示 */
  .btn {
    width: auto !important;
    max-width: none !important;
    margin: 0 !important;
  }

  .btn-block {
    padding: 7px !important;
    width: 100%;
  }

  /* 操作按钮组（点赞/评论/收藏/编辑/删除等）紧凑排列 */
  .post-actions,
  .post-button-container,
  .action-buttons,
  .form-actions {
    flex-direction: row !important;
    flex-wrap: wrap !important;
    gap: 5px !important;
    align-items: center !important;
    justify-content: flex-start !important;
  }

  .post-actions button,
  .post-actions .action-btn,
  .post-actions a,
  .post-button-container button,
  .post-button-container a {
    flex: 0 1 auto !important;
    width: auto !important;
    padding: 5px 10px !important;
    font-size: 13px !important;
    margin: 0 !important;
  }

  /* 搜索按钮紧凑化 */
  .search-btn,
  .search-box button {
    padding: 5px 12px !important;
    font-size: 13px !important;
  }

  /* 卡片内按钮（如作品集"查看详情"）紧凑化 */
  .card-btn,
  .visit-btn,
  .card .btn {
    padding: 5px 12px !important;
    font-size: 13px !important;
    border-radius: 5px !important;
  }

  /* ---------- 间距紧凑化 ---------- */
  /* 主内容区域更小padding */
  .main-content {
    padding: 6px !important;
  }

  /* 卡片更小内边距和下边距 */
  .card,
  .info-card,
  .post-item,
  .portfolio-card {
    padding: 10px !important;
    margin-bottom: 8px !important;
  }

  /* 各模块上下间距更紧凑 */
  .profile-container > div,
  .section,
  .module {
    margin-bottom: 14px !important;
    padding-bottom: 10px !important;
  }

  /* 表单分组间距 */
  .form-group {
    margin-bottom: 8px !important;
  }

  /* ---------- 标题紧凑化 ---------- */
  h1 {
    font-size: 17px !important;
    margin-bottom: 6px !important;
  }

  h2 {
    font-size: 15px !important;
    margin-bottom: 5px !important;
  }

  h3 {
    font-size: 14px !important;
    margin-bottom: 4px !important;
  }

  /* ---------- 导航紧凑化 ---------- */
  .head {
    padding: 5px 0 !important;
  }

  .hline {
    gap: 5px !important;
    padding: 0 8px !important;
  }

  .hright {
    gap: 4px !important;
  }

  .hright a {
    padding: 3px 8px !important;
    font-size: 11px !important;
    border-radius: 10px !important;
    flex: 1 1 60px !important;
  }

  /* ---------- 表单元素紧凑化 ---------- */
  .form-control,
  input[type="text"],
  input[type="password"],
  input[type="email"],
  input[type="file"],
  textarea,
  select {
    padding: 6px 10px !important;
    font-size: 13px !important;
    height: auto !important;
  }

  textarea {
    min-height: 60px !important;
  }

  /* ---------- 图片/头像紧凑化 ---------- */
  .avatar {
    width: 50px !important;
    height: 50px !important;
  }

  /* ---------- 帖子元信息紧凑化 ---------- */
  .post-meta {
    font-size: 11px !important;
    gap: 6px !important;
  }

  /* ---------- 弹窗按钮紧凑化 ---------- */
  .modal button,
  .modal-footer button,
  [class*="modal"] button {
    padding: 5px 12px !important;
    font-size: 13px !important;
  }

  /* ---------- 返回按钮紧凑化（覆盖内联样式） ---------- */
  button[onclick*="goBack"],
  button[onclick*="history.back"],
  .back-btn,
  .back-link {
    padding: 5px 12px !important;
    font-size: 13px !important;
    border-radius: 15px !important;
  }
}

/* 超小屏幕（<=480px）进一步紧凑化 */
@media (max-width: 480px) {
  /* 按钮、链接更紧凑 */
  .btn,
  button:not(.theme-toggle):not(.hamburger):not(.lang-switch button) {
    padding: 4px 8px !important;
    font-size: 12px !important;
  }

  .hright a {
    padding: 3px 6px !important;
    font-size: 10px !important;
    flex: 1 1 50px !important;
  }

  /* 卡片padding更小 */
  .card,
  .post-item,
  .portfolio-card {
    padding: 8px !important;
  }

  /* 标题更小 */
  h1 { font-size: 16px !important; }
  h2 { font-size: 14px !important; }
  h3 { font-size: 13px !important; }
}