/* ==========================================================================
   PRIMEFLIX OTT - CORE DESIGN SYSTEM
   Netflix Layout Structure | Amazon Prime Video Color Aesthetics
   Sophisticated, Cinematic, Non-Flashy Design System
   ========================================================================== */

@import "https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=Bebas+Neue&display=swap";

:root {
  /* Amazon Prime Deep Navy Palette */
  --bg-darkest: #070b12;
  --bg-primary: #0a0e17;
  --bg-secondary: #0f172a;
  --bg-card: #131e31;
  --bg-card-hover: #192740;
  --bg-elevated: #162238;
  --bg-glass: rgba(10, 14, 23, 0.85);
  --bg-glass-card: rgba(19, 30, 49, 0.7);

  /* Amazon Prime Blue Accent Palette */
  --prime-blue: #00A8E1;
  --prime-blue-hover: #1A98FF;
  --prime-blue-dark: #007bb5;
  --prime-blue-subtle: rgba(0, 168, 225, 0.12);
  --prime-blue-glow: rgba(0, 168, 225, 0.22);
  --prime-cyan: #00d2d3;

  /* Neutrals & Text */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-active: rgba(0, 168, 225, 0.4);
  --border-focus: #00A8E1;

  /* Badges & Status */
  --badge-prime: #00A8E1;
  --badge-netflix-red: #e50914;
  --badge-gold: #f59e0b;
  --status-success: #10b981;
  --status-warning: #f59e0b;
  --status-error: #ef4444;

  /* Dimensions & Spacing */
  --header-height: 72px;
  --content-padding: 4vw;
  --border-radius-sm: 4px;
  --border-radius-md: 8px;
  --border-radius-lg: 12px;
  --border-radius-full: 9999px;

  /* Transitions */
  --transition-fast: 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-smooth: 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-slow: 0.45s cubic-bezier(0.16, 1, 0.3, 1);

  /* Shadows */
  --shadow-card: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-hover: 0 14px 36px rgba(0, 0, 0, 0.65), 0 0 16px rgba(0, 168, 225, 0.18);
  --shadow-modal: 0 24px 60px rgba(0, 0, 0, 0.85);
}

/* ---------------- CSS Reset & Base ---------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  overflow-x: hidden;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  background: none;
  outline: none;
  color: inherit;
}

input, select, textarea {
  font-family: inherit;
  color: var(--text-primary);
}

ul, ol {
  list-style: none;
}

img {
  max-width: 100%;
  display: block;
}

/* ---------------- Top Navigation Bar (Netflix Layout + Prime Theme) ---------------- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  padding: 0 var(--content-padding);
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 1000;
  background: linear-gradient(180deg, rgba(10, 14, 23, 0.95) 0%, rgba(10, 14, 23, 0.7) 60%, rgba(10, 14, 23, 0) 100%);
  transition: background-color var(--transition-smooth), backdrop-filter var(--transition-smooth), border-bottom var(--transition-smooth);
}

.navbar.scrolled {
  background-color: rgba(10, 14, 23, 0.96);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 36px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #ffffff;
  user-select: none;
  position: relative;
}

.brand-logo .brand-prime {
  color: #ffffff;
  font-weight: 800;
}

.brand-logo .brand-flix {
  color: var(--prime-blue);
  font-weight: 800;
  position: relative;
}

.brand-logo .prime-smile-curve {
  position: absolute;
  bottom: -4px;
  left: 2px;
  width: 90%;
  height: 5px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 22px;
}

.nav-link {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color var(--transition-fast);
  padding: 6px 0;
  position: relative;
}

.nav-link:hover {
  color: var(--text-primary);
}

.nav-link.active {
  color: #ffffff;
  font-weight: 700;
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: var(--prime-blue);
  border-radius: 2px;
}

/* Worker Status Indicator in Nav */
.worker-nav-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--border-radius-full);
  font-size: 0.76rem;
  font-weight: 600;
  background: rgba(0, 168, 225, 0.12);
  border: 1px solid rgba(0, 168, 225, 0.3);
  color: var(--prime-blue-hover);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.worker-nav-badge:hover {
  background: rgba(0, 168, 225, 0.22);
  border-color: var(--prime-blue);
  transform: translateY(-1px);
}

.worker-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--status-success);
  box-shadow: 0 0 6px var(--status-success);
}

.worker-status-dot.active {
  background-color: var(--prime-blue);
  box-shadow: 0 0 8px var(--prime-blue);
}

/* Nav Right Tools */
.nav-right {
  display: flex;
  align-items: center;
  gap: 18px;
}

/* Search Box (Expandable like Netflix) */
.nav-search-container {
  display: flex;
  align-items: center;
  position: relative;
}

.search-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: var(--text-secondary);
  transition: color var(--transition-fast), background var(--transition-fast);
}

.search-toggle-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.search-input-wrapper {
  display: flex;
  align-items: center;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(0, 168, 225, 0.35);
  border-radius: var(--border-radius-full);
  padding: 4px 12px;
  width: 0;
  opacity: 0;
  pointer-events: none;
  transition: width var(--transition-smooth), opacity var(--transition-smooth);
}

.search-input-wrapper.open {
  width: 240px;
  opacity: 1;
  pointer-events: auto;
}

.search-input-wrapper input {
  background: none;
  border: none;
  outline: none;
  font-size: 0.85rem;
  width: 100%;
  padding: 4px 8px;
  color: #ffffff;
}

.search-input-wrapper input::placeholder {
  color: var(--text-muted);
}

.search-clear-btn {
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 2px;
}

/* Notification Button */
.nav-icon-btn {
  position: relative;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  border-radius: 50%;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.nav-icon-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.nav-icon-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--prime-blue);
}

/* Profile Menu */
.nav-profile {
  position: relative;
  cursor: pointer;
}

.profile-avatar-btn {
  display: flex;
  align-items: center;
  gap: 8px;
}

.profile-avatar-img {
  width: 34px;
  height: 34px;
  border-radius: var(--border-radius-sm);
  background: linear-gradient(135deg, #00A8E1, #0f172a);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.82rem;
  border: 1px solid rgba(0, 168, 225, 0.4);
}

.profile-dropdown {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 210px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-modal);
  padding: 8px 0;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition: all var(--transition-fast);
}

.nav-profile:hover .profile-dropdown,
.profile-dropdown.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.profile-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: 0.88rem;
  color: var(--text-secondary);
  transition: background var(--transition-fast), color var(--transition-fast);
}

.profile-menu-item:hover {
  background: rgba(0, 168, 225, 0.1);
  color: var(--text-primary);
}

.profile-menu-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 6px 0;
}

/* Mobile Nav Toggle */
.mobile-nav-toggle {
  display: none;
  font-size: 1.3rem;
  color: var(--text-primary);
}

/* ---------------- Main Content Layout ---------------- */
main {
  flex: 1;
  width: 100%;
}

.page-container {
  padding: calc(var(--header-height) + 24px) var(--content-padding) 60px;
  max-width: 1720px;
  margin: 0 auto;
}

/* ---------------- Prime & Netflix Style Buttons ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
  border-radius: var(--border-radius-sm);
  padding: 10px 22px;
  font-size: 0.95rem;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

/* Amazon Prime Signature Blue Button */
.btn-primary {
  background-color: var(--prime-blue);
  color: #070b12;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(0, 168, 225, 0.35);
}

.btn-primary:hover {
  background-color: var(--prime-blue-hover);
  color: #000000;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 168, 225, 0.45);
}

.btn-primary:active {
  transform: translateY(0);
}

/* Netflix Style Semi-Transparent Secondary Button */
.btn-secondary {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.35);
}

/* Ghost / Outline Button */
.btn-outline {
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  background: transparent;
}

.btn-outline:hover {
  border-color: var(--prime-blue);
  color: #ffffff;
  background: var(--prime-blue-subtle);
}

/* Round Action Icons (Add to List, Like, Volume) */
.btn-circle {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 30, 48, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  transition: all var(--transition-fast);
  font-size: 1rem;
}

.btn-circle:hover {
  border-color: var(--prime-blue);
  background: rgba(0, 168, 225, 0.25);
  transform: scale(1.08);
}

.btn-circle.active {
  border-color: var(--prime-blue);
  background: var(--prime-blue);
  color: #0a0e17;
}

/* ---------------- Badges & Tags ---------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 3px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-prime {
  background-color: var(--prime-blue);
  color: #070b12;
}

.badge-outline {
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: var(--text-secondary);
}

.badge-gold {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-top10 {
  background-color: #e50914;
  color: #ffffff;
  font-family: 'Bebas Neue', sans-serif;
  letter-spacing: 1px;
  font-size: 0.8rem;
  padding: 1px 6px;
}

.meta-pill {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* ---------------- Content Dialog Modal (Netflix Style) ---------------- */
/* Following modern-web-guidance for scroll containment on modal dialog */
dialog#movie-detail-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(920px, 94vw);
  max-height: 92vh;
  background-color: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid rgba(0, 168, 225, 0.25);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-modal);
  padding: 0;
  overflow-y: auto;
  overscroll-behavior: contain; /* MANDATORY per modern guidance */
  z-index: 2000;
}

dialog#movie-detail-modal::backdrop {
  overflow: hidden; /* MANDATORY per modern guidance */
  overscroll-behavior: contain; /* MANDATORY per modern guidance */
  background: rgba(5, 9, 18, 0.85);
  backdrop-filter: blur(8px);
}

.modal-header-hero {
  position: relative;
  width: 100%;
  height: 380px;
  background-size: cover;
  background-position: center;
  background-color: #080d16;
}

.modal-header-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(10, 14, 23, 0.2) 0%, rgba(19, 30, 49, 0.6) 65%, var(--bg-card) 100%);
}

.modal-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(10, 14, 23, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  z-index: 10;
  transition: all var(--transition-fast);
}

.modal-close-btn:hover {
  background: rgba(0, 168, 225, 0.4);
  border-color: var(--prime-blue);
  transform: scale(1.05);
}

.modal-hero-actions {
  position: absolute;
  bottom: 28px;
  left: 36px;
  right: 36px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-hero-title {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.15;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
}

.modal-btn-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-body-content {
  padding: 24px 36px 40px;
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 36px;
}

.modal-synopsis {
  font-size: 0.98rem;
  line-height: 1.65;
  color: #cbd5e1;
  margin-bottom: 20px;
}

.modal-meta-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
}

.modal-sidebar-info {
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  border-left: 1px solid var(--border-subtle);
  padding-left: 24px;
}

.modal-sidebar-info strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* Worker Stream Tester Pill inside Modal */
.modal-worker-route-info {
  margin-top: 16px;
  padding: 12px;
  border-radius: var(--border-radius-md);
  background: rgba(0, 168, 225, 0.08);
  border: 1px dashed rgba(0, 168, 225, 0.3);
  font-size: 0.8rem;
  color: #93c5fd;
}

.modal-worker-route-info code {
  color: #67e8f9;
  font-family: monospace;
}

/* ---------------- Global Footer (Prime Video + Netflix Hybrid) ---------------- */
.site-footer {
  margin-top: auto;
  background-color: var(--bg-darkest);
  border-top: 1px solid var(--border-subtle);
  padding: 48px var(--content-padding) 36px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.footer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 28px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--border-subtle);
}

.footer-brand {
  font-size: 1.2rem;
  font-weight: 800;
  color: #ffffff;
}

.footer-worker-status-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 16px;
  border-radius: var(--border-radius-md);
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-subtle);
  font-size: 0.82rem;
}

.footer-links-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  margin-bottom: 36px;
}

.footer-col-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.footer-link-list li {
  margin-bottom: 8px;
}

.footer-link-list a {
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.footer-link-list a:hover {
  color: var(--prime-blue-hover);
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 20px;
  font-size: 0.78rem;
  color: #475569;
}

/* ---------------- Toast Notification ---------------- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background-color: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid rgba(0, 168, 225, 0.4);
  box-shadow: var(--shadow-card);
  padding: 12px 18px;
  border-radius: var(--border-radius-md);
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  animation: slideInRight 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ---------------- Floating Worker Quick Dock ---------------- */
.floating-worker-bar {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1500;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.floating-worker-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--border-radius-full);
  background: rgba(10, 14, 23, 0.92);
  border: 1px solid rgba(0, 168, 225, 0.35);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 12px rgba(0, 168, 225, 0.15);
  backdrop-filter: blur(10px);
  font-size: 0.8rem;
  font-weight: 600;
  color: #ffffff;
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.floating-worker-pill:hover {
  border-color: var(--prime-blue);
  background: rgba(15, 23, 42, 0.96);
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.6), 0 0 16px rgba(0, 168, 225, 0.25);
}

.floating-worker-drawer {
  width: 310px;
  background: rgba(10, 14, 23, 0.96);
  border: 1px solid var(--border-active);
  border-radius: var(--border-radius-md);
  padding: 16px;
  box-shadow: var(--shadow-modal);
  backdrop-filter: blur(16px);
  display: none;
  flex-direction: column;
  gap: 12px;
  animation: slideInUp 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.floating-worker-drawer.open {
  display: flex;
}

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

.floating-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #38bdf8;
}

.floating-drawer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
}

/* ---------------- Responsive Rules ---------------- */
@media (max-width: 900px) {
  .nav-links {
    display: none;
  }
  .nav-links.mobile-open {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-subtle);
    padding: 20px var(--content-padding);
    gap: 16px;
  }
  .mobile-nav-toggle {
    display: block;
  }
  .footer-links-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .modal-body-content {
    grid-template-columns: 1fr;
  }
  .modal-sidebar-info {
    border-left: none;
    border-top: 1px solid var(--border-subtle);
    padding-left: 0;
    padding-top: 20px;
  }
}
