@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

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

:root {
  --bg: #f4f3f1;
  --surface: #ffffff;
  --border: #e4e2de;
  --border-light: #eeece8;
  --text: #1a1a1a;
  --text-muted: #7a7872;
  --accent: #1a1a1a;
  --green: #1a8a5c;
  --green-bg: #eaf6f0;
  --green-border: #c4e6d4;
  --orange: #c47a20;
  --orange-bg: #fdf3e6;
  --orange-border: #f0ddc0;
  --purple: #6c5ce7;
  --purple-bg: #f0eefa;
  --radius: 10px;
}

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Header */
header {
  padding: 24px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1100px;
  margin: 0 auto;
}

.logo {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 3px;
}

.logo .mzansi { color: var(--text); }
.logo .watch { color: var(--text-muted); }

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.watchlist-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: border-color 0.2s;
}

.watchlist-btn:hover { border-color: var(--accent); }

.watchlist-count {
  background: var(--green-bg);
  color: var(--green);
  font-size: 11px;
  font-weight: 700;
  border-radius: 10px;
  padding: 1px 7px;
}

.save-btn {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 3px 10px;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.15s;
}

.save-btn:hover { border-color: var(--accent); color: var(--text); }

.save-btn.saved {
  background: var(--green-bg);
  border-color: var(--green-border);
  color: var(--green);
}

.country-select {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 6px;
  padding: 6px 28px 6px 10px;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237a7872' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  transition: border-color 0.2s;
  max-width: 180px;
  text-overflow: ellipsis;
}

.country-select:hover { border-color: var(--accent); }
.country-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,0,0,0.06); }

/* Marquee */
.marquee-wrap {
  overflow: hidden;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
  margin-bottom: 10px;
}

.marquee {
  display: flex;
  gap: 48px;
  animation: marquee 30s linear infinite;
  white-space: nowrap;
  width: max-content;
}

.marquee span {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.marquee span::after {
  content: '·';
  margin-left: 48px;
  color: var(--border);
}

@keyframes marquee {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* Hero / Search */
.search-section {
  max-width: 680px;
  margin: 56px auto 40px;
  padding: 0 24px;
  text-align: center;
}

.search-section h1 {
  font-size: 44px;
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -1.5px;
  margin-bottom: 12px;
}

.search-subtitle {
  color: var(--text-muted);
  font-size: 16px;
  font-weight: 400;
  margin-bottom: 36px;
  line-height: 1.5;
}

.search-bar {
  position: relative;
}

.search-bar input {
  width: 100%;
  padding: 18px 24px 18px 54px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 16px;
  font-family: 'Inter', sans-serif;
  font-weight: 400;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-bar input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,0,0,0.06);
}

.search-bar input::placeholder { color: #b5b3ae; }

.search-icon {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  display: flex;
  align-items: center;
}

.search-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.search-bar .spinner {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
}

@keyframes spin { to { transform: translateY(-50%) rotate(360deg); } }

/* Results */
.results {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

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

.results-count {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.results-count strong { color: var(--green); }

.filter-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  cursor: pointer;
  user-select: none;
}

.filter-toggle input[type="checkbox"] {
  accent-color: var(--green);
  cursor: pointer;
  width: 14px;
  height: 14px;
}

/* Result Card */
.result-card {
  background: var(--surface);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius);
  margin-bottom: 14px;
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.result-card:hover {
  border-color: var(--border);
  box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}

.result-card.has-match {
  border-color: var(--green-border);
}

.result-inner {
  display: flex;
  gap: 20px;
  padding: 20px;
}

.result-poster {
  width: 90px;
  min-width: 90px;
  height: 135px;
  background: var(--bg);
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
}

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

.result-poster .no-poster {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 11px;
}

.result-info { flex: 1; min-width: 0; }

.result-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin-bottom: 5px;
}

.result-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
  flex-wrap: wrap;
  font-weight: 500;
}

.type-badge {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 700;
}

.type-badge.movie { background: var(--purple-bg); color: var(--purple); }
.type-badge.tv { background: var(--orange-bg); color: var(--orange); }

.result-overview {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.result-rating {
  color: var(--orange);
  font-weight: 700;
}

/* Match banners */
.match-banner {
  background: var(--green-bg);
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
  padding: 8px 20px;
  letter-spacing: 0.2px;
}

.match-banner.rent-buy {
  background: var(--orange-bg);
  color: var(--orange);
}

/* Provider sections */
.providers-section {
  border-top: 1px solid var(--border-light);
  padding: 14px 20px;
}

.providers-row { margin-bottom: 12px; }
.providers-row:last-child { margin-bottom: 0; }

.providers-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.providers-label .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.dot.stream { background: var(--green); }
.dot.rent { background: var(--orange); }
.dot.buy { background: var(--purple); }

.provider-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.provider-tag {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  background: var(--bg);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  font-weight: 500;
}

.provider-tag.mine {
  background: var(--green-bg);
  border-color: var(--green-border);
  color: var(--green);
  font-weight: 600;
}

a.provider-tag.mine {
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

a.provider-tag.mine:hover {
  background: #d4ede2;
  border-color: #9dd4b6;
  transform: translateY(-1px);
}

.provider-tag img {
  width: 20px;
  height: 20px;
  border-radius: 4px;
}

.no-providers {
  font-size: 13px;
  color: var(--text-muted);
  padding: 14px 20px;
  border-top: 1px solid var(--border-light);
  font-style: italic;
}

/* Check-directly panel — services our data can't see */
.check-directly {
  border-top: 1px solid var(--border-light);
  padding: 12px 20px 14px;
  background: #fbfaf8;
}

.check-directly-note {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
  line-height: 1.5;
}

.check-directly-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.check-directly-link {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  background: var(--purple-bg);
  border: 1px solid #d8d2f5;
  color: var(--purple);
  text-decoration: none;
  transition: background 0.15s, transform 0.1s;
}

.check-directly-link:hover {
  background: #e4dff7;
  transform: translateY(-1px);
}

/* Per-title verify link (TMDB/JustWatch watch page) */
.verify-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  margin-top: 10px;
}

.verify-link:hover { color: var(--text); text-decoration: underline; }

/* Also available in other countries */
.elsewhere-section {
  border-top: 1px solid var(--border-light);
  padding: 0;
}

.elsewhere-toggle {
  width: 100%;
  background: none;
  border: none;
  padding: 12px 20px;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--purple);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  text-align: left;
}

.elsewhere-toggle:hover { background: var(--purple-bg); }

.elsewhere-toggle .arrow {
  transition: transform 0.2s;
  font-size: 10px;
}

.elsewhere-toggle.open .arrow { transform: rotate(90deg); }

.elsewhere-list {
  display: none;
  padding: 0 20px 14px;
}

.elsewhere-list.show { display: block; }

.elsewhere-country {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
}

.elsewhere-country:last-child { border-bottom: none; }

.elsewhere-country-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  min-width: 120px;
  flex-shrink: 0;
}

.elsewhere-country-name .code {
  color: var(--text-muted);
  font-weight: 400;
}

.elsewhere-providers {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.elsewhere-providers .provider-tag {
  padding: 4px 8px;
  font-size: 11px;
}

.elsewhere-providers .provider-tag img {
  width: 16px;
  height: 16px;
}

/* Service filter pills */
.service-filters {
  padding: 10px 20px 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.service-filters-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  font-weight: 600;
  margin-right: 4px;
}

.service-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  background: var(--bg);
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  font-family: 'Inter', sans-serif;
}

.service-pill:hover {
  border-color: var(--purple);
  color: var(--purple);
}

.service-pill.active {
  background: var(--purple-bg);
  border-color: var(--purple);
  color: var(--purple);
  font-weight: 600;
}

.service-pill img {
  width: 16px;
  height: 16px;
  border-radius: 3px;
}

.elsewhere-country.hidden { display: none; }

.elsewhere-no-match {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
  padding: 8px 0;
}

/* Empty states */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
}

.empty-state .icon {
  margin-bottom: 16px;
  color: var(--text-muted);
  display: flex;
  justify-content: center;
}

.empty-state .icon svg {
  width: 42px;
  height: 42px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.empty-state p {
  font-size: 14px;
  line-height: 1.6;
  font-weight: 400;
}

/* Footer */
footer {
  text-align: center;
  padding: 32px 24px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.8;
  font-weight: 400;
}

footer a {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}

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

/* Responsive */
@media (max-width: 600px) {
  .search-section h1 { font-size: 32px; }
  .search-section { margin-top: 36px; }
  .result-inner { gap: 14px; }
  .result-poster { width: 75px; min-width: 75px; height: 112px; }
  header { padding: 20px 20px; }
  .marquee span { font-size: 11px; }
}
