/* ===== 深色主题变量 ===== */
:root {
  --bg-color: #14141f;
  --card-bg: #1e1e2d;
  --text-color: #e0e0ff;
  --link-color: #7a6ae6;
  --accent-color: #8a7cf0;
  --hover-color: #9a8dff;
  --border-color: #33334d;
  --header-bg: #1a1a28;
  --badge-bg: rgba(0, 0, 0, 0.6);
}

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

body {
  font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
}
a {
  color: var(--link-color);
  text-decoration: none;
  transition: color 0.2s;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

@media (max-width: 1024px) {
  .container {
    max-width: 960px;
    padding: 0 16px;
  }
}
@media (max-width: 768px) {
  .container {
    padding: 0 12px;
  }
}

/* ==========================================================================
   ✅ 响应式头部导航（修复移动端布局）
   ========================================================================== */

.site-header {
  background: var(--header-bg);
  color: white;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
  gap: 1rem;
}

/* === Logo === */
.site-logo {
  font-size: 1.5rem;
  font-weight: bold;
  color: white;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}

/* === 主导航（PC 显示）=== */
.main-nav ul {
  display: flex;
  list-style: none;
  gap: 1rem;
  margin: 0;
  padding: 0;
}

.main-nav a {
  color: #c0c0e0;
  text-decoration: none;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 6px;
  transition: all 0.2s;
}

.main-nav a:hover,
.main-nav a.active {
  background: var(--accent-color);
  color: white;
}

/* === 右侧功能区（搜索 + 刷新 + 菜单按钮）=== */
.header-right {
  display: flex;
  align-items: center;
  gap: 0.1rem; /* 减小图标之间的间距 */
  flex-shrink: 0;
}

/* === 搜索框（现代化）=== */
.search-form {
  display: flex;
  max-width: 240px;
  min-width: 180px;
}
.search-form input {
  width: 100%;
  padding: 0.45rem 0.8rem; /* 稍微减小内边距，让整体更紧凑 */
  border: 1px solid #444;
  border-radius: 6px 0 0 6px;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  font-size: 14px;
}
.search-form input:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 2px rgba(138, 124, 240, 0.3);
}
/* ===== 搜索按钮：缩小 + 改颜色 ===== */
.search-form button {
  background: #e74c3c; /* 🔴 改成醒目的红色（可自定义） */
  border: none;
  color: white;
  padding: 0.45rem 0.7rem; /* 减小左右 padding，让按钮更窄 */
  border-radius: 0 6px 6px 0;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s;
}
.search-form button:hover {
  background: #c0392b; /* 深一点的红 */
}

/* === 刷新图标 === */
.refresh-btn {
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0.5rem;
  border-radius: 50%;
  transition: transform 0.2s;
}
.refresh-btn:hover {
  transform: scale(1.1);
}

/* === 菜单按钮（三道杠）=== */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  color: white;
  font-size: 1.4rem;
  flex-shrink: 0;
}


/* ==============================
   移动端 & 平板（<= 1024px）
   ============================== */
@media (max-width: 1024px) {
  /* 隐藏桌面导航 */
  .main-nav {
    display: none !important;
  }

  /* 显示菜单按钮 */
  .menu-toggle {
    display: flex;
  }

  /* 搜索框缩小 */
  .search-form {
    max-width: 200px;
    min-width: 150px;
  }

  /* 刷新图标保持可见 */
  .refresh-btn {
    display: inline-flex;
  }
}

@media (max-width: 480px) {
  .search-form {
    max-width: 180px;
    min-width: 130px;
  }
  .site-logo {
    font-size: 1.2rem;
  }
}

/* === 移动端菜单弹出样式 === */
@media (max-width: 1024px) {
  .main-nav.active {
    position: absolute;
    top: calc(100% + 8px);
    left: 15rem;
    right: 1rem;
    background: var(--header-bg);
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    display: block !important;
  }
  .main-nav.active ul {
    flex-direction: column;
    gap: 1rem;
  }
  .main-nav.active a {
    display: block;
    padding: 0.8rem;
    border-radius: 6px;
    text-align: center;
  }
}

/* ==========================================================================
   其他样式（保留不变）
   ========================================================================== */

.hero-slider {
  margin: 24px 0 32px;
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  height: 200px;
  background: #1a1a2a;
}

.slider-poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.slider-poster.active {
  display: block;
}

.slider-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
  padding: 24px;
  color: white;
}

.slider-content h2 {
  font-size: 28px;
  margin-bottom: 8px;
  font-weight: 700;
}

.drama-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 14px 0;
}

@media (max-width: 1024px) {
  .drama-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
  .drama-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
}

.drama-card {
  background: var(--card-bg);
  border-radius: 10px;
  overflow: hidden;
  transition: transform 0.25s, box-shadow 0.25s;
  border: 1px solid var(--border-color);
  position: relative;
}

.drama-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 10px 20px rgba(0,0,0,0.4);
}

.poster {
  aspect-ratio: 3 / 4;
  background: #252535;
  position: relative;
}

.poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.poster img.loaded {
  display: block;
}

.poster-year {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: var(--badge-bg);
  color: white;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 12px;
}

.poster-status {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--accent-color);
  color: white;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 12px;
  font-weight: 600;
}

.poster-status.completed {
  background: #4caf50;
}

.drama-info {
  padding: 12px;
}

.drama-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drama-meta {
  font-size: 13px;
  color: #aaa;
  display: flex;
  justify-content: space-between;
}

.drama-detail {
  display: flex;
  gap: 32px;
  margin: 32px 0;
}

@media (max-width: 768px) {
  .drama-detail { flex-direction: column; }
}

.poster-large {
  flex: 0 0 300px;
  aspect-ratio: 3 / 4;
  background: #252535;
  position: relative;
}

.poster-large img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.poster-large img.loaded {
  display: block;
}

.info h1 {
  font-size: 28px;
  margin-bottom: 16px;
  font-weight: 700;
}

.tags {
  margin: 16px 0;
}

.tag {
  display: inline-block;
  background: var(--accent-color);
  color: white;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 14px;
  margin-right: 8px;
  margin-bottom: 8px;
}

.intro h3 {
  margin: 24px 0 12px;
  font-size: 20px;
  font-weight: 600;
}

.player iframe {
  width: 100%;
  height: 500px;
  background: black;
}

@media (max-width: 768px) {
  .player iframe {
    height: 220px;
  }
}

.site-footer {
  margin-top: 60px;
  padding: 20px 0;
  border-top: 1px solid var(--border-color);
  text-align: center;
  color: #999;
  font-size: 14px;
}

/* ==============================
   移动端 & 平板（<= 1024px）
   ============================== */
@media (max-width: 1024px) {
  /* 隐藏桌面导航 */
  .main-nav {
    display: none !important;
  }

  /* 显示菜单按钮 */
  .menu-toggle {
    display: flex;
  }

  /* 启用移动端菜单 */
  .mobile-menu,
  .menu-overlay {
    display: none; /* 默认隐藏 */
  }

  .mobile-menu.active,
  .menu-overlay.active {
    display: block; /* 激活状态下显示 */
  }

  .mobile-menu {
    position: fixed;
    top: 0;
    left: -100%;
    width: min(280px, 50vw);
    max-width: 280px; /* 强制最大宽度 */
    height: 100vh;
    background: #1e1e1e; /* 深灰黑 */
    color: #ffffff; /* 白色文字 */
    border-right: 1px solid #333;
    z-index: 10000;
    transition: left 0.3s ease;
    padding-top: 60px;
    overflow-y: auto;
  }

  .mobile-menu.active {
    left: 0;
  }

  .mobile-menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
  }

  .mobile-menu li {
    padding: 0;
    margin: 0;
  }

  .mobile-menu a {
    display: block;
    padding: 1rem 1.2rem;
    color: #ffffff; /* 白色文字 */
    text-decoration: none;
    border-bottom: 1px solid #333;
    font-size: 16px;
  }

  .mobile-menu a i {
    margin-right: 0.5rem;
  }

  .mobile-menu a:hover {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
  }

  /* 遮罩层 */
  .menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
  }

  .menu-overlay.active {
    opacity: 1;
    visibility: visible;
  }
}

/* ==============================
   PC端（> 1024px）
   ============================== */
@media (min-width: 1025px) {
  /* 隐藏移动端菜单 */
  .mobile-menu {
    display: none !important;
  }

  /* 显示桌面导航 */
  .main-nav {
    display: block !important;
  }

  /* 隐藏菜单按钮 */
  .menu-toggle {
    display: none;
  }
}

/* ===== 首页栏目标题样式（全局生效，不限于移动端）===== */
.section-title {
  font-size: 1.4rem;
  margin: 1.6rem 0 1rem;
  padding: 0.5rem 1rem;
  background: rgba(231, 76, 60, 0.08); /* 浅红底 */
  border-left: 4px solid #e74c3c;        /* 红色左框 */
  color: var(--text-color);
  display: block;
  border-radius: 0 6px 6px 0;
}

/* 在你的 CSS 文件中（如 static/css/style.css） */
.site-footer {
  margin-top: 2rem;
  padding: 1rem 0;
  text-align: center;
  color: #666;
  font-size: 0.9rem;
}