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

body {
  background: #1e1e1e;
  color: #d4d4d4;
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  min-height: 100vh;
}

/* ── Header ── */
.site-header {
  background: #252526;
  border-bottom: 1px solid #3e3e42;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo { color: #d4d4d4; font-size: 15px; font-weight: 600; white-space: nowrap; }
.logo span { color: #007acc; }

.search-wrap { position: relative; flex: 1; max-width: 480px; }
.search-wrap input {
  width: 100%;
  background: #3c3c3c;
  border: 1px solid #3e3e42;
  color: #d4d4d4;
  padding: 6px 70px 6px 10px;
  font-size: 13px;
  font-family: inherit;
  border-radius: 2px;
  outline: none;
}
.search-wrap input:focus { border-color: #007acc; }
.search-wrap input::placeholder { color: #858585; }
.search-btn {
  position: absolute;
  right: 0; top: 0;
  height: 100%;
  background: #007acc;
  border: none;
  color: #fff;
  padding: 0 14px;
  font-size: 12px;
  cursor: pointer;
  border-radius: 0 2px 2px 0;
}
.search-btn:hover { background: #1a8ad4; }

/* ── API Banner ── */
.api-banner {
  background: #252526;
  border-bottom: 1px solid #3e3e42;
  padding: 7px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.api-banner label { color: #858585; font-size: 12px; white-space: nowrap; }
.api-banner input {
  background: #3c3c3c;
  border: 1px solid #3e3e42;
  color: #d4d4d4;
  padding: 4px 8px;
  font-size: 12px;
  font-family: 'Consolas', monospace;
  border-radius: 2px;
  outline: none;
  flex: 1;
  min-width: 180px;
  max-width: 300px;
}
.api-banner input:focus { border-color: #007acc; }
.btn-save {
  background: #0e639c;
  border: none;
  color: #fff;
  padding: 4px 12px;
  font-size: 12px;
  cursor: pointer;
  border-radius: 2px;
}
.btn-save:hover { background: #1177bb; }
.api-link { color: #3794ff; font-size: 12px; text-decoration: none; }
.api-link:hover { text-decoration: underline; }
#keyStatus { font-size: 12px; color: #858585; }

/* ── Main ── */
main { padding: 16px 20px 32px; }

.section-label {
  color: #858585;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}
.results-info { color: #858585; font-size: 12px; margin-bottom: 12px; }

/* ── Movie Grid — 5 columns, full width ── */
.movie-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

/* ── Movie Card ── */
.movie-card {
  position: relative;
  cursor: pointer;
  border-radius: 3px;
  overflow: hidden;
  background: #2d2d30;
  border: 1px solid #3e3e42;
  transition: border-color 0.15s, transform 0.15s;
}
.movie-card:hover {
  border-color: #007acc;
  transform: translateY(-3px);
  z-index: 1;
}

/* Poster */
.card-poster {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  display: block;
}
.card-no-poster {
  width: 100%;
  aspect-ratio: 2/3;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #555;
  font-size: 36px;
  background: #2d2d30;
}

/* Hover overlay — slides up over poster */
.card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.6) 50%, transparent 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 12px 10px 10px;
  opacity: 0;
  transition: opacity 0.2s;
}
.movie-card:hover .card-overlay { opacity: 1; }

.card-title {
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 5px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
}
.card-year { color: #858585; font-size: 11px; }
.card-type { color: #4ec9b0; font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; }
.card-rating { color: #f5c518; font-size: 12px; font-weight: 600; }

/* Static label strip (always visible at bottom) */
.card-strip {
  padding: 7px 9px 8px;
  background: #252526;
  border-top: 1px solid #3e3e42;
}
.card-strip-title {
  color: #d4d4d4;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}
.card-strip-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.card-strip-year { color: #858585; font-size: 11px; }
.card-strip-rating { color: #f5c518; font-size: 11px; }

/* ── Pagination ── */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 24px;
  flex-wrap: wrap;
}
.page-btn {
  background: #2d2d30;
  border: 1px solid #3e3e42;
  color: #d4d4d4;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  border-radius: 2px;
}
.page-btn:hover:not(:disabled) { border-color: #007acc; color: #3794ff; }
.page-btn:disabled { opacity: 0.4; cursor: default; }
.page-btn.active { background: #007acc; border-color: #007acc; color: #fff; }
.page-info { color: #858585; font-size: 12px; margin-left: 6px; }

/* ── Detail Overlay ── */
.detail-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 200;
  overflow-y: auto;
  padding: 40px 20px;
}
.detail-box {
  background: #1e1e1e;
  border: 1px solid #3e3e42;
  border-radius: 3px;
  max-width: 800px;
  margin: auto;
}
.detail-header {
  background: #252526;
  border-bottom: 1px solid #3e3e42;
  padding: 12px 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.detail-title { font-size: 15px; font-weight: 600; color: #d4d4d4; }
.detail-subtitle { color: #858585; font-size: 12px; margin-top: 3px; }
.close-btn {
  background: none;
  border: none;
  color: #858585;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 2px 6px;
  flex-shrink: 0;
}
.close-btn:hover { color: #d4d4d4; background: #3e3e42; }

.detail-body { padding: 16px; display: flex; gap: 20px; }
.detail-poster-wrap { flex-shrink: 0; width: 170px; }
.detail-poster { width: 100%; border-radius: 2px; display: block; }
.detail-no-poster {
  width: 170px; height: 255px;
  background: #2d2d30;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #555;
  font-size: 36px;
  border-radius: 2px;
}
.detail-info { flex: 1; min-width: 0; }

.plot {
  color: #9cdcfe;
  font-size: 13px;
  line-height: 1.65;
  margin-bottom: 14px;
  font-style: italic;
}

.genre-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 14px; }
.genre-tag {
  background: #2d2d30;
  border: 1px solid #3e3e42;
  color: #4ec9b0;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 2px;
}

.stat-row { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.stat {
  background: #252526;
  border: 1px solid #3e3e42;
  padding: 8px 12px;
  border-radius: 2px;
  text-align: center;
  min-width: 76px;
}
.stat-val { font-size: 15px; font-weight: 600; color: #ce9178; }
.stat-lbl { font-size: 10px; color: #858585; text-transform: uppercase; margin-top: 2px; }

.ratings { margin-bottom: 14px; }
.ratings-title {
  font-size: 11px;
  text-transform: uppercase;
  color: #858585;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}
.rating-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.rating-lbl { font-size: 12px; color: #858585; width: 130px; flex-shrink: 0; }
.bar-track { flex: 1; background: #2d2d30; height: 5px; border-radius: 1px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 1px; transition: width 0.6s ease; }
.bar-imdb { background: #f5c518; }
.rating-val { font-size: 12px; color: #d4d4d4; min-width: 52px; text-align: right; }

.meta-field { margin-bottom: 10px; }
.meta-field label {
  display: block;
  font-size: 11px;
  color: #858585;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 2px;
}
.meta-field p { font-size: 13px; color: #d4d4d4; line-height: 1.5; }

.imdb-link { color: #3794ff; font-size: 12px; text-decoration: none; }
.imdb-link:hover { text-decoration: underline; }

/* ── States ── */
.spinner {
  width: 24px; height: 24px;
  border: 2px solid #3e3e42;
  border-top-color: #007acc;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin: 60px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.error-msg {
  background: #3e1a1a;
  border: 1px solid #be1100;
  color: #f48771;
  padding: 8px 12px;
  font-size: 13px;
  border-radius: 2px;
  grid-column: 1 / -1;
}

/* ── Responsive ── */
@media (max-width: 900px)  { .movie-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 680px)  { .movie-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 440px)  { .movie-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px)  { .detail-body { flex-direction: column; } .detail-poster-wrap { width: 100%; } .detail-no-poster { width: 100%; height: 200px; } }