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

:root {
  --panel: #232323;
  --panel-2: #2a2a2a;
  --panel-3: #1f1f1f;
  --border: #333;
  --text: #dcdcdc;
  --text-dim: #8a8a8a;
  --muted: #6a6a6a;
  --yellow: #f5c518;
  --red: #c0392b;
}

html, body {
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
}

body {
  background-color: #141518;
  background-image: url('/img/bg-pattern.svg');
  background-repeat: repeat;
  background-attachment: fixed;
  background-size: 180px 180px;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 20px calc(40px + env(safe-area-inset-bottom, 0px));
  padding-left: calc(20px + env(safe-area-inset-left, 0px));
  padding-right: calc(20px + env(safe-area-inset-right, 0px));
  position: relative;
  z-index: 1;
}

/* Header */
.site-header {
  background: var(--panel);
  border-radius: 4px;
  padding: 22px 26px;
  display: flex;
  align-items: center;
  gap: 30px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.logo {
  color: #fff;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  line-height: 1;
  flex-shrink: 0;
}

.logo-main {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.search-box {
  flex: 1;
  background: var(--panel-3);
  border: 1px solid #2c2c2c;
  border-radius: 3px;
  display: flex;
  align-items: center;
  padding: 4px 4px 4px 14px;
  height: 40px;
}

.search-icon {
  color: var(--text-dim);
  margin-right: 10px;
  font-size: 16px;
}

.search-box input {
  flex: 1;
  background: transparent;
  border: 0;
  color: var(--text);
  outline: 0;
  font-size: 14px;
  height: 100%;
}

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

.search-submit {
  background: linear-gradient(180deg, #fcd83a 0%, #e9b50d 100%);
  color: #111;
  border: 0;
  height: 32px;
  padding: 0 22px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  margin-left: 12px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  box-shadow:
    0 2px 6px rgba(245, 197, 24, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -1px 0 rgba(0, 0, 0, 0.15);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

.search-submit:hover {
  filter: brightness(1.08);
  box-shadow:
    0 3px 10px rgba(245, 197, 24, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    inset 0 -1px 0 rgba(0, 0, 0, 0.18);
  transform: translateY(-1px);
}

.search-submit:active {
  transform: translateY(0);
  box-shadow:
    0 1px 2px rgba(245, 197, 24, 0.3),
    inset 0 1px 2px rgba(0, 0, 0, 0.2);
}

.search-submit:focus-visible {
  outline: 2px solid var(--yellow);
  outline-offset: 2px;
}

.search-submit:disabled {
  background: #3a3a3a;
  color: #777;
  cursor: not-allowed;
  box-shadow: none;
  filter: none;
  transform: none;
}

/* Section header */
.section-header {
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--yellow);
}

.section-header h2 {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-header .icon-box {
  color: var(--yellow);
  flex-shrink: 0;
}

.section-header h2 .icon-box { margin-right: 4px; vertical-align: -3px; }
.see-all .icon-box { color: var(--yellow); vertical-align: -3px; margin-right: 4px; }

.see-all {
  color: #fff;
  text-decoration: none;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.see-all:hover { color: var(--yellow); }

/* Grid */
.latest-episodes {
  background: var(--panel);
  border-radius: 4px;
  margin-bottom: 30px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.episode-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  padding: 18px 20px 22px;
}

.episode-card {
  text-decoration: none;
  color: var(--text);
  background: var(--panel-3);
  border-radius: 3px;
  overflow: hidden;
  transition: transform 0.15s ease;
  display: block;
  position: relative;
}

.episode-card:hover { transform: translateY(-3px); }

.poster {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background-size: cover;
  background-position: center;
}

.poster::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0) 35%),
    linear-gradient(180deg, rgba(0,0,0,0) 55%, rgba(0,0,0,0.95) 100%);
  pointer-events: none;
}

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

.poster-title {
  color: rgba(255,255,255,0.55);
  font-weight: 900;
  font-size: 22px;
  letter-spacing: 2px;
  text-align: center;
  padding: 0 10px;
  text-transform: uppercase;
  opacity: 0.35;
}

.card-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 9px 10px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  z-index: 2;
}

.card-bottom {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 10px 10px 9px;
  z-index: 2;
}

.episode-meta .meta-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0;
  flex-shrink: 0;
}

.meta-right .lang-badges {
  flex-direction: row;
  gap: 3px;
}

.series-name {
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: uppercase;
  text-shadow: 0 1px 3px rgba(0,0,0,0.9);
  flex: 1;
  min-width: 0;
}

.episode-meta {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  font-size: 11px;
  color: #d0d0d0;
  gap: 6px;
}

.episode-meta strong {
  color: var(--yellow);
  font-weight: 700;
}

.episode-meta .date {
  font-size: 10px;
  color: #aaa;
  font-weight: 600;
  white-space: nowrap;
}

.lang-badges {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.lang-badge {
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 2px;
  line-height: 1.1;
  letter-spacing: 0.2px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.lang-badge.dublaj {
  background: #1a7a3a;
}

/* Episode (post) page */
.episode-page {
  background: var(--panel);
  border-radius: 4px;
  padding: 20px 24px 24px;
}

.episode-date {
  color: var(--text-dim);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.episode-date .icon-clock { color: var(--text-dim); }

.player-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 18px;
}

/* Player */
.player-toolbar {
  background: var(--panel-2);
  border-radius: 3px 3px 0 0;
  padding: 12px;
  margin-bottom: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}


.player-select {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--panel-3);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: 3px;
  font-size: 13px;
  color: var(--text);
  min-width: 220px;
}

.player-select .play-icon { color: var(--yellow); }
.player-select strong { color: #fff; }
.player-select .arrow { margin-left: auto; color: var(--text-dim); }

.player-frame {
  background: #000;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0;
  position: relative;
}

.player-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: none;
}

.player-frame iframe.active { display: block; }

.player-empty {
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  padding: 20px;
}

.source-select {
  background: var(--panel-3);
  color: var(--text);
  border: 0;
  font-size: 13px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 3px;
  cursor: pointer;
  margin-left: 6px;
}

.source-select:focus { outline: 1px solid var(--yellow); }

.play-btn {
  background: #f2f2f2;
  color: #111;
  font-weight: 700;
  border: 0;
  padding: 12px 22px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 14px;
}

.play-btn:hover { background: #fff; }

.player-footer {
  background: var(--panel-2);
  padding: 14px;
  border-radius: 0 0 3px 3px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.player-footer .episode-date { margin: 0; }

.next-btn {
  background: var(--panel-3);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  padding: 10px 18px;
  border-radius: 3px;
  font-size: 13px;
  display: inline-block;
}

.next-btn:hover { background: #333; color: #fff; }

/* Episode list sidebar */
.episode-list {
  background: var(--panel-2);
  border-radius: 3px;
  overflow: hidden;
  max-height: 620px;
  display: flex;
  flex-direction: column;
}

.series-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-bottom: 2px solid var(--yellow);
  background: var(--panel);
}

.series-thumb {
  width: 46px;
  height: 46px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 22px;
  flex-shrink: 0;
  background-size: cover;
  background-position: center;
  overflow: hidden;
}

.series-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.series-header { min-width: 0; color: inherit; text-decoration: none; }
.series-header:hover { text-decoration: none; }
.series-header .series-info { min-width: 0; flex: 1; }
.series-header .series-sub { text-decoration: none; }

.series-title {
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.3;
}

.series-sub {
  color: var(--text-dim);
  font-size: 11px;
  margin-top: 2px;
}

.ep-items {
  list-style: none;
  overflow-y: auto;
  flex: 1;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: #444 transparent;
}

.ep-items::-webkit-scrollbar {
  width: 8px;
}

.ep-items::-webkit-scrollbar-track {
  background: transparent;
}

.ep-items::-webkit-scrollbar-thumb {
  background: #3a3a3a;
  border-radius: 4px;
  border: 2px solid var(--panel-2);
  transition: background 0.2s ease;
}

.ep-items::-webkit-scrollbar-thumb:hover {
  background: var(--yellow);
}

.ep-items li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.ep-items li a:hover { background: #2f2f2f; color: #fff; }
.ep-items li.active a { background: #303030; color: #fff; }
.ep-items li .check { color: var(--muted); flex-shrink: 0; }
.ep-items li.active .check { color: var(--yellow); }

.ep-items li.season-break { border-top: 2px solid var(--yellow); }

/* Series detail */
.series-detail {
  background: var(--panel);
  border-radius: 4px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.series-hero {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.series-poster {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.series-poster img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.series-poster .poster-title {
  opacity: 0.6;
  font-size: 20px;
}

.trailer-btn {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(0,0,0,0.7);
  color: #fff;
  border: 0;
  padding: 6px 10px;
  border-radius: 3px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.trailer-btn .play { color: var(--yellow); }
.trailer-btn:hover { background: rgba(0,0,0,0.9); }

/* Trailer modal */
.trailer-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.trailer-frame {
  width: 100%;
  max-width: 960px;
  aspect-ratio: 16 / 9;
  background: #000;
}

.trailer-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.trailer-close {
  position: absolute;
  top: 14px;
  right: 18px;
  background: transparent;
  border: 0;
  color: #fff;
  font-size: 38px;
  line-height: 1;
  cursor: pointer;
  padding: 6px 12px;
}

.trailer-close:hover { color: var(--yellow); }

.trailer-fallback {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--text-dim);
  text-decoration: none;
  font-size: 13px;
  padding: 6px 12px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 3px;
}

.trailer-fallback:hover { color: var(--yellow); background: rgba(0, 0, 0, 0.7); }

.series-info h1 {
  font-size: 26px;
  color: #fff;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  line-height: 1.2;
  word-break: break-word;
}

.series-info h1.md { font-size: 22px; }
.series-info h1.sm { font-size: 18px; }
.series-info h1.xs { font-size: 16px; }

.imdb-badge {
  background: var(--yellow);
  color: #111;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 2px;
  letter-spacing: 0.3px;
}

.series-meta {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  color: var(--text-dim);
  font-size: 13px;
  padding: 0 0 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}

.series-meta a {
  color: var(--text);
  text-decoration: none;
  padding: 1px 2px;
  border-bottom: 1px dotted transparent;
  transition: color 0.12s ease, border-color 0.12s ease;
}

.series-meta a:hover {
  color: var(--yellow);
  border-bottom-color: var(--yellow);
}

.result-count { color: var(--text-dim); font-weight: 400; font-size: 0.9em; margin-left: 4px; }

.series-desc {
  color: var(--text);
  line-height: 1.7;
  font-size: 14px;
}

.season-block { margin-top: 22px; }

.season-tab {
  display: inline-block;
  background: var(--panel-3);
  border: 1px solid var(--border);
  color: #fff;
  padding: 8px 16px;
  border-radius: 3px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
}

.season-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.season-ep {
  display: flex;
  align-items: center;
  gap: 10px;
  background-size: cover;
  background-position: center;
  color: #fff;
  text-decoration: none;
  padding: 12px 14px;
  border-radius: 3px;
  min-height: 60px;
  transition: transform 0.1s ease;
}

.season-ep:hover { transform: translateY(-2px); }
.season-ep .check { color: var(--muted); flex-shrink: 0; }

.ep-text { line-height: 1.3; }
.ep-title { font-size: 13px; font-weight: 700; }
.ep-date {
  font-size: 11px;
  color: #b0b0b0;
  margin-top: 3px;
}

/* 404 */
.notfound {
  background: var(--panel);
  border-radius: 4px;
  padding: 60px 24px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.notfound-code {
  font-size: 110px;
  font-weight: 900;
  color: var(--yellow);
  line-height: 1;
  letter-spacing: -4px;
  margin-bottom: 8px;
}

.notfound h1 {
  color: #fff;
  font-size: 24px;
  margin-bottom: 10px;
}

.notfound p {
  color: var(--text-dim);
  font-size: 14px;
  margin-bottom: 26px;
}

.notfound-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.nf-btn {
  background: var(--panel-3);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  padding: 11px 20px;
  border-radius: 3px;
  font-size: 13px;
  font-weight: 600;
}

.nf-btn:hover { background: #333; color: #fff; }

.nf-btn.primary {
  background: var(--yellow);
  color: #111;
  border-color: var(--yellow);
}

.nf-btn.primary:hover { background: #fff; border-color: #fff; }

/* Search empty state */
.search-empty {
  display: none;
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
}

/* Footer */
.site-footer {
  margin-top: 60px;
  padding: 20px 0;
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.8;
}

@media (max-width: 720px) {
  .site-footer { margin-top: 40px; }
  .site-footer p { margin: 2px 0; }
}

.site-footer a {
  color: var(--yellow);
  text-decoration: none;
}

.site-footer a:hover { text-decoration: underline; }

/* Pagination */
.pager {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 20px 16px 22px;
}

.pager a,
.pager .space,
.pager .current,
.pager .extend.disabled {
  display: inline-block;
  padding: 8px 13px;
  background: var(--panel-3);
  color: var(--text);
  text-decoration: none;
  border-radius: 3px;
  font-size: 13px;
  border: 1px solid var(--border);
  min-width: 36px;
  text-align: center;
  line-height: 1.2;
}

.pager a:hover { background: #333; color: #fff; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.pager .current {
  background: var(--yellow);
  color: #111;
  border-color: var(--yellow);
  font-weight: 700;
}

.pager .space {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}

.pager .extend { font-weight: 600; }

.pager .extend.disabled,
.pager .page-number.current-min,
.pager .page-number.current-max {
  background: var(--panel-3);
  color: var(--muted);
  border-color: var(--border);
  cursor: not-allowed;
  pointer-events: none;
  opacity: 0.55;
}

/* Responsive */
@media (max-width: 1024px) {
  .episode-grid { grid-template-columns: repeat(4, 1fr); }
  .player-layout { grid-template-columns: 1fr; }
  .episode-list { max-height: 400px; }
}

@media (max-width: 720px) {
  .container {
    padding-left: calc(12px + env(safe-area-inset-left, 0px));
    padding-right: calc(12px + env(safe-area-inset-right, 0px));
  }
  .episode-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; padding: 10px; }

  /* Mobilde kart içi daraltması */
  .card-top { padding: 6px 8px; }
  .card-bottom { padding: 6px 8px; gap: 2px; }
  .series-name { font-size: 11px; }
  .episode-meta { font-size: 10px; gap: 4px; }
  .episode-meta .date { font-size: 9px; }
  .meta-right .lang-badge { font-size: 8px; padding: 1px 4px; letter-spacing: 0; }
  .site-header { gap: 8px; padding: 10px 10px; min-width: 0; }
  .logo { flex-shrink: 0; max-width: 45%; overflow: hidden; }
  .logo-main { font-size: 18px; letter-spacing: -0.3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .search-box { height: 34px; padding: 3px 3px 3px 8px; min-width: 0; }
  .search-box input { font-size: 13px; min-width: 0; }
  .search-box .search-icon { margin-right: 4px; font-size: 14px; }
  .search-submit { height: 26px; padding: 0 10px; font-size: 11px; margin-left: 4px; flex-shrink: 0; }
  .episode-header { flex-direction: column; align-items: flex-start; gap: 8px; }

  /* Dizi detay */
  .series-detail { padding: 14px; }
  .series-hero {
    grid-template-columns: 120px 1fr;
    gap: 12px;
    padding-bottom: 16px;
  }
  .series-poster { padding: 8px; }
  .trailer-btn { font-size: 10px; padding: 4px 7px; top: 6px; left: 6px; }
  .trailer-btn .play { font-size: 10px; }

  .series-info h1,
  .series-info h1.md,
  .series-info h1.sm,
  .series-info h1.xs {
    font-size: 16px;
    margin-bottom: 8px;
    gap: 6px;
  }
  .imdb-badge { font-size: 10px; padding: 2px 5px; }
  .series-meta {
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    padding-bottom: 10px;
    margin-bottom: 10px;
  }
  .series-desc { font-size: 13px; line-height: 1.55; }

  /* Sezon grid */
  .season-block { margin-top: 16px; }
  .season-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .season-ep { padding: 10px 12px; min-height: 54px; }
  .ep-title { font-size: 12px; }
  .ep-date { font-size: 10px; }

  .player-toolbar { padding: 8px; gap: 6px; }
  .player-select {
    padding: 5px 9px;
    font-size: 12px;
    gap: 5px;
    flex: 0 1 auto;
    min-width: 0;
    max-width: calc(100% - 100px);
  }
  .source-select { font-size: 12px; padding: 2px 4px; max-width: 100px; }

  .pager {
    gap: 4px;
    padding: 14px 8px 18px;
    flex-wrap: nowrap;
  }
  .pager a, .pager .space, .pager .current, .pager .extend.disabled {
    padding: 6px 9px;
    min-width: 30px;
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  .pager .extend.prev,
  .pager .extend.next {
    font-size: 0;
    min-width: 34px;
  }
  .pager .extend.prev::before { content: "‹"; font-size: 18px; line-height: 1; display: inline-block; }
  .pager .extend.next::after  { content: "›"; font-size: 18px; line-height: 1; display: inline-block; }
}
