/* Media Web — hanime1.me style dark theme */

:root {
  --bg: #0a0a0a;
  --bg-card: #121212;
  --bg-hover: #1a1a1a;
  --text: #ffffff;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;
  --accent: #e50914;
  --accent-hover: #ff1a25;
  --border: #1f1f1f;
  --radius: 4px;
  --nav-height: 56px;
  --max-width: 1920px;
  --grid-gap: 16px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang TC", "Microsoft YaHei", "Hiragino Sans", "Noto Sans CJK TC", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

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

/* === Navigation === */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: rgba(10, 10, 10, 0.95);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 20px;
}

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

.nav-logo-img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.nav-links {
  display: flex;
  gap: 16px;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-links::-webkit-scrollbar { display: none; }

.nav-link {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  transition: color 0.15s;
}
.nav-link:hover, .nav-link.active {
  color: var(--text);
}

.nav-right {
  display: flex;
  gap: 12px;
  align-items: center;
}

.nav-search {
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-search input {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 6px 12px;
  font-size: 13px;
  width: 180px;
  transition: width 0.2s, border-color 0.15s;
}
.nav-search input:focus {
  outline: none;
  border-color: var(--accent);
  width: 240px;
}
.nav-search button {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
}
.nav-search button:hover { color: var(--text); }

/* === Layout === */

.page {
  padding-top: var(--nav-height);
  max-width: var(--max-width);
  margin: 0 auto;
}

.home-page #sections {
  padding-top: 24px;
}

/* === Hero === */

.hero {
  position: relative;
  width: 100%;
  height: 42vh;
  min-height: 280px;
  max-height: 480px;
  overflow: hidden;
  margin-bottom: 32px;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center 30%;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(10,10,10,0.95) 0%, rgba(10,10,10,0.6) 50%, rgba(10,10,10,0.2) 100%);
}

.hero-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  height: 100%;
  padding: 0 24px 32px;
  max-width: 700px;
}

.hero-title {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.8);
}

.hero-meta {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.hero-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.hero-tag {
  font-size: 11px;
  padding: 3px 8px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 12px;
  color: var(--text-muted);
}

.hero-buttons {
  display: flex;
  gap: 12px;
}

.hero-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  transition: opacity 0.15s;
}
.hero-btn:hover { opacity: 0.85; }
.hero-btn-primary {
  background: #fff;
  color: #000;
}
.hero-btn-secondary {
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.2);
}

/* === Section === */

.section {
  margin-bottom: 40px;
  padding: 0 24px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.section-title {
  font-size: 18px;
  font-weight: 700;
}

.section-more {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}
.section-more:hover { color: var(--text); }

/* === Card Grid === */

.grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: var(--grid-gap);
}

.card {
  display: block;
  cursor: pointer;
  transition: transform 0.15s;
}
.card:hover { transform: translateY(-2px); }
.card:hover .card-thumb img { opacity: 0.85; }

.card-thumb {
  position: relative;
  aspect-ratio: 16/9;
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 8px;
}
.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.15s;
}
.card-thumb-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  color: var(--text-dim);
  font-size: 12px;
}

.card-duration {
  position: absolute;
  top: 6px;
  left: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 2px;
}

.card-unplayable {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(0,0,0,0.7);
  color: var(--text-dim);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 2px;
}

.card-title {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 4px;
}

.card-meta {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  gap: 8px;
  align-items: center;
}
.card-meta .studio { color: var(--text-muted); }
.card-meta .year { color: var(--text-dim); }
.card-meta .dot { color: var(--text-dim); }

/* === Filter Bar === */

.filter-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 16px 24px;
  flex-wrap: wrap;
}

.filter-select {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  cursor: pointer;
}
.filter-select:focus { outline: none; border-color: var(--accent); }

.filter-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.filter-label {
  color: var(--text-muted);
  font-size: 13px;
}

.scroll-sentinel {
  height: 1px;
  width: 100%;
}

/* ArtPlayer subtitle sizing */
.art-video-player .art-subtitle {
  font-size: 22px !important;
  text-shadow: 1px 1px 3px rgba(0,0,0,0.8);
}

.filter-tag {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.filter-tag:hover { border-color: var(--text-muted); color: var(--text); }
.filter-tag.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.tag-panel {
  margin: 0 24px 20px;
  padding: 18px;
  background: #101010;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}

.tag-group {
  margin-bottom: 18px;
}
.tag-group:last-child { margin-bottom: 0; }
.tag-group h4 {
  font-size: 14px;
  color: var(--text);
  margin-bottom: 10px;
}
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tag-chip {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 5px 10px;
  border-radius: 16px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.tag-chip span {
  color: var(--text-dim);
  margin-left: 4px;
}
.tag-chip:hover {
  border-color: var(--text-muted);
  color: var(--text);
}
.tag-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.tag-chip.active span { color: rgba(255,255,255,0.8); }

/* === Pagination === */

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
  padding: 32px 24px;
}

.page-btn {
  min-width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius);
  font-size: 13px;
  cursor: pointer;
  padding: 0 8px;
}
.page-btn:hover { border-color: var(--text-muted); color: var(--text); }
.page-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.page-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

/* === Watch Page === */

.watch-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  padding: 24px;
}

.watch-main { min-width: 0; }

.watch-player {
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 0;
}
.watch-player video {
  width: 100%;
  height: 100%;
  display: block;
}
.watch-player-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  color: var(--text-dim);
  font-size: 14px;
}

.watch-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
}

.original-title {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.35;
  margin: -2px 0 8px;
}

.watch-meta {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

/* External player buttons */
.watch-external {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.external-label {
  font-size: 13px;
  color: var(--text-dim);
}
.external-btn {
  font-size: 12px;
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  text-decoration: none;
  transition: border-color 0.2s, color 0.2s;
}
.external-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.watch-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.watch-tag {
  font-size: 12px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-muted);
  transition: all 0.15s;
}
.watch-tag:hover { border-color: var(--text-muted); color: var(--text); }

.watch-description {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 16px;
  padding: 16px;
  background: var(--bg-card);
  border-radius: var(--radius);
}

.desc-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 12px;
}
.desc-link:hover {
  text-decoration: underline;
}

.watch-actors {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.watch-actors span { color: var(--text); }
.actor-link {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: rgba(255,255,255,0.25);
  text-underline-offset: 3px;
}
.actor-link:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

/* Sidebar */
.watch-sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sidebar-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.sidebar-card {
  display: flex;
  gap: 8px;
  cursor: pointer;
  transition: opacity 0.15s;
}
.sidebar-card:hover { opacity: 0.8; }

.sidebar-card-thumb {
  width: 120px;
  aspect-ratio: 16/9;
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
}
.sidebar-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.sidebar-card-thumb .card-duration {
  font-size: 9px;
  padding: 1px 4px;
}

.sidebar-card-info {
  flex: 1;
  min-width: 0;
}
.sidebar-card-title {
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 4px;
}
.sidebar-card-meta {
  font-size: 11px;
  color: var(--text-dim);
}

/* === Show Page (TV) === */

.show-layout {
  padding: 24px;
}

.show-header {
  display: flex;
  gap: 24px;
  margin-bottom: 32px;
}

.show-poster {
  width: 200px;
  aspect-ratio: 2/3;
  border-radius: var(--radius);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-card);
}
.show-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.show-info { flex: 1; }
.show-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
}
.show-meta {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.show-description {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 12px;
}

.season-section {
  margin-bottom: 32px;
}
.season-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* === Search Results === */

.search-results {
  padding: 24px;
}

.search-query {
  font-size: 18px;
  margin-bottom: 16px;
}
.search-query span { color: var(--accent); }

/* === Responsive === */

@media (max-width: 1400px) {
  .grid { grid-template-columns: repeat(5, 1fr); }
}

@media (max-width: 1100px) {
  .grid { grid-template-columns: repeat(4, 1fr); }
  .watch-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
  .nav { padding: 0 12px; gap: 12px; }
  .nav-links { gap: 12px; }
  .nav-search input { width: 100px; }
  .nav-search input:focus { width: 140px; }
  .section, .filter-bar, .pagination, .watch-layout, .search-results, .show-layout { padding-left: 12px; padding-right: 12px; }
  .hero-content { padding: 0 12px 20px; }
  .hero-title { font-size: 20px; }
  .show-header { flex-direction: column; }
  .show-poster { width: 120px; }
}

@media (max-width: 480px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .hero { height: 30vh; min-height: 200px; }
  .hero-title { font-size: 16px; }
  .hero-meta { font-size: 12px; }
  .hero-btn { padding: 6px 14px; font-size: 12px; }
}

/* === Loading & Empty States === */

.loading {
  text-align: center;
  padding: 60px;
  color: var(--text-dim);
  font-size: 14px;
}

.empty {
  text-align: center;
  padding: 40px;
  color: var(--text-dim);
  font-size: 14px;
}

/* === Footer === */

.footer {
  padding: 24px;
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
  border-top: 1px solid var(--border);
  margin-top: 40px;
}
