/* ==================== 全局样式 - 仿搜狐/腾讯资讯门户 ==================== */
:root {
  /* 颜色 */
  --bg-color: #f5f5f5;
  --body-bg-image: none;
  --header-bg: #c41e1e;
  --header-top-bg: #333;
  --nav-bg: #c41e1e;
  --primary: #c41e1e;
  --primary-hover: #a01818;
  --text: #333;
  --text-light: #666;
  --text-white: #fff;
  --border: #e0e0e0;
  --card-bg: #fff;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  /* 背景图片 */
  --header-bg-image: none;
  --content-bg-image: none;
  --body-bg-opacity: 0.75;
  --header-bg-overlay: 0.4;
  /* 字体 */
  --font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  --font-size-base: 15px;
  --font-size-sm: 13px;
  --font-size-lg: 17px;
  --font-size-h1: 26px;
  --font-size-h2: 20px;
  --font-size-h3: 18px;
  --line-height: 1.6;
  /* 布局 */
  --border-radius: 8px;
  --border-radius-sm: 4px;
  --section-spacing: 24px;
  --card-padding: 20px;
  /* 链接 */
  --link-color: var(--text);
  --link-hover-color: var(--primary);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: var(--line-height);
  background-color: var(--bg-color);
  background-image: var(--body-bg-image);
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-repeat: no-repeat;
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
body.has-body-bg::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(255,255,255, var(--body-bg-opacity));
  z-index: -1;
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

a { color: var(--link-color); text-decoration: none; }
a:hover { color: var(--link-hover-color); }
ul { list-style: none; }
img { max-width: 100%; height: auto; }

/* ==================== 顶部信息栏 ==================== */
.top-bar { background: var(--header-top-bg); padding: 6px 0; }
.top-bar-inner { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: #ccc; }

.header-user-btns { display: flex; gap: 12px; align-items: center; }
.btn-login, .btn-register {
  padding: 4px 16px;
  border-radius: 3px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-block;
}
.btn-login { color: #ddd; border: 1px solid #888; }
.btn-login:hover { color: #fff; border-color: #fff; }
.btn-register { background: #ff6600; color: #fff; border: 1px solid #ff6600; }
.btn-register:hover { background: #e55d00; }

/* ==================== LOGO + 名称独立区域（居中） ==================== */
.brand-header {
  background: var(--header-bg);
  padding: 28px 0;
  position: relative;
  background-size: cover;
  background-position: center;
  background-image: var(--header-bg-image);
}
.brand-header.has-bg-image::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0, var(--header-bg-overlay));
  z-index: 0;
  pointer-events: none;
}
.brand-header.has-bg-image .brand-inner,
.brand-header.has-bg-image .brand-search {
  position: relative;
  z-index: 1;
}
.brand-inner {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
.brand-link {
  display: flex;
  align-items: center;
  gap: 16px;
  text-align: center;
  flex-direction: column;
}
.brand-logo {
  width: 80px;
  height: 80px;
  border-radius: 12px;
  object-fit: contain;
  background: rgba(255,255,255,0.2);
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}
.brand-text h1 {
  font-size: 26px;
  color: #fff;
  font-weight: bold;
  text-shadow: 0 2px 8px rgba(0,0,0,0.3);
  letter-spacing: 2px;
}
.brand-text p {
  font-size: 15px;
  color: rgba(255,255,255,0.85);
  margin-top: 4px;
  text-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.brand-search { display: flex; position: absolute; right: 20px; top: 50%; transform: translateY(-50%); }
.brand-search input {
  width: 240px; padding: 8px 14px; border: none; border-radius: 4px 0 0 4px;
  font-size: 14px; outline: none;
}
.brand-search button {
  padding: 8px 20px; background: #ff6600; color: #fff; border: none;
  border-radius: 0 4px 4px 0; cursor: pointer; font-size: 14px;
}
.brand-search button:hover { background: #e55d00; }

/* ==================== 导航 ==================== */
.nav { background: var(--nav-bg); border-top: 1px solid rgba(255,255,255,0.1); }
.nav-list { display: flex; justify-content: center; }
.nav-list li a {
  display: block; padding: 12px 28px; color: rgba(255,255,255,0.9);
  font-size: 15px; transition: all 0.2s;
}
.nav-list li a:hover, .nav-list li a.nav-active { background: rgba(0,0,0,0.15); color: #fff; }

/* ==================== 主布局 ==================== */
.main { flex: 1; padding: var(--section-spacing) 0; }
.main-grid { display: grid; grid-template-columns: 1fr 320px; gap: var(--section-spacing); }

/* ==================== 轮播 ==================== */
.carousel {
  position: relative; height: 360px; border-radius: var(--border-radius); overflow: hidden;
  background: #ddd; margin-bottom: var(--section-spacing);
}
.carousel-track { height: 100%; display: flex; transition: transform 0.5s ease; }
.carousel-slide {
  min-width: 100%; height: 100%; position: relative; cursor: pointer;
  background-size: cover; background-position: center;
}
.carousel-slide-overlay {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 40px 24px 20px; background: linear-gradient(transparent, rgba(0,0,0,0.75));
  color: #fff;
}
.carousel-slide-overlay h3 { font-size: 20px; margin-bottom: 6px; }
.carousel-slide-overlay p { font-size: 14px; opacity: 0.9; margin-bottom: 4px; }
.carousel-type-tag {
  display: inline-block; padding: 2px 10px; background: rgba(255,255,255,0.25);
  border-radius: 10px; font-size: 12px; margin-bottom: 6px;
}
.carousel-btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 40px; height: 60px; background: rgba(0,0,0,0.4); color: #fff;
  border: none; cursor: pointer; font-size: 20px; z-index: 2;
}
.carousel-btn:hover { background: rgba(0,0,0,0.6); }
.carousel-prev { left: 0; border-radius: 0 4px 4px 0; }
.carousel-next { right: 0; border-radius: 4px 0 0 4px; }
.carousel-dots { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; z-index: 2; }
.carousel-dot { width: 10px; height: 10px; border-radius: 50%; background: rgba(255,255,255,0.5); cursor: pointer; }
.carousel-dot.active { background: #fff; width: 24px; border-radius: 5px; }

/* ==================== 机构宗旨 ==================== */
.mission-card {
  background: linear-gradient(135deg, #fff5f5, #fff);
  border-left: 4px solid var(--primary);
  padding: var(--card-padding) 24px; margin-bottom: var(--section-spacing); border-radius: 0 var(--border-radius) var(--border-radius) 0;
}
.mission-card .section-title { font-size: var(--font-size-h3); color: var(--primary); margin-bottom: 10px; }
.mission-card .section-title span { border-bottom: 2px solid var(--primary); padding-bottom: 4px; }
.mission-card p { font-size: var(--font-size-base); color: #555; line-height: 1.8; }

/* ==================== 标签切换 ==================== */
.tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 2px solid var(--border); }
.tab-btn {
  padding: 10px 20px; background: none; border: none; font-size: 15px;
  cursor: pointer; color: var(--text-light); position: relative; top: 2px;
  border-bottom: 2px solid transparent; transition: all 0.2s;
}
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: bold; }
.tab-btn:hover { color: var(--primary); }

/* ==================== 资讯列表 ==================== */
.article-list { margin-bottom: 24px; }

.article-item {
  display: flex; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background 0.2s;
}
.article-item:hover { background: #fafafa; padding-left: 8px; }
.article-item:last-child { border-bottom: none; }

.article-item-img {
  width: 200px; height: 130px; border-radius: 4px; object-fit: cover;
  background: #eee; flex-shrink: 0;
}
.article-item-info { flex: 1; display: flex; flex-direction: column; justify-content: space-between; }
.article-item-info h3 { font-size: 17px; line-height: 1.5; margin-bottom: 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.article-item-info h3:hover { color: var(--primary); }
.article-item-meta { font-size: 13px; color: #999; display: flex; gap: 16px; }
.article-item-desc { font-size: 14px; color: #777; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* 大图模式 */
.article-item-large { flex-direction: column; }
.article-item-large .article-item-img { width: 100%; height: 220px; }

/* ==================== 分页 ==================== */
.pagination { display: flex; justify-content: center; gap: 6px; }
.pagination button {
  padding: 8px 14px; border: 1px solid var(--border); background: #fff;
  border-radius: var(--border-radius-sm); cursor: pointer; font-size: var(--font-size-sm); color: var(--text);
}
.pagination button:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination button:disabled { opacity: 0.5; cursor: default; }

/* ==================== 侧边栏 ==================== */
.main-right { display: flex; flex-direction: column; gap: 20px; }

.sidebar-card {
  background-color: var(--card-bg);
  background-image: var(--content-bg-image);
  background-repeat: repeat;
  border-radius: var(--border-radius); padding: var(--card-padding);
  box-shadow: var(--shadow);
}
.sidebar-card h3 {
  font-size: var(--font-size-h3); padding-bottom: 12px; margin-bottom: 12px;
  border-bottom: 2px solid var(--primary); color: var(--text);
}

.hot-list li { padding: 8px 0; border-bottom: 1px dashed var(--border); }
.hot-list li:last-child { border-bottom: none; }
.hot-list li a { font-size: 14px; color: #444; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hot-list li a:hover { color: var(--primary); }
.hot-list li .hot-num { color: var(--primary); font-weight: bold; margin-right: 6px; }

.contact-info p { font-size: 14px; color: #666; margin-bottom: 6px; line-height: 1.8; }

/* ==================== 按钮 ==================== */
.btn-primary {
  display: inline-block; padding: 10px 24px; background: var(--primary);
  color: #fff; border: none; border-radius: var(--border-radius-sm); font-size: 15px; cursor: pointer;
  text-align: center; transition: background 0.2s;
}
.btn-primary:hover { background: var(--primary-hover); color: #fff; }
.btn-outline {
  display: inline-block; padding: 10px 24px; background: #fff;
  color: var(--primary); border: 1px solid var(--primary); border-radius: var(--border-radius-sm);
  font-size: 15px; cursor: pointer; text-align: center; transition: all 0.2s;
}
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-block { display: block; width: 100%; }
.btn-danger { background: #e74c3c; }
.btn-danger:hover { background: #c0392b; }
.btn-success { background: #27ae60; }
.btn-success:hover { background: #219a52; }

/* ==================== 页脚 ==================== */
.footer {
  background: var(--theme-footer-bg, #333);
  color: var(--theme-footer-text-color, #999);
  text-align: center;
  padding: 24px 0;
  font-size: 13px;
  margin-top: auto;
  position: relative;
  z-index: 0;
}
/* 有全站背景图时，footer 使用半透明背景，确保文字始终可读 */
body.has-body-bg .footer {
  background: rgba(0, 0, 0, 0.45);
  color: #ddd;
}
body.has-body-bg .footer a {
  color: #ddd;
}
.footer p { margin-bottom: 4px; }
.footer a { color: var(--theme-footer-text-color, #999); text-decoration: none; }
.footer a:hover { color: var(--primary); text-decoration: underline; }
.footer-beian { margin-top: 8px; font-size: 12px; display: flex; justify-content: center; align-items: center; gap: 16px; flex-wrap: wrap; }
.footer-beian img { height: 14px; vertical-align: middle; margin-right: 2px; }

/* ==================== 登录/注册页 ==================== */
.auth-page { background: #f0f2f5; min-height: 100vh; display: flex; flex-direction: column; }

.auth-header {
  background: var(--header-bg); text-align: center; padding: 40px 20px 30px;
}
.auth-header h1 { color: #fff; font-size: 26px; }
.auth-header p { color: rgba(255,255,255,0.8); font-size: 15px; margin-top: 6px; }

.auth-container {
  flex: 1; display: flex; justify-content: center; align-items: flex-start; padding: 40px 20px;
}
.auth-card {
  background: #fff; border-radius: 8px; padding: 40px; width: 420px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}
.auth-card h2 { text-align: center; font-size: 22px; margin-bottom: 30px; color: var(--text); }

.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 14px; color: #555; margin-bottom: 6px; font-weight: 500; }
.form-group input, .form-group textarea, .form-group select {
  width: 100%; padding: 10px 14px; border: 1px solid #ddd; border-radius: var(--border-radius-sm);
  font-size: var(--font-size-sm); outline: none; transition: border-color 0.2s;
}
.form-group input:focus, .form-group textarea:focus { border-color: var(--primary); }
.form-group textarea { resize: vertical; min-height: 120px; }
.form-tip { font-size: 12px; color: #999; margin-top: 4px; }

.auth-footer { text-align: center; margin-top: 20px; font-size: 14px; color: #888; }
.auth-footer a { color: var(--primary); }

.error-msg { color: #e74c3c; font-size: 14px; margin-bottom: 12px; text-align: center; display: none; }
.success-msg { color: #27ae60; font-size: 14px; margin-bottom: 12px; text-align: center; display: none; }

/* ==================== 发布页 ==================== */
.publish-container {
  max-width: 900px; margin: 40px auto; padding: 0 20px;
}
.publish-card {
  background: #fff; border-radius: 8px; padding: 32px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}
.publish-card h2 { font-size: 22px; margin-bottom: 24px; padding-bottom: 12px; border-bottom: 2px solid var(--primary); }

/* 富文本编辑器样式 */
.editor-toolbar {
  display: flex; flex-wrap: wrap; gap: 4px; padding: 8px 10px;
  background: #f8f9fa; border: 1px solid #ddd; border-bottom: none;
  border-radius: 4px 4px 0 0;
}
.editor-toolbar button {
  width: 32px; height: 32px; border: 1px solid transparent; background: #fff;
  border-radius: 4px; cursor: pointer; font-size: 14px; color: #555;
  display: flex; align-items: center; justify-content: center; transition: all 0.15s;
}
.editor-toolbar button:hover { background: #e9ecef; border-color: #ccc; }
.editor-toolbar button.active { background: #c41e1e; color: #fff; border-color: #c41e1e; }
.editor-toolbar .toolbar-sep { width: 1px; background: #ddd; margin: 0 4px; }
.editor-content {
  min-height: 360px; max-height: 600px; padding: 16px; border: 1px solid #ddd;
  border-top: none; border-radius: 0 0 4px 4px; font-size: 15px; line-height: 1.8;
  outline: none; overflow-y: auto; background: #fff;
  word-break: break-word;
}
.editor-content:focus { border-color: var(--primary); }
.editor-content:empty::before {
  content: attr(data-placeholder);
  color: #bbb; pointer-events: none;
}
.editor-content img { max-width: 100%; border-radius: 4px; margin: 8px 0; }
.editor-content h2 { font-size: 20px; margin: 12px 0 8px; border: none; padding: 0; }
.editor-content h3 { font-size: 17px; margin: 10px 0 6px; }
.editor-content blockquote {
  border-left: 3px solid var(--primary); padding: 8px 16px;
  margin: 8px 0; background: #fdf2f2; color: #666; font-style: italic;
}
.editor-content p { margin-bottom: 8px; }
.editor-content ul, .editor-content ol { margin: 8px 0; padding-left: 24px; }
.editor-content ul { list-style: disc; }
.editor-content ol { list-style: decimal; }
.editor-wrapper {
  border: 1px solid #ddd; border-radius: 4px; transition: border-color 0.2s;
}
.editor-wrapper:focus-within { border-color: var(--primary); }
.editor-wrapper .editor-toolbar { border: none; border-bottom: 1px solid #eee; }
.editor-wrapper .editor-content { border: none; }

.upload-area {
  border: 2px dashed #ddd; border-radius: 8px; padding: 30px; text-align: center;
  cursor: pointer; transition: all 0.2s; margin-bottom: 12px;
}
.upload-area:hover { border-color: var(--primary); background: #fff5f5; }
.upload-area p { color: #999; }
.image-preview { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.image-preview-item { position: relative; width: 120px; height: 120px; border-radius: 4px; overflow: hidden; }
.image-preview-item img { width: 100%; height: 100%; object-fit: cover; }
.image-preview-item .remove-btn {
  position: absolute; top: 4px; right: 4px; width: 22px; height: 22px;
  background: rgba(0,0,0,0.6); color: #fff; border: none; border-radius: 50%;
  cursor: pointer; font-size: 14px; line-height: 22px; text-align: center;
}

/* ==================== 管理后台 ==================== */
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar {
  width: 220px; background: #2c3e50; color: #fff; flex-shrink: 0;
}
.admin-sidebar-header {
  padding: 20px; text-align: center; border-bottom: 1px solid rgba(255,255,255,0.1);
  font-size: 16px; font-weight: bold;
}
.admin-nav a {
  display: block; padding: 14px 20px; color: rgba(255,255,255,0.7); font-size: 14px;
  border-left: 3px solid transparent; transition: all 0.2s;
}
.admin-nav a:hover, .admin-nav a.active { background: rgba(255,255,255,0.08); color: #fff; border-left-color: #3498db; }
.admin-main { flex: 1; padding: 24px; background: #f5f5f5; overflow-y: auto; }
.admin-section { display: none; }
.admin-section.active { display: block; }

.admin-card {
  background-color: #fff;
  background-image: var(--content-bg-image);
  background-repeat: repeat;
  border-radius: var(--border-radius); padding: 24px; margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.admin-card h3 { font-size: var(--font-size-h3); margin-bottom: 16px; padding-bottom: 10px; border-bottom: 2px solid var(--primary); }

/* 表格 */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid #eee; }
th { background: #f8f9fa; font-weight: 600; color: #555; }
tr:hover { background: #fafbfc; }

.badge {
  display: inline-block; padding: 2px 10px; border-radius: 12px;
  font-size: 12px; font-weight: 500;
}
.badge-pending { background: #fff3cd; color: #856404; }
.badge-approved { background: #d4edda; color: #155724; }
.badge-rejected { background: #f8d7da; color: #721c24; }
.badge-draft { background: #e2e3e5; color: #383d41; }

.action-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.btn-sm {
  padding: 4px 12px; font-size: 12px; border-radius: 3px;
  border: 1px solid #ddd; cursor: pointer; transition: all 0.2s;
}
.btn-sm:hover { opacity: 0.85; }

/* 弹窗 */
.modal-overlay {
  display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5); z-index: 1000; justify-content: center; align-items: center;
}
.modal-overlay.show { display: flex; }
.modal {
  background: #fff; border-radius: 8px; padding: 30px; width: 95%; max-width: 900px;
  max-height: 85vh; overflow-y: auto; box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}
.modal h3 { margin-bottom: 20px; font-size: 18px; }

/* ==================== 页面（服务/关于） ==================== */
.page-header {
  background: linear-gradient(135deg, var(--primary), #e74c3c);
  text-align: center; padding: 50px 20px; color: #fff;
}
.page-header h1 { font-size: 28px; margin-bottom: 8px; }
.page-header p { font-size: 15px; opacity: 0.9; }

.page-content { max-width: 1000px; margin: 30px auto; padding: 0 20px; }

.service-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.service-card {
  background: #fff; border-radius: var(--border-radius); padding: 24px; box-shadow: var(--shadow);
  transition: transform 0.2s; border-top: 3px solid var(--primary);
  display: block;
}
.service-card:hover { transform: translateY(-4px); box-shadow: 0 6px 20px rgba(0,0,0,0.12); }
.service-card h3 { font-size: var(--font-size-h3); color: var(--primary); margin-bottom: 10px; }
.service-card p { font-size: var(--font-size-sm); color: #666; line-height: 1.7; }
.service-card-arrow {
  margin-top: 12px; text-align: right; font-size: 13px; color: var(--primary);
  opacity: 0; transform: translateX(-8px); transition: all 0.2s;
}
.service-card:hover .service-card-arrow {
  opacity: 1; transform: translateX(0);
}

.about-content {
  background: #fff; border-radius: 8px; padding: 32px; box-shadow: var(--shadow);
  line-height: 2; font-size: 15px;
}
.about-content p { margin-bottom: 16px; text-indent: 2em; }

/* ==================== 返回顶部按钮 ==================== */
.back-to-top {
  position: fixed;
  bottom: 40px;
  right: 30px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 20px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all 0.3s ease;
  outline: none;
}
.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.back-to-top:hover {
  background: var(--primary-hover);
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}
.back-to-top:active {
  transform: translateY(0);
}

/* 响应式 */
@media (max-width: 768px) {
  .main-grid { grid-template-columns: 1fr; }
  .brand-inner { flex-direction: column; text-align: center; }
  .brand-search { position: static; transform: none; margin-top: 12px; }
  .brand-search input { width: 200px; }
  .brand-logo { width: 60px; height: 60px; }
  .brand-text h1 { font-size: 20px; }
  .nav-list { flex-wrap: wrap; justify-content: center; }
  .carousel { height: 220px; }
  .article-item { flex-direction: column; }
  .article-item-img { width: 100%; height: 180px; }
  .auth-card { width: 100%; padding: 24px; }
  .admin-layout { flex-direction: column; }
  .admin-sidebar { width: 100%; }
}
