/* ============================================================
   components.css — buttons, fields, chips, tiles, cards,
   modal, toast, drawer, skeletons, star rating, empty states
   ============================================================ */

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--bg-2);
  color: var(--text-1);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition:
    transform 0.18s var(--ease),
    box-shadow 0.28s var(--ease),
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    opacity 0.2s ease;
}
.btn:hover {
  transform: translateY(-2px);
  background: var(--bg-3);
  border-color: var(--accent-border);
}
.btn:active {
  transform: translateY(0) scale(0.97);
}
.btn:disabled {
  opacity: 0.5;
  cursor: default;
  pointer-events: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 62%, #ff8a3d));
  color: var(--on-accent);
  border-color: transparent;
  box-shadow: 0 8px 26px var(--accent-glow);
}
.btn-primary:hover {
  filter: brightness(1.06);
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 62%, #ff8a3d));
  box-shadow: 0 12px 34px var(--accent-glow);
}

.btn-ghost {
  background: transparent;
  border-color: var(--line-strong);
}
.btn-ghost:hover {
  background: var(--accent-soft);
  border-color: var(--accent-border);
}

.btn-danger {
  color: var(--danger);
  border-color: transparent;
  background: var(--danger-soft);
}
.btn-danger:hover {
  background: rgba(255, 97, 97, 0.22);
  border-color: rgba(255, 97, 97, 0.4);
}

.btn-sm {
  padding: 9px 14px;
  font-size: 12.5px;
}

/* Glass action inside tiles */
.btn-glass {
  background: rgba(10, 10, 16, 0.62);
  border-color: rgba(244, 241, 234, 0.14);
  backdrop-filter: blur(10px);
  color: var(--text-1);
}
.btn-glass:hover {
  background: rgba(10, 10, 16, 0.85);
  border-color: var(--accent-border);
  color: var(--accent);
}

/* ---- Icon button ---- */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--bg-2);
  color: var(--text-2);
  cursor: pointer;
  transition:
    transform 0.18s var(--ease),
    color 0.2s ease,
    background 0.2s ease,
    border-color 0.2s ease;
}
.icon-btn:hover {
  color: var(--accent);
  border-color: var(--accent-border);
  transform: translateY(-1px);
}
.icon-btn:active {
  transform: scale(0.94);
}

/* View toggle: show only the icon for the active view */
.view-toggle .icon-list { display: none; }
.view-toggle.is-list .icon-grid { display: none; }
.view-toggle.is-list .icon-list { display: inline-block; }

/* ---- Segmented control ---- */
.seg {
  display: inline-flex;
  gap: 3px;
  padding: 4px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.seg-btn {
  padding: 8px 15px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-3);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.seg-btn:hover {
  color: var(--text-1);
}
.seg-btn.is-active {
  background: var(--bg-3);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

/* ---- Fields ---- */
.field {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg-2);
  color: var(--text-1);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 500;
  transition: border-color 0.2s ease, box-shadow 0.28s var(--ease), background 0.2s ease;
}
.field:focus {
  outline: none;
  border-color: var(--accent-border);
  background: var(--bg-3);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.field::placeholder {
  color: var(--text-3);
}

/* Search field with icon + clear */
.field-search {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 360px;
}
.field-search > svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
}
.field-search .field {
  padding-left: 40px;
  padding-right: 40px;
  border-radius: 999px;
}
.field-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 999px;
  background: var(--bg-3);
  color: var(--text-2);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease, background 0.2s ease;
}
.field-clear:hover {
  color: var(--text-1);
  background: var(--accent-border);
}

/* ---- Chips ---- */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 22px;
}
.chip {
  padding: 7px 15px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--bg-1);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, transform 0.18s var(--ease);
}
.chip:hover {
  color: var(--text-1);
  border-color: var(--accent-border);
  transform: translateY(-1px);
}
.chip.is-active {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent);
}

/* ---- Poster tiles (grid) ---- */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--tile-min), 1fr));
  gap: clamp(10px, 1.6vw, 18px);
}
.movie-list {
  position: relative;
}
.movie-list.is-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tile {
  content-visibility: auto;
  contain-intrinsic-size: auto 310px;
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-2);
  border: 1px solid var(--line);
  transition: transform 0.28s var(--ease), box-shadow 0.34s var(--ease), border-color 0.25s ease;
}
.tile:hover,
.tile:focus-within {
  transform: translateY(-5px);
  border-color: var(--accent-border);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55), 0 0 34px var(--accent-soft);
  z-index: 2;
}
.tile:focus-visible {
  outline: 2px solid var(--accent-focus);
  outline-offset: -2px;
}

.tile-media {
  position: relative;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  background: var(--bg-1);
}
.tile-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.55s var(--ease), filter 0.4s ease;
}
.tile:hover .tile-img {
  transform: scale(1.07);
}
.tile-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(5, 5, 10, 0.9), transparent 46%);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.tile:hover .tile-scrim,
.tile:focus-within .tile-scrim {
  opacity: 1;
}

.tile-rating {
  position: absolute;
  top: 10px;
  right: 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(8, 8, 13, 0.68);
  border: 1px solid var(--line-strong);
  backdrop-filter: blur(8px);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-1);
}
.tile-rating .star-glyph {
  font-size: 11px;
}

.tile-actions {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  transform: translateY(10px);
  opacity: 0;
  transition: transform 0.28s var(--ease), opacity 0.25s ease;
}
.tile:hover .tile-actions,
.tile:focus-within .tile-actions {
  transform: none;
  opacity: 1;
}
.tile-actions .btn {
  width: 100%;
}

/* Touch devices: no hover — keep actions visible so they stay usable */
@media (hover: none) {
  .tile-scrim,
  .tile-actions {
    opacity: 1;
    transform: none;
  }
}

.tile-meta {
  padding: 11px 13px 14px;
}
.tile-title {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--text-1);
}
.tile-sub {
  margin-top: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- List rows ---- */
.row-card {
  content-visibility: auto;
  contain-intrinsic-size: auto 92px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  background: var(--bg-2);
  border: 1px solid var(--line);
  transition: transform 0.22s var(--ease), border-color 0.2s ease, background 0.2s ease;
}
.row-card:hover {
  transform: translateX(4px);
  border-color: var(--accent-border);
  background: var(--bg-3);
}
.row-poster {
  width: 52px;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}
.row-main {
  flex: 1;
  min-width: 0;
}
.row-title {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row-sub {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row-rating {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 15px;
  font-weight: 700;
  color: var(--star);
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--bg-1);
  transition: border-color 0.2s ease, background 0.2s ease;
}
.row-rating:hover {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}
.row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---- Search hero / spotlight result ---- */
.spotlight {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-xl);
  border: 1px solid var(--line-strong);
  background: var(--bg-1);
  box-shadow: var(--shadow-lg);
  animation: spotlightIn 0.6s var(--ease) both;
}
.spotlight-bg {
  position: absolute;
  inset: -60px;
  background-size: cover;
  background-position: center;
  filter: blur(34px) saturate(1.4) brightness(0.55);
  opacity: 0.5;
}
.spotlight-veil {
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, rgba(7, 7, 11, 0.94) 0%, rgba(7, 7, 11, 0.82) 42%, rgba(7, 7, 11, 0.45) 100%);
}
.spotlight-inner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(190px, 250px) 1fr;
  gap: 30px;
  padding: clamp(20px, 3.5vw, 36px);
}
.spotlight-poster {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  transition: transform 0.45s var(--ease);
}
.spotlight:hover .spotlight-poster {
  transform: translateY(-6px) rotate(-1deg);
}
.spotlight-info {
  min-width: 0;
}
.spotlight-top {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.spotlight-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-2);
  border: 1px solid var(--line-strong);
  color: var(--text-2);
}
.spotlight-status.is-watched { color: var(--star); border-color: var(--accent-border); }
.spotlight-status.is-queued  { color: #8ab4ff; border-color: rgba(138, 180, 255, 0.35); }
.spotlight-status.is-new     { color: var(--text-1); }
.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulseDot 1.8s ease infinite;
}
.spotlight-type {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-3);
}
.spotlight-title {
  font-size: clamp(24px, 4vw, 36px);
  line-height: 1.12;
  color: var(--text-1);
}
.spotlight-year {
  color: var(--text-3);
  font-weight: 400;
}
.spotlight-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}
.spotlight-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
}
.spotlight-chip b {
  color: var(--accent);
  font-weight: 700;
}
.spotlight-plot {
  font-size: 14.5px;
  color: var(--text-2);
  max-width: 60ch;
  margin-bottom: 16px;
}
.spotlight-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px 22px;
  margin-bottom: 20px;
}
.spotlight-fact dt {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-3);
}
.spotlight-fact dd {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-1);
  margin-top: 2px;
}

.rate-block {
  padding: 16px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  margin-bottom: 18px;
}
.rate-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-3);
  margin-bottom: 10px;
}
.rate-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.rate-input {
  width: 86px;
  text-align: center;
  border-radius: 999px;
  padding: 10px 12px;
}
.rate-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--star);
  min-width: 44px;
  text-align: center;
}

.stars {
  display: flex;
  gap: 2px;
}
.star {
  border: none;
  background: none;
  font-size: 24px;
  line-height: 1;
  color: var(--bg-3);
  cursor: pointer;
  padding: 2px;
  transition: transform 0.15s var(--ease), color 0.15s ease, text-shadow 0.2s ease;
}
.star:hover {
  transform: scale(1.22) rotate(-8deg);
}
.star.is-on {
  color: var(--star);
  text-shadow: 0 0 14px var(--accent-glow);
}

.spotlight-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ---- Empty states ---- */
.empty {
  text-align: center;
  padding: 72px 20px;
  color: var(--text-2);
  animation: riseIn 0.5s var(--ease) both;
}
.empty-icon {
  font-size: 44px;
  margin-bottom: 14px;
  filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.5));
}
.empty-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 6px;
}
.empty-hint {
  font-size: 14px;
  color: var(--text-3);
  max-width: 46ch;
  margin: 0 auto;
}

/* ---- Skeletons ---- */
.skeleton {
  background: linear-gradient(100deg, var(--bg-2) 40%, var(--bg-3) 50%, var(--bg-2) 60%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
.skeleton-tile {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 2 / 3.1;
}
.skeleton-media {
  position: relative;
  flex: 1;
}
.skeleton-line {
  height: 10px;
  border-radius: 99px;
}
.w-40 { width: 40%; }
.w-70 { width: 70%; }
.w-90 { width: 90%; }
.skeleton-meta {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.skeleton-card {
  display: flex;
  gap: 24px;
  padding: 28px;
  border-radius: var(--radius-xl);
  background: var(--bg-2);
  border: 1px solid var(--line);
  animation: riseIn 0.4s var(--ease) both;
}
.skeleton-poster {
  width: 200px;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius-lg);
  flex-shrink: 0;
}
.skeleton-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  justify-content: center;
}

/* ---- Toast ---- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 90px);
  z-index: var(--z-toast);
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: min(90vw, 500px);
  padding: 14px 16px 14px 22px;
  border-radius: 999px;
  background: rgba(18, 18, 26, 0.9);
  border: 1px solid var(--line-strong);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.38s var(--ease), opacity 0.3s ease;
}
.toast.is-visible {
  transform: translate(-50%, 0);
  opacity: 1;
  pointer-events: auto;
}
.toast-msg {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-1);
}
.toast-action {
  border: none;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
.toast-action:hover {
  background: var(--accent-border);
  color: var(--on-accent);
}
.toast-progress {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 6px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
  transform-origin: left;
}

/* ---- Modal ---- */
.modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(4, 4, 8, 0.62);
  backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.modal.show {
  opacity: 1;
  pointer-events: auto;
}
.modal-card {
  position: relative;
  width: min(420px, 100%);
  padding: 30px 28px 24px;
  border-radius: var(--radius-xl);
  background: var(--bg-2);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-lg);
  transform: translateY(18px) scale(0.97);
  transition: transform 0.36s var(--ease);
}
.modal.show .modal-card {
  transform: none;
}
.modal-card h3 {
  font-size: 24px;
  margin-bottom: 6px;
}
.modal-sub {
  font-size: 13.5px;
  color: var(--text-3);
  margin-bottom: 18px;
}
.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
}
.modal-input {
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  padding: 14px;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* ---- Drawer ---- */
.drawer {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  background: rgba(4, 4, 8, 0.5);
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.drawer.open {
  opacity: 1;
  pointer-events: auto;
}
.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(440px, 100%);
  overflow-y: auto;
  background: var(--bg-1);
  border-left: 1px solid var(--line-strong);
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  transition: transform 0.46s var(--ease);
}
.drawer.open .drawer-panel {
  transform: none;
}
.drawer-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 22px;
  background: rgba(13, 13, 20, 0.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.drawer-head h3 {
  font-size: 21px;
}
.drawer-body {
  padding: 20px 22px 34px;
}
