/* ── RESET & BASE ── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0d0608;
  --surface: #160a0b;
  --surface-2: #1e0f10;
  --border: #2e1416;
  --accent: #ef4444;
  --accent-dim: rgba(239, 68, 68, 0.1);
  --accent-glow: rgba(239, 68, 68, 0.18);
  --text: #f5e8e8;
  --muted: #a06060;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Inter", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding: 0 0 80px;
}

/* ── PAGE WRAPPER ── */
.page-wrapper {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ── HEADER ── */
.page-header {
  padding: 48px 0 36px;
  text-align: center;
  position: relative;
}

.back-link {
  position: absolute;
  top: 52px;
  left: 0;
  font-size: 0.82rem;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.back-link:hover {
  color: var(--accent);
}

.header-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid rgba(239, 68, 68, 0.25);
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 16px;
}

.page-header h1 {
  font-family: "Syne", sans-serif;
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
  line-height: 1.2;
}

.header-sub {
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.6;
}

/* ── SEARCH BOX ── */
.search-box {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-bottom: 40px;
  flex-wrap: wrap;
}

#query {
  padding: 12px 18px;
  width: min(320px, 100%);
  font-family: "Inter", sans-serif;
  font-size: 0.92rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  background: var(--surface);
  color: var(--text);
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}

#query::placeholder {
  color: #604040;
}

#query:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

#searchbtn {
  padding: 12px 24px;
  font-family: "Inter", sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition:
    opacity 0.2s,
    transform 0.2s,
    box-shadow 0.2s;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.28);
  white-space: nowrap;
}

#searchbtn:hover {
  opacity: 0.88;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(239, 68, 68, 0.35);
}

/* ── VIDEO GRID ── */
#video-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 22px;
}

/* ── VIDEO CARD ── */
.video-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  transition:
    transform 0.24s ease,
    box-shadow 0.24s ease,
    border-color 0.24s ease;
}

.video-card:hover {
  transform: translateY(-5px);
  border-color: var(--accent);
  box-shadow: 0 8px 28px var(--accent-glow);
}

.video-card a {
  display: block;
}

.video-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  background: var(--surface-2);
}

.video-card h3 {
  font-family: "Syne", sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin: 14px 16px 6px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.video-card p {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0 16px 16px;
  font-weight: 500;
}

/* ── STATES ── */
.message {
  grid-column: 1 / -1;
  text-align: center;
  font-size: 1rem;
  color: #604040;
  padding: 60px 0;
}

.loader {
  grid-column: 1 / -1;
  width: 40px;
  height: 40px;
  border: 3px solid var(--surface-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 60px auto;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── RESPONSIVE ── */
@media (max-width: 480px) {
  .back-link {
    position: static;
    display: block;
    margin-bottom: 20px;
    text-align: left;
  }
  .page-header {
    padding-top: 28px;
  }
  #video-container {
    grid-template-columns: 1fr;
  }
}
