:root {
  color-scheme: dark;
  --bg: #0b0f18;
  --panel: #141b2b;
  --muted: #9ba6c4;
  --text: #e9eefc;
  --accent: #4f8cff;
  --ok: #1fca82;
  --warn: #f6c453;
  --off: #4b5779;
  --danger: #dc5f5f;
  --border: #24304a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 20% 10%, #172038, var(--bg));
}

.container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.header h1 {
  margin: 0;
  font-size: 2rem;
}

.header p {
  margin: 8px 0 0;
  color: var(--muted);
}

.search-panel,
.watchlist-panel {
  margin-top: 20px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
}

#search-form {
  display: grid;
  grid-template-columns: 1fr 90px 120px;
  gap: 10px;
}

input,
select,
button {
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 0.95rem;
  padding: 10px 12px;
}

input,
select {
  background: #0d1322;
  color: var(--text);
}

button {
  background: var(--accent);
  border: 0;
  color: #fff;
  cursor: pointer;
  font-weight: 600;
}

button:disabled {
  opacity: 0.6;
  cursor: default;
}

.secondary-btn {
  background: #2c416f;
}

.danger-btn {
  background: #8e2e2e;
}

.options-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #c7d3f3;
  font-size: 0.9rem;
}

.status {
  min-height: 1.2rem;
  margin: 10px 2px 0;
  color: var(--muted);
}

.status.small {
  font-size: 0.84rem;
}

.results {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.card {
  display: grid;
  grid-template-columns: 128px 1fr;
  gap: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.poster-wrap {
  position: relative;
  width: 128px;
  height: 192px;
  background: #111829;
}

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

.poster.show {
  display: block;
}

.poster-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.88rem;
}

.details {
  padding: 12px 12px 12px 0;
}

.title {
  margin: 0;
  font-size: 1.05rem;
}

.meta {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.plex-line {
  margin: 8px 0 0;
}

.plex-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 0.78rem;
  padding: 3px 10px;
}

.plex-pill.found {
  background: #143727;
  color: #8ef8c5;
  border: 1px solid #1b6f4a;
}

.plex-pill.missing {
  background: #2a2f41;
  color: #b5bfd8;
  border: 1px solid #3a4768;
}

.overview {
  margin: 8px 0 0;
  color: #cad3ee;
  font-size: 0.9rem;
}

.services {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.service-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  font-size: 0.82rem;
  padding: 4px 10px;
  border: 1px solid transparent;
}

.service-pill.ok {
  background: #143727;
  border-color: #1b6f4a;
  color: #8ef8c5;
}

.service-pill.warn {
  background: #3f3012;
  border-color: #755813;
  color: #ffd883;
}

.service-pill.off {
  background: #252d40;
  border-color: #36415c;
  color: #a8b4d4;
}

.actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.action-btn {
  font-size: 0.82rem;
  padding: 6px 10px;
  border-radius: 8px;
}

.providers-details {
  margin-top: 10px;
}

.providers-details summary {
  color: #b7c4ea;
  cursor: pointer;
  font-size: 0.9rem;
}

.providers {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.provider-pill {
  background: #111829;
  border: 1px solid #2a3655;
  color: #d4ddf5;
  border-radius: 999px;
  font-size: 0.78rem;
  padding: 3px 8px;
}

.watch-link {
  display: inline-block;
  margin-top: 10px;
  color: #8db8ff;
  text-decoration: none;
  font-size: 0.9rem;
}

.watch-link:hover {
  text-decoration: underline;
}

.watchlist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.watchlist-header h2 {
  margin: 0;
  font-size: 1.2rem;
}

.watchlist {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.watchlist-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #111829;
  border: 1px solid #2b3a5d;
  border-radius: 10px;
  padding: 10px 12px;
}

.watchlist-details {
  color: #dbe4fb;
  font-size: 0.9rem;
}

.watchlist-meta {
  margin-top: 5px;
  color: #a6b3d4;
  font-size: 0.78rem;
}

.watchlist-actions {
  flex-shrink: 0;
}

.watchlist-empty {
  color: #a7b5d8;
  font-size: 0.9rem;
  background: #111829;
  border: 1px dashed #334264;
  border-radius: 10px;
  padding: 12px;
}

@media (max-width: 760px) {
  #search-form {
    grid-template-columns: 1fr;
  }

  .options-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .card {
    grid-template-columns: 1fr;
  }

  .poster-wrap {
    width: 100%;
    height: 220px;
  }

  .details {
    padding: 10px 12px 14px;
  }

  .actions {
    flex-wrap: wrap;
  }

  .watchlist-item {
    flex-direction: column;
    align-items: flex-start;
  }
}
