/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  min-height: 40px;
  padding: 0 var(--sp-4);
  font-size: var(--text-sm);
  transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}

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

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

.fav-heart {
  display: inline-block;
  transition: color var(--dur-fast) var(--ease-out);
}

#btn-fav-modal[aria-pressed="true"] .fav-heart {
  color: var(--brand-crimson);
}

@keyframes heartPulse {
  0% { transform: scale(1); }
  45% { transform: scale(1.25); }
  100% { transform: scale(1); }
}

.btn-fav-pulse .fav-heart {
  animation: heartPulse 260ms var(--ease-spring-soft);
}

.btn-sm {
  min-height: 36px;
  padding: 0 var(--sp-3);
  font-size: var(--text-xs);
}

.btn-lg {
  min-height: 46px;
  padding: 0 var(--sp-6);
  font-size: var(--text-body);
}

.btn-primary {
  background: var(--accent-primary);
  color: var(--text-on-accent);
  font-weight: 700;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-primary-hover);
}

.btn-secondary {
  background: var(--bg-surface);
  border-color: var(--border-default);
  color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-surface-hover);
  border-color: var(--border-strong);
}

.btn-glass {
  background: var(--glass-pill);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-color: var(--border-default);
  color: var(--text-primary);
}

.btn-glass:hover:not(:disabled) {
  background: var(--glass-pill-hover);
  border-color: var(--border-strong);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border-default);
  color: var(--text-secondary);
}

.btn-ghost:hover:not(:disabled) {
  color: var(--text-primary);
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.04);
}

.btn-danger {
  background: var(--status-danger);
  color: #1c0505;
  font-weight: 700;
}

.btn-danger:hover:not(:disabled) {
  filter: brightness(1.08);
}

.btn-danger-ghost {
  background: var(--status-danger-bg);
  border-color: rgba(248, 113, 113, 0.35);
  color: var(--status-danger);
}

.btn-danger-ghost:hover:not(:disabled) {
  background: rgba(248, 113, 113, 0.22);
}

/* User Menu Dropdown */
.user-menu {
  position: relative;
}

.user-trigger {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: 38px;
  padding: 3px 12px 3px 4px;
  border-radius: var(--radius-pill);
  background: rgba(23, 23, 28, 0.85);
  border: 1px solid var(--border-default);
  overflow: hidden;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}

.user-trigger .profile-avatar-graphic.avatar-sm {
  border-radius: 50%;
}

.user-trigger .chevron {
  transition: transform 180ms var(--ease-out);
}

.user-trigger[aria-expanded="true"] .chevron {
  transform: rotate(180deg);
}

.user-trigger:hover {
  border-color: var(--border-strong);
  background: var(--bg-surface-hover);
}

.user-trigger:active {
  transform: scale(0.97);
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.profile-avatar-graphic {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
}

.profile-avatar-graphic.avatar-sm {
  width: 28px;
  height: 28px;
}

.profile-avatar-graphic.avatar-sm svg {
  width: 18px;
  height: 18px;
}

.profile-avatar-graphic.avatar-md {
  width: 36px;
  height: 36px;
  border-radius: 8px;
}

.profile-avatar-graphic.avatar-md svg {
  width: 22px;
  height: 22px;
}

.user-short-name {
  font-size: var(--text-sm);
  font-weight: 600;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kids-mini-tag {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 2px 5px;
  border-radius: 4px;
  background: #0ea5e9;
  color: #ffffff;
}

@keyframes dropdownIn {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(264px, calc(100vw - 24px));
  background: rgba(16, 16, 20, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  padding: var(--sp-2);
  z-index: var(--z-dropdown);
  transform-origin: top right;
  animation: dropdownIn 160ms var(--ease-spring-soft);
}

.dropdown-head {
  padding: var(--sp-2) var(--sp-3) var(--sp-3);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: var(--sp-1);
}

.dropdown-profile-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.dropdown-profile-meta {
  min-width: 0;
  flex: 1;
}

.dropdown-name {
  font-weight: 600;
  font-size: var(--text-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-email {
  font-size: var(--text-xs);
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropdown-verify-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
}

.badge-verify {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--status-warning-bg);
  color: var(--status-warning);
}

.badge-verify.ok {
  background: var(--status-success-bg);
  color: var(--status-success);
}

.link-inline {
  background: none;
  border: none;
  color: var(--accent-secondary);
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}

.dropdown-item {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px var(--sp-3);
  font-size: var(--text-sm);
  color: var(--text-primary);
  cursor: pointer;
  transition: background 120ms var(--ease-out), color 120ms var(--ease-out);
}

.dropdown-item:hover {
  background: var(--bg-surface-hover);
}

.dropdown-item.danger {
  color: var(--status-danger);
}

.dropdown-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: var(--sp-1) 0;
}

/* Hero Editorial Multicamadas */
.hero {
  position: relative;
  min-height: 62vh;
  max-height: 680px;
  margin-top: -64px;
  padding-top: 64px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  background: var(--bg-elevated);
}

.hero[hidden] {
  display: none;
}

@keyframes heroKenBurns {
  from {
    transform: scale(1.06);
  }
  to {
    transform: scale(1);
  }
}

.hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 22%;
  opacity: 0;
  transform: scale(1.06);
  transition: opacity 420ms var(--ease-out);
  will-change: transform, opacity;
}

.hero-bg.is-loaded {
  opacity: 1;
  animation: heroKenBurns 14s var(--ease-out) forwards;
}

@media (prefers-reduced-motion: reduce) {
  .hero-bg {
    transform: none;
  }
}

.hero-scrim-radial {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background: var(--scrim-hero-radial);
}

.hero::before,
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.hero::before {
  background: var(--scrim-hero-left);
}

.hero::after {
  background: var(--scrim-hero-bottom);
}

.hero-inner {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: var(--sp-8) var(--sp-6) var(--sp-12);
}

@keyframes heroReveal {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-content {
  max-width: 640px;
}

.hero-content > * {
  animation: heroReveal 320ms var(--ease-out) backwards;
}
.hero-content > *:nth-child(1) { animation-delay: 0ms; }
.hero-content > *:nth-child(2) { animation-delay: 45ms; }
.hero-content > *:nth-child(3) { animation-delay: 90ms; }
.hero-content > *:nth-child(4) { animation-delay: 135ms; }
.hero-content > *:nth-child(5) { animation-delay: 180ms; }

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: var(--sp-3);
}

.eyebrow-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.eyebrow-pill::before {
  content: '';
  width: 3px;
  height: 12px;
  border-radius: 2px;
  background: var(--brand-crimson);
}

.hero h1 {
  font-family: var(--font-display);
  font-size: var(--text-hero);
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -0.025em;
  margin-bottom: var(--sp-3);
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.55);
}

.hero-meta {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  margin-bottom: var(--sp-3);
}

.meta-sep {
  color: var(--text-muted);
}

.hero-overview {
  max-width: 52ch;
  color: var(--text-secondary);
  font-size: var(--text-body);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: var(--sp-5);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
}

@media (max-width: 1023px) {
  .hero {
    min-height: 50vh;
    margin-top: 0;
    padding-top: 0;
  }
}

@media (max-width: 639px) {
  .hero {
    min-height: 44vh;
    max-height: 520px;
  }
  .hero::before {
    background: linear-gradient(180deg, rgba(7, 7, 9, 0.35) 0%, rgba(7, 7, 9, 0.86) 55%, var(--bg-canvas) 100%);
  }
  .hero-inner {
    padding: var(--sp-5) var(--sp-4) var(--sp-6);
  }
  .hero-actions .btn {
    flex: 1 1 auto;
  }
}

/* Media Cards (Semantic <button>) */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  text-align: left;
  width: 100%;
  min-width: 0;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: transform 220ms var(--ease-spring-soft);
}

.card:hover,
.card:focus-visible {
  transform: translateY(-4px);
}

.card:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 3px;
  box-shadow: none;
}

.card-poster-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow 220ms var(--ease-spring-soft);
}

.card-poster-wrap::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  z-index: 3;
  pointer-events: none;
  background: linear-gradient(90deg, transparent 8%, rgba(255, 255, 255, 0.34) 50%, transparent 92%);
  opacity: 0;
  transition: opacity 220ms var(--ease-out);
}

.card:hover .card-poster-wrap::before,
.card:focus-visible .card-poster-wrap::before {
  opacity: 1;
}

.card:hover .card-poster-wrap,
.card:focus-visible .card-poster-wrap {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-card-hover);
}

.card-poster-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: transform 320ms var(--ease-out), opacity 240ms var(--ease-out);
}

.card-poster-wrap img.is-loaded {
  opacity: 1;
}

.card:hover .card-poster-wrap img,
.card:focus-visible .card-poster-wrap img {
  transform: scale(1.045);
}

.card-enter {
  animation: fadeSlideUp 220ms var(--ease-out) backwards;
}

.card-resume-badge {
  position: absolute;
  left: 8px;
  bottom: 10px;
  z-index: 3;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(7, 7, 9, 0.78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding-left: 1px;
  pointer-events: none;
  transition: opacity var(--dur-fast) var(--ease-out);
}

.card.is-history:hover .card-resume-badge {
  opacity: 0;
}

.card-resume-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  z-index: 3;
  background: var(--brand-crimson);
  pointer-events: none;
}

.tag {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  background: rgba(7, 7, 9, 0.76);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--text-primary);
  border: 1px solid rgba(244, 244, 245, 0.25);
}

.tag.tv {
  color: var(--accent-secondary);
  border-color: rgba(96, 165, 250, 0.35);
}

.tag-inline {
  position: static;
  display: inline-flex;
}

.tag-ep {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  padding: 3px 7px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  background: rgba(8, 11, 16, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--text-primary);
  border: 1px solid var(--border-hairline);
}

.ov {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: var(--sp-2);
  padding: var(--sp-3);
  background: var(--scrim-card);
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease-out);
}

.card:hover .ov,
.card:focus-visible .ov {
  opacity: 1;
}

.ov-play {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--accent-primary);
  color: var(--text-on-accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
  transform: translateY(6px) scale(0.92);
  transition: transform 200ms var(--ease-spring-soft);
}

.card:hover .ov-play,
.card:focus-visible .ov-play {
  transform: translateY(0) scale(1);
}

.ov-s {
  font-size: var(--text-xs);
  line-height: 1.4;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transform: translateY(4px);
  transition: transform 200ms var(--ease-out);
}

.card:hover .ov-s,
.card:focus-visible .ov-s {
  transform: translateY(0);
}

.card-meta {
  padding: 10px 2px 4px;
  width: 100%;
}

.card-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-sub {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.rate {
  font-family: var(--font-mono);
  color: var(--accent-amber);
  font-weight: 600;
}

/* Skeletons (GPU-composited) */
@keyframes shimmerSlide {
  100% {
    transform: translateX(100%);
  }
}

.skeleton-box {
  position: relative;
  overflow: hidden;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
}

.skeleton-box::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.06) 50%, transparent 100%);
  animation: shimmerSlide 1.35s infinite var(--ease-out);
}

.skeleton-hero {
  height: 50vh;
  max-height: 520px;
  margin-bottom: var(--sp-6);
  border-radius: var(--radius-lg);
}

.skeleton-card {
  border-radius: var(--radius-md);
  overflow: hidden;
  background: transparent;
}

.skeleton-poster {
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius-md);
}

.skeleton-lines {
  padding: 10px 2px 4px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.skeleton-line {
  height: 12px;
  border-radius: 4px;
}

.skeleton-line.short {
  width: 60%;
}

/* State Cards (Error / Empty) */
.state-card {
  max-width: 480px;
  margin: var(--sp-12) auto;
  padding: var(--sp-8) var(--sp-6);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
}

.state-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg-surface);
  color: var(--accent-amber);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.state-card h3 {
  font-family: var(--font-display);
  font-size: var(--text-h3);
}

.state-card p {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.state-card-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
}

/* Library Sections */
.load-more-wrap {
  display: flex;
  justify-content: center;
  margin-top: var(--sp-8);
}

.load-more-wrap .btn {
  min-width: 180px;
}

.library-block {
  margin-bottom: var(--sp-8);
}

.library-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}

.inline-create-list {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
  margin-bottom: var(--sp-5);
}

.inline-create-list input {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 0 var(--sp-3);
  min-height: 40px;
  font-size: var(--text-sm);
  min-width: 220px;
}

/* Toasts */
@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.toast-region {
  position: fixed;
  top: 76px;
  right: var(--sp-5);
  bottom: auto;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  max-width: 360px;
  width: calc(100% - 32px);
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: 12px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-left: 4px solid var(--accent-secondary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-modal);
  font-size: var(--text-sm);
  color: var(--text-primary);
  animation: toastIn 200ms var(--ease-spring-soft);
  transition: opacity 160ms var(--ease-out), transform 160ms var(--ease-out);
}

.toast.toast--leaving {
  opacity: 0;
  transform: translateY(-6px) scale(0.97);
  pointer-events: none;
}

.toast.success {
  border-left-color: var(--status-success);
}

.toast.error {
  border-left-color: var(--status-danger);
}

.toast.info {
  border-left-color: var(--status-info);
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 4px;
}

@media (max-width: 639px) {
  .toast-region {
    bottom: auto;
    top: var(--sp-3);
    right: 50%;
    transform: translateX(50%);
  }
}
