/* ============================================================
   TeleFlix — styles for the backend-driven catalog app.
   Covers every class created in app.js.
   ============================================================ */

:root {
  --bg: #0b0e14;
  --bg-elev: #141925;
  --bg-card: #1a2030;
  --text: #e8ecf4;
  --text-dim: #9aa6bd;
  --accent: #2dd4bf;
  --accent-ink: #04201c;
  --danger: #ff6b6b;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  font-family: Vazirmatn, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(45, 212, 191, 0.12), transparent 60%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(11, 14, 20, 0.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 1.25rem;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 1rem;
}

.brand-name {
  letter-spacing: 0.3px;
}

.search-form {
  flex: 1;
  display: flex;
  gap: 8px;
  max-width: 560px;
  margin-left: auto;
}

.search-input {
  flex: 1;
  height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--bg-elev);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-input::placeholder {
  color: var(--text-dim);
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(45, 212, 191, 0.15);
}

.search-button {
  height: 42px;
  padding: 0 20px;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  transition: filter 0.15s ease;
}

.search-button:hover {
  filter: brightness(1.08);
}

.header-year {
  color: var(--text-dim);
  font-size: 0.85rem;
  white-space: nowrap;
}

/* ---------- Hero ---------- */
.hero-banner {
  max-width: 1200px;
  margin: 28px auto 8px;
  padding: 0 20px;
}

.hero-inner {
  border-radius: 20px;
  padding: 40px 32px;
  background:
    radial-gradient(600px 300px at 15% 0%, rgba(45, 212, 191, 0.18), transparent 60%),
    linear-gradient(135deg, #162033, #0d1320);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.hero-title {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 800;
}

.hero-sub {
  margin: 10px 0 0;
  color: var(--text-dim);
  max-width: 540px;
}

/* ---------- Search status ---------- */
.search-status {
  max-width: 1200px;
  margin: 14px auto 0;
  padding: 0 20px;
  min-height: 20px;
  color: var(--text-dim);
  font-size: 0.9rem;
}

/* ---------- Rows / tracks ---------- */
.movie-rows {
  max-width: 1200px;
  margin: 10px auto 60px;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 34px;
}

.movie-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.row-header h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
}

.row-header p {
  margin: 4px 0 0;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.movie-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 160px;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 10px;
  scroll-snap-type: x mandatory;
}

.movie-track::-webkit-scrollbar {
  height: 8px;
}

.movie-track::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 999px;
}

/* ---------- Movie card ---------- */
.movie-card {
  position: relative;
  display: block;
  width: 160px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  padding: 0;
  color: var(--text);
  text-align: left;
  scroll-snap-align: start;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.movie-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.movie-card img {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  display: block;
  background: #0d1220;
}

.poster-fallback {
  width: 100%;
  aspect-ratio: 2 / 3;
  display: grid;
  place-items: center;
  padding: 12px;
  text-align: center;
  font-weight: 700;
  color: #cdd6e8;
  background: linear-gradient(135deg, #1c2436, #111726);
}

.card-label {
  padding: 10px 12px 12px;
}

.card-label h3 {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- Availability overlay ---------- */
.availability {
  position: absolute;
  inset: auto 0 0 0;
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
  color: #fff;
  background: rgba(8, 11, 18, 0.78);
  backdrop-filter: blur(4px);
}

.movie-card.is-coming {
  border-color: rgba(255, 107, 107, 0.5);
}

.movie-card.is-coming .availability {
  background: rgba(255, 107, 107, 0.9);
}

/* ---------- Skeleton ---------- */
.skeleton {
  width: 160px;
  height: 250px;
  border-radius: var(--radius);
  background: linear-gradient(100deg, #161c2b 30%, #1f2738 50%, #161c2b 70%);
  background-size: 200% 100%;
  animation: shimmer 1.3s linear infinite;
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

.empty-row {
  color: var(--text-dim);
  font-size: 0.95rem;
  padding: 8px 2px;
}

/* ---------- Modal ---------- */
.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 6, 11, 0.7);
  backdrop-filter: blur(6px);
}

.modal-dialog {
  position: relative;
  width: min(720px, 100%);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-elev);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.modal-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
}

.modal-close {
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 1.4rem;
  line-height: 1;
  transition: background 0.15s ease;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.14);
}

.results-list {
  padding: 16px 20px 22px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}

.result-item {
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-card);
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.result-item:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
}

.result-item img {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  display: block;
  background: #0d1220;
}

.result-item div {
  padding: 10px 12px 12px;
}

.result-title {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.result-meta {
  margin: 6px 0 0;
  font-size: 0.78rem;
  color: var(--accent);
}

.notice {
  grid-column: 1 / -1;
  color: var(--text-dim);
  text-align: center;
  padding: 24px 0;
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .header-inner {
    flex-wrap: wrap;
  }
  .search-form {
    order: 3;
    flex-basis: 100%;
    max-width: none;
  }
  .header-year {
    margin-left: auto;
  }
  .movie-track {
    grid-auto-columns: 132px;
  }
}


