/* ========== Reset & Base ========== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-primary: #0f0f0f;
  --bg-secondary: #1a1a2e;
  --bg-card: #16213e;
  --bg-hover: #1f3460;
  --bg-input: #1a1a2e;
  --text-primary: #e0e0e0;
  --text-secondary: #a0a0b0;
  --text-muted: #6b6b80;
  --accent: #e94560;
  --accent-hover: #ff6b81;
  --border: #2a2a40;
  --radius: 8px;
  --radius-lg: 12px;
  --max-width: 1200px;
  --header-height: 64px;
  --transition: 0.25s ease;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--text-primary);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--accent);
}

img {
  display: block;
  max-width: 100%;
}

ul, ol {
  list-style: none;
}

h1 {
  font-size: 1.26rem;
  margin-bottom: 16px;
}

/* ========== Layout ========== */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

.main-content {
  flex: 1;
  padding: 24px 0 40px;
}

/* ========== Header ========== */
.header {
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  height: var(--header-height);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header .container {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header-logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-logo .logo-icon {
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.1rem;
}

.header-logo a {
  color: inherit;
}

.header-logo a:hover {
  color: var(--accent-hover);
}

.header-sub {
  font-size: 1rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* ========== Breadcrumb ========== */
.breadcrumb {
  padding: 12px 0;
  font-size: 0.875rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.breadcrumb a {
  color: var(--text-secondary);
  transition: color var(--transition);
}

.breadcrumb a:hover {
  color: var(--accent);
}

.breadcrumb .sep {
  margin: 0 6px;
  color: var(--text-muted);
}

.breadcrumb .current {
  color: var(--text-primary);
}

/* ========== Footer ========== */
.footer {
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 32px 0;
  margin-top: auto;
}

.footer-links {
  margin-bottom: 20px;
}

.footer-links h4 {
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.footer-links-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
}

.footer-links-list a {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.footer-links-list a:hover {
  color: var(--accent);
}

.footer-copyright {
  border-top: 1px solid var(--border);
  padding-top: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8125rem;
}

/* ========== Search Bar ========== */
.search-bar {
  display: flex;
  align-items: center;
  max-width: 560px;
  margin: 0 auto 28px;
}

.search-bar input {
  flex: 1;
  height: 44px;
  padding: 0 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-right: none;
  border-radius: var(--radius) 0 0 var(--radius);
  color: var(--text-primary);
  font-size: 0.95rem;
  outline: none;
  transition: border-color var(--transition);
}

.search-bar input::placeholder {
  color: var(--text-muted);
}

.search-bar input:focus {
  border-color: var(--accent);
}

.search-bar button {
  height: 44px;
  padding: 0 24px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background var(--transition);
  white-space: nowrap;
}

.search-bar button:hover {
  background: var(--accent-hover);
}

/* ========== Category Nav ========== */
.category-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.category-nav a {
  display: inline-block;
  padding: 6px 16px;
  border-radius: 20px;
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.9rem;
  transition: all var(--transition);
}

.category-nav a:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.category-nav a.active {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

/* ========== Video Grid ========== */
.video-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 32px;
}

.video-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}

.video-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.video-card .cover {
  position: relative;
  width: 100%;
  padding-top: 75%; /* 4:3 aspect ratio */
  background: var(--bg-secondary);
  overflow: hidden;
}

.video-card .cover img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.video-card:hover .cover img {
  transform: scale(1.05);
}

.video-card .cover .duration {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font-size: 0.75rem;
  padding: 2px 6px;
  border-radius: 4px;
}

.video-card .title {
  padding: 10px 12px 14px;
  font-size: 0.9rem;
  color: var(--text-primary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: calc(0.9rem * 1.5 * 2 + 10px + 14px);
}

.video-card .title:hover {
  color: var(--accent);
}

/* ========== Pagination ========== */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  overflow: hidden;
}

.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 10px;
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.9rem;
  transition: all var(--transition);
  flex-shrink: 1;
}

.pagination a:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.pagination .prev-next {
  flex-shrink: 0;
}

.pagination .active {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  pointer-events: none;
  flex-shrink: 0;
}

.pagination .disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* ========== Section Title ========== */
.section-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--accent);
  display: inline-block;
}

/* ========== Player ========== */
.player-wrapper {
  margin-bottom: 24px;
}

.player-wrapper .player-title {
  font-size: 1.35rem;
  font-weight: 600;
  margin-bottom: 16px;
  line-height: 1.4;
}

.player-wrapper .player-area {
  width: 100%;
  padding-top: 56.25%; /* 16:9 */
  background: #000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
}

.player-wrapper .player-area .placeholder {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 1.1rem;
}

.player-wrapper .player-area .placeholder .play-icon {
  width: 72px;
  height: 72px;
  border: 3px solid var(--text-muted);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  margin-bottom: 12px;
  transition: border-color var(--transition);
}

.player-wrapper .player-area .placeholder:hover .play-icon {
  border-color: var(--accent);
}

/* ========== Sub-site Cards (Homepage) ========== */
.subsite-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
  margin-bottom: 40px;
}

.subsite-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: transform var(--transition), box-shadow var(--transition);
}

.subsite-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.subsite-card h3 {
  font-size: 1.2rem;
  color: var(--accent);
  margin-bottom: 16px;
}

.subsite-card .subsite-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.subsite-card .subsite-categories a {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 16px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 0.85rem;
  transition: all var(--transition);
}

.subsite-card .subsite-categories a:hover {
  background: var(--accent);
  color: #fff;
}

/* ========== Responsive ========== */
@media (max-width: 1024px) {
  .video-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  :root {
    --header-height: 56px;
  }

  .header .container {
    flex-wrap: wrap;
    height: auto;
    padding: 10px 16px;
    gap: 8px;
  }

  .header-sub {
    font-size: 0.9rem;
  }

  .video-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .subsite-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .container {
    padding: 0 16px;
  }

  .search-bar {
    flex-direction: row;
    gap: 0;
  }

  .search-bar input {
    border-radius: var(--radius) 0 0 var(--radius);
    height: 40px;
    font-size: 0.875rem;
    padding: 0 12px;
  }

  .search-bar button {
    border-radius: 0 var(--radius) var(--radius) 0;
    height: 40px;
    font-size: 0.875rem;
    padding: 0 16px;
  }

  .player-wrapper .player-title {
    font-size: 1.1rem;
  }

  .pagination {
    flex-wrap: wrap;
    gap: 4px;
  }

  .pagination .prev-next {
    font-size: 0.8rem;
    min-width: auto;
    padding: 0 10px;
    height: 34px;
  }

  .pagination a,
  .pagination span {
    min-width: 32px;
    height: 34px;
    font-size: 0.82rem;
    padding: 0 8px;
  }
}

@media (max-width: 480px) {
  .video-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .video-card .title {
    padding: 8px 10px 10px;
    font-size: 0.82rem;
    min-height: calc(0.82rem * 1.5 * 2 + 8px + 10px);
  }

  .category-nav {
    gap: 6px;
  }

  .category-nav a {
    padding: 5px 12px;
    font-size: 0.82rem;
  }
}
