/* —
   i2i OMDb Movie Search — responsive layout
   — */

:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --surface-elevated: #243044;
  --border: #2d3a4f;
  --text: #e8eef7;
  --text-muted: #9fb0c8;
  --accent: #3d9cf5;
  --accent-hover: #5cb0ff;
  --danger: #f87171;
  --radius: 12px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(1200px 600px at 10% -10%, #1e3a5f 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #2d1f4e 0%, transparent 50%), var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a {
  color: var(--accent);
}

a:hover {
  color: var(--accent-hover);
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  padding: 0.75rem 1rem;
  background: var(--accent);
  color: #0b1220;
  z-index: 100;
}

.skip-link:focus {
  left: 0.5rem;
  top: 0.5rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.container {
  width: min(1120px, 100% - 2rem);
  margin-inline: auto;
}

.site-header {
  border-bottom: 1px solid var(--border);
  background: rgba(15, 20, 25, 0.85);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.25rem;
  padding-block: 1.25rem;
}

.brand h1 {
  margin: 0;
  font-size: clamp(1.35rem, 2.5vw, 1.75rem);
  letter-spacing: -0.02em;
}

.tagline {
  margin: 0.25rem 0 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.search-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  flex: 1 1 280px;
  max-width: min(520px, 100%);
}

.search-bar input[type="search"] {
  flex: 1 1 180px;
  min-height: 44px;
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
}

.search-bar input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn-primary,
.btn-ghost {
  min-height: 44px;
  padding: 0 1.1rem;
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-size: 1rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #2563eb);
  color: #fff;
}

.btn-primary:hover {
  filter: brightness(1.06);
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-ghost {
  width: 100%;
  margin-top: 0.5rem;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

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

.layout {
  display: grid;
  grid-template-columns: minmax(0, 260px) minmax(0, 1fr);
  gap: 1.5rem;
  padding-block: 1.75rem 3rem;
  align-items: start;
}

.filters-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  position: sticky;
  top: 6.5rem;
}

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

.filters-hint {
  margin: 0 0 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.filter-group {
  margin-bottom: 1rem;
}

.filter-group label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.filter-group input,
.filter-group select {
  width: 100%;
  min-height: 42px;
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  color: var(--text);
  font-size: 0.95rem;
}

.filter-group input:focus-visible,
.filter-group select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.main-panel {
  min-width: 0;
}

.status-banner {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

.status-hidden,
.error-hidden,
.movie-hidden {
  display: none !important;
}

.status-banner:not(.status-hidden):not(.error-hidden) {
  display: block;
}

.info-banner {
  background: rgba(61, 156, 245, 0.12);
  border: 1px solid rgba(61, 156, 245, 0.35);
}

.error-banner {
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.45);
  color: #fecaca;
}

.movie-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  min-height: 280px;
}

.results-hidden {
  display: none !important;
}

.results-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.75rem;
  margin-bottom: 0.75rem;
}

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

.results-meta {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.results-items {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.6rem;
}

.result-item {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
}

.result-item:hover {
  border-color: rgba(61, 156, 245, 0.6);
}

.result-poster {
  width: 56px;
  height: 80px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
}

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

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

.result-title {
  margin: 0;
  font-weight: 700;
  font-size: 0.98rem;
}

.result-sub {
  margin: 0.25rem 0 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.results-more {
  margin-top: 0.75rem;
}

.placeholder-card {
  color: var(--text-muted);
  max-width: 42ch;
}

.placeholder-card p {
  margin: 0;
}

.movie-card {
  display: grid;
  grid-template-columns: minmax(0, 220px) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

.movie-poster-wrap {
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-elevated);
  aspect-ratio: 2 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
}

.movie-poster-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.poster-fallback {
  padding: 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.movie-info h2 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.25rem, 2.5vw, 1.6rem);
}

.movie-meta {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  display: grid;
  gap: 0.35rem;
}

.movie-meta li {
  font-size: 0.95rem;
}

.movie-meta strong {
  color: var(--text-muted);
  font-weight: 600;
  margin-right: 0.35rem;
}

.movie-plot {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding-block: 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer-inner p {
  margin: 0;
}

@media (max-width: 840px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .filters-panel {
    position: static;
  }

  .movie-card {
    grid-template-columns: minmax(0, 180px) minmax(0, 1fr);
  }
}

@media (max-width: 560px) {
  .header-inner {
    flex-direction: column;
    align-items: stretch;
  }

  .search-bar {
    max-width: none;
  }

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

  .movie-poster-wrap {
    max-width: 220px;
    margin-inline: auto;
  }
}
