/* ============================================================
   K - modal.css  (glass modal — trailer, metadata, cast, etc.)
   ============================================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4vh 2vw;
}

.modal-panel {
  position: relative;
  width: min(960px, 94vw);
  max-height: 88vh;
  border-radius: 16px;
  background: var(--surface-1);
  border: 1px solid var(--glass-border);
  box-shadow: 0 32px 64px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: k-modal-in 0.28s ease;
}

@keyframes k-modal-in {
  from { opacity: 0; transform: scale(0.96) translateY(10px); }
  to   { opacity: 1; transform: none; }
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(11, 15, 20, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  transition: background 0.2s ease;
}

.modal-close:hover {
  background: var(--primary);
}

.modal-close .icon {
  width: 1.1em;
  height: 1.1em;
}

/* header media */
.modal-media {
  position: relative;
  aspect-ratio: 16 / 7;
  background: var(--bg);
  flex-shrink: 0;
  overflow: hidden;
}

.modal-media img,
.modal-media iframe {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.modal-media iframe {
  border: 0;
  object-fit: unset;
}

.modal-media-fade {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 50%, var(--surface-1) 100%);
  pointer-events: none;
}

/* body content */
.modal-body {
  padding: 24px 28px 32px;
  overflow-y: auto;
  flex: 1;
}

.modal-title {
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 1.8vw, 1.8rem);
  font-weight: 800;
}

.modal-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin: 10px 0 16px;
  font-size: 13px;
  color: rgba(238, 241, 246, 0.85);
}

.modal-meta .meta-rating {
  color: var(--accent-hi);
  font-weight: 500;
}

.modal-buttons {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.modal-buttons .btn {
  font-size: clamp(12px, 0.95vw, 15px);
  padding: 0.65em 1.4em;
}

.modal-desc {
  font-size: clamp(13px, 1vw, 15px);
  color: rgba(238, 241, 246, 0.78);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 16px;
}

/* cast row */
.modal-cast {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 24px;
}

.cast-member {
  flex: 0 0 auto;
  text-align: center;
  width: 64px;
}

.cast-member img {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-2);
  margin-bottom: 4px;
}

.cast-member .cast-name {
  font-size: 10px;
  color: var(--text);
  line-height: 1.3;
}

.cast-member .cast-role {
  font-size: 9px;
  color: var(--text-mid);
}

.cast-avatar-placeholder {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-mid);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
}

/* seasons / episodes */
.modal-section-title {
  font-family: var(--font-display);
  font-size: clamp(14px, 1.1vw, 17px);
  font-weight: 700;
  margin-bottom: 12px;
}

.season-select-wrap {
  margin-bottom: 16px;
}

.season-select {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  font-size: 13px;
  padding: 8px 28px 8px 12px;
  appearance: none;
  cursor: pointer;
}

.episode-row {
  display: flex;
  gap: 12px;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.episode-row:hover {
  background: rgba(255, 255, 255, 0.04);
}

.episode-row .ep-thumb {
  flex: 0 0 160px;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-2);
  position: relative;
}

.episode-row .ep-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.episode-row .ep-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  color: var(--text);
  transition: opacity 0.2s ease;
}

.episode-row:hover .ep-play {
  opacity: 1;
}

.episode-row .ep-info {
  flex: 1;
  min-width: 0;
}

.episode-row .ep-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.episode-row .ep-num {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-mid);
  flex-shrink: 0;
}

.episode-row .ep-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.episode-row .ep-runtime {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-mid);
  flex-shrink: 0;
}

.episode-row .ep-overview {
  font-size: 12px;
  color: var(--text-mid);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 4px;
}

.modal-more {
  margin-top: 24px;
}

@media (max-width: 768px) {
  .modal-overlay {
    padding: 0;
    align-items: stretch;
  }
  .modal-panel {
    width: 100vw;
    max-height: 100vh;
    border-radius: 0;
  }
  .episode-row .ep-thumb {
    flex-basis: 110px;
  }

  .modal-body {
    padding: 18px 14px 26px;
  }
}
