* { box-sizing: border-box; }
body {
  margin: 0;
  background: #141414;
  color: #f2f2f2;
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
}
.hidden { display: none !important; }

#login-screen {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
#login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(320px, 90vw);
}
#login-form h1 { text-align: center; margin-bottom: 8px; }
#login-form input, #login-form button {
  padding: 12px 14px;
  border-radius: 4px;
  border: none;
  font-size: 16px;
}
#login-form input { background: #333; color: #fff; }
#login-form button {
  background: #e50914;
  color: #fff;
  cursor: pointer;
  font-weight: 600;
}
.error { color: #ff6b6b; min-height: 1.2em; text-align: center; margin: 0; }

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
}
header h1 { margin: 0; color: #e50914; }
.admin-link {
  color: #aaa;
  font-size: 14px;
  text-decoration: none;
  border: 1px solid #444;
  padding: 6px 12px;
  border-radius: 4px;
}
.admin-link:hover { color: #fff; border-color: #fff; }

#sections { padding: 0 32px 32px; }
.section { margin-bottom: 32px; }
.section h2 { font-size: 20px; margin: 0 0 12px; color: #ccc; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}
.card {
  background: #222;
  border-radius: 6px;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.card:hover { transform: scale(1.05); background: #333; }
.card .poster {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  background: #333;
  display: block;
}
.card .poster-fallback {
  width: 100%;
  aspect-ratio: 2/3;
  background: #333;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 10px;
  font-size: 13px;
  color: #999;
}
.card .card-title {
  padding: 10px 8px;
  font-size: 13px;
  line-height: 1.3;
}

.show-header, .player-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  background: #000;
}
.show-header button, .player-bar button {
  background: none;
  border: none;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
}
#show-info {
  display: flex;
  gap: 20px;
  padding: 24px 32px;
}
#show-info img { width: 180px; border-radius: 6px; }
#show-info .overview { max-width: 700px; color: #ccc; line-height: 1.5; }
#show-info h2 { margin: 0 0 12px; }

.episode-list { padding: 0 32px 32px; display: flex; flex-direction: column; gap: 10px; }
.episode-row {
  background: #1f1f1f;
  padding: 14px 16px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
}
.episode-row:hover { background: #2a2a2a; }
.episode-row .ep-tag { color: #999; margin-right: 10px; }

#video { flex: 1; width: 100%; background: #000; }
.controls-extra {
  display: flex;
  justify-content: center;
  gap: 20px;
  padding: 12px;
  background: #000;
}
.controls-extra button {
  background: #333;
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 15px;
}
.controls-extra button:hover { background: #444; }

#player-screen { height: 100vh; display: flex; flex-direction: column; }

/* admin */
.admin-body { padding: 24px 32px; max-width: 900px; margin: 0 auto; }
.admin-body h1 { color: #e50914; }
.item-row {
  background: #1f1f1f;
  border-radius: 6px;
  padding: 14px 16px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.item-row img { width: 46px; height: 69px; object-fit: cover; border-radius: 4px; background: #333; }
.item-row .item-info { flex: 1; }
.item-row .item-name { font-size: 14px; }
.item-row .item-status { font-size: 12px; color: #999; }
.item-row button {
  background: #e50914;
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: 4px;
  cursor: pointer;
}

.edit-panel {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 40px 20px;
  z-index: 10;
}
.edit-panel.hidden { display: none; }
.edit-box {
  background: #1a1a1a;
  border-radius: 8px;
  padding: 24px;
  width: min(600px, 100%);
}
.edit-box label { display: block; margin: 14px 0 6px; font-size: 13px; color: #ccc; }
.edit-box input, .edit-box select, .edit-box textarea {
  width: 100%;
  padding: 10px;
  border-radius: 4px;
  border: 1px solid #444;
  background: #262626;
  color: #fff;
  font-size: 14px;
}
.edit-box textarea { min-height: 70px; }
.edit-box .row { display: flex; gap: 12px; }
.edit-box .row > div { flex: 1; }
.search-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; margin-top: 10px; }
.search-results .res {
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: 4px;
  overflow: hidden;
}
.search-results .res.selected { border-color: #e50914; }
.search-results img { width: 100%; aspect-ratio: 2/3; object-fit: cover; display: block; background: #333; }
.search-results .res-title { font-size: 11px; padding: 4px; color: #ccc; }
.edit-box .actions { display: flex; gap: 10px; margin-top: 20px; }
.edit-box .btn-save { background: #e50914; color: #fff; border: none; padding: 10px 18px; border-radius: 4px; cursor: pointer; }
.edit-box .btn-cancel { background: #333; color: #fff; border: none; padding: 10px 18px; border-radius: 4px; cursor: pointer; }
