/* Movie Picker page styles */

.picker-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: start;
  margin-top: 1.5rem;
}

@media (width <= 768px) {
  .picker-layout {
    grid-template-columns: 1fr;
  }
}

/* ---------- Left panel ---------- */
.picker-panel h2 {
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1.2rem;
}

.search-container {
  position: relative;
  margin-bottom: 1rem;
}

.search-container input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  font-size: 1rem;
  border: 1px solid var(--border-color, #ccc);
  border-radius: 6px;
  background: var(--input-bg, #fff);
  color: var(--text-color, #222);
  box-sizing: border-box;
}

.search-container input:focus {
  outline: 2px solid var(--link-color, #4a90d9);
  border-color: transparent;
}

.search-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--card-bg, #fff);
  border: 1px solid var(--border-color, #ccc);
  border-radius: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
  z-index: 100;
  max-height: 260px;
  overflow-y: auto;
  box-shadow: 0 4px 12px rgb(0 0 0 / 12%);
}

.search-dropdown li {
  padding: 0.6rem 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: background 0.1s;
}

.search-dropdown .movie-thumb {
  width: 32px;
  height: 48px;
  object-fit: cover;
  border-radius: 3px;
  flex-shrink: 0;
  background: var(--border-color, #ccc);
}

.search-dropdown .movie-thumb-placeholder {
  width: 32px;
  height: 48px;
  border-radius: 3px;
  background: var(--border-color, #ccc);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.search-dropdown .movie-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.search-dropdown .movie-title {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-dropdown .movie-year {
  font-size: 0.8rem;
  color: var(--muted-color, #888);
}

.search-status {
  font-size: 0.85rem;
  color: var(--muted-color, #888);
  margin-top: 0.25rem;
  min-height: 1.2em;
}

.movie-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  max-height: 320px;
  overflow-y: auto;
}

.movie-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border-color, #eee);
  gap: 0.5rem;
}

.movie-list .movie-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.movie-list .remove-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted-color, #888);
  font-size: 1rem;
  padding: 0 0.25rem;
  line-height: 1;
  transition: color 0.15s;
}

.search-dropdown li:hover,
.search-dropdown li[aria-selected='true'] {
  background: var(--hover-bg, rgb(74 144 217 / 10%));
}

.movie-list li:last-child {
  border-bottom: none;
}

.movie-list .remove-btn:hover {
  color: #e53e3e;
}

.empty-msg {
  color: var(--muted-color, #888);
  font-style: italic;
  padding: 0.5rem 0;
  justify-content: center !important;
  border-bottom: none !important;
}

.pick-btn {
  width: 100%;
  padding: 0.75rem;
  font-size: 1.1rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  background: var(--link-color, #4a90d9);
  color: #fff;
  cursor: pointer;
  transition:
    background 0.15s,
    opacity 0.15s;
}

.pick-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.pick-btn:hover:not(:disabled) {
  background: #3278c2;
}

/* ---------- Right panel ---------- */
.result-panel {
  position: sticky;
  top: 1rem;
}

.result-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  color: var(--muted-color, #888);
  text-align: center;
  gap: 0.75rem;
}

.placeholder-icon {
  font-size: 3rem;
}

.result-card {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
}

.result-poster {
  width: 140px;
  min-width: 140px;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgb(0 0 0 / 20%);
  object-fit: cover;
}

.result-poster-placeholder {
  width: 140px;
  min-width: 140px;
  height: 210px;
  border-radius: 8px;
  background: var(--border-color, #ccc);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
}

.result-info {
  flex: 1;
}

.result-info h3 {
  margin-top: 0;
  margin-bottom: 0.4rem;
  font-size: 1.3rem;
}

.result-meta {
  color: var(--muted-color, #888);
  margin: 0.2rem 0;
  font-size: 0.95rem;
}

.providers-section {
  margin-top: 1rem;
}

.providers-section h4 {
  margin: 0.75rem 0 0.4rem;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-color, #888);
}

.providers-section h4:first-child {
  margin-top: 0;
}

.provider-logos {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.provider-logo {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--border-color, #eee);
}

.no-providers {
  font-size: 0.9rem;
  color: var(--muted-color, #888);
  font-style: italic;
}

.result-error {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  background: rgb(229 62 62 / 10%);
  color: #c53030;
  font-size: 0.95rem;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Loading spinner */
.spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  border: 2px solid currentcolor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 0.4em;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
