/* ==========================================================================
   MOVY.SX UI THEME & COMPONENT STYLES
   ========================================================================== */

:root {
  --bg-main: #07090e;
  --bg-surface: #0f1219;
  --bg-surface-elevated: #161b26;
  --bg-glass: rgba(15, 18, 25, 0.85);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(99, 102, 241, 0.4);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --accent: #06b6d4;
  --gold: #f59e0b;
  --green: #10b981;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
  --transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
  background: #232b3d;
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: #37445e;
}

/* ---------------- NAVBAR ---------------- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 72px;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 100;
}

.nav-container {
  max-width: 1440px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
}

.nav-left, .nav-right {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #fff;
  text-decoration: none;
}

.logo-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #6366f1, #3b82f6);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}

.logo-accent {
  color: var(--primary);
  font-size: 1rem;
}

.nav-links {
  display: flex;
  gap: 0.5rem;
}

.nav-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition);
}

.nav-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.nav-btn.active {
  color: #fff;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
}

/* Search Box */
.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 1rem;
  color: var(--text-muted);
  pointer-events: none;
}

.search-box input {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 0.65rem 3rem 0.65rem 2.8rem;
  color: #fff;
  font-family: inherit;
  font-size: 0.9rem;
  width: 280px;
  transition: var(--transition);
}

.search-box input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.09);
  border-color: var(--primary);
  width: 340px;
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.25);
}

.search-kbd {
  position: absolute;
  right: 1rem;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  pointer-events: none;
}

/* Search Dropdown */
.search-dropdown {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 380px;
  max-height: 480px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  overflow-y: auto;
  display: none;
  z-index: 150;
}

.search-dropdown.active {
  display: block;
}

.search-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: var(--transition);
}

.search-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.search-item img {
  width: 44px;
  height: 64px;
  border-radius: 6px;
  object-fit: cover;
  background: #1b212f;
}

.search-item-info h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 0.2rem;
}

.search-item-info p {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Status Pill */
.status-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-full);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
}

/* ---------------- HERO SPOTLIGHT ---------------- */
.hero-section {
  position: relative;
  min-height: 75vh;
  display: flex;
  align-items: flex-end;
  padding: 8rem 2rem 4rem 2rem;
  overflow: hidden;
}

.hero-backdrop {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center top;
  filter: brightness(0.65);
  transition: background-image 0.5s ease-in-out;
  z-index: 1;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(7, 9, 14, 0.2) 0%, rgba(7, 9, 14, 0.8) 70%, var(--bg-main) 100%),
              linear-gradient(90deg, var(--bg-main) 0%, rgba(7, 9, 14, 0.7) 40%, transparent 100%);
  z-index: 2;
}

.hero-content {
  position: relative;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
  z-index: 3;
}

.hero-badges {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-primary {
  background: var(--primary);
  color: #fff;
}

.badge-glass {
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.badge-quality {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #fff;
}

.hero-title {
  font-size: 3.2rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
}

.hero-overview {
  font-size: 1.05rem;
  color: #cbd5e1;
  line-height: 1.6;
  margin-bottom: 2rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}

.hero-actions {
  display: flex;
  gap: 1rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.85rem 1.6rem;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: var(--transition);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(99, 102, 241, 0.6);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: translateY(-2px);
}

/* ---------------- MAIN CONTENT & GRID ---------------- */
.main-content {
  max-width: 1440px;
  margin: 0 auto;
  padding: 3rem 2rem 6rem 2rem;
}

.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 1.2rem;
}

.section-title {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.section-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  display: block;
  margin-top: 0.2rem;
}

.filter-pills {
  display: flex;
  gap: 0.5rem;
}

.filter-pill {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition);
}

.filter-pill:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.filter-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* Media Cards Grid */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1.6rem;
}

.media-card {
  position: relative;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  border: 1px solid var(--border-subtle);
  transition: var(--transition);
}

.media-card:hover {
  transform: translateY(-6px) scale(1.02);
  border-color: var(--border-glow);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.7), 0 0 20px rgba(99, 102, 241, 0.2);
}

.poster-wrap {
  position: relative;
  width: 100%;
  padding-top: 150%; /* 2:3 aspect ratio */
  background: #151b27;
  overflow: hidden;
}

.poster-wrap img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.media-card:hover .poster-wrap img {
  transform: scale(1.08);
}

.rating-badge {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  color: var(--gold);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.card-info {
  padding: 0.9rem;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.25rem;
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.card-type {
  font-weight: 600;
  text-transform: uppercase;
}

/* ---------------- MODALS ---------------- */
.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1.5rem;
}

.modal.active {
  display: flex;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
}

.modal-container {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  max-width: 1000px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.9);
  z-index: 10;
}

.modal-sm {
  max-width: 640px;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  cursor: pointer;
  transition: var(--transition);
  z-index: 20;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: rotate(90deg);
}

/* Player View */
.player-wrapper {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 Aspect Ratio */
  background: #000;
}

.player-wrapper iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.player-controls {
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface-elevated);
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
  gap: 1rem;
}

.server-selector {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.selector-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.server-tabs {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.server-tab {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.server-tab:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.server-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* TV Episodes */
.tv-episodes-wrap {
  padding: 1.2rem 1.5rem;
  background: rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid var(--border-subtle);
}

.tv-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.tv-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

.tv-header select {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: #fff;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.episodes-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.8rem;
  max-height: 220px;
  overflow-y: auto;
}

.episode-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.6rem;
  cursor: pointer;
  text-align: center;
  transition: var(--transition);
}

.episode-card:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--primary);
}

.episode-card.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.episode-num {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
}

.episode-card.active .episode-num {
  color: rgba(255, 255, 255, 0.8);
}

.episode-name {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 0.2rem;
}

/* Media Details */
.media-details {
  padding: 1.5rem;
}

.details-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.8rem;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.details-header h2 {
  font-size: 1.6rem;
  font-weight: 800;
}

.details-badges {
  display: flex;
  gap: 0.5rem;
}

.details-overview {
  font-size: 0.95rem;
  color: #cbd5e1;
  line-height: 1.6;
  margin-bottom: 1rem;
}

.details-meta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.genre-tag {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  font-size: 0.8rem;
  color: var(--text-secondary);
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
}

/* ---------------- DOWNLOAD MODAL ---------------- */
.modal-header {
  padding: 1.5rem 1.5rem 1rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.icon-bubble {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
}

.modal-title-wrap h3 {
  font-size: 1.25rem;
  font-weight: 800;
}

.modal-title-wrap p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.dl-body {
  padding: 1.5rem;
  max-height: 60vh;
  overflow-y: auto;
}

.dl-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 0.8rem;
  transition: var(--transition);
}

.dl-card:hover {
  border-color: rgba(99, 102, 241, 0.3);
  background: rgba(255, 255, 255, 0.03);
}

.dl-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}

.dl-quality-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
}

.dl-size-badge {
  background: rgba(16, 185, 129, 0.15);
  color: var(--green);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.dl-filename {
  font-size: 0.78rem;
  color: var(--text-muted);
  word-break: break-all;
  margin-bottom: 0.8rem;
}

.dl-action-row {
  display: flex;
  gap: 0.5rem;
}

.btn-dl {
  flex: 1;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.8rem;
  font-size: 0.85rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: var(--transition);
}

.btn-dl:hover {
  background: var(--primary-hover);
}

.btn-dl.loading {
  opacity: 0.6;
  pointer-events: none;
}

/* Spinner */
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 0.8rem auto;
}

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

.loading-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ---------------- FOOTER ---------------- */
.footer {
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  padding: 2.5rem 2rem;
  margin-top: 4rem;
}

.footer-container {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.footer-left p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.3rem;
}

.footer-right span {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Responsive */
@media (max-width: 900px) {
  .hero-title { font-size: 2.2rem; }
  .nav-links { display: none; }
  .search-box input { width: 180px; }
  .search-box input:focus { width: 220px; }
  .status-pill { display: none; }
}

@media (max-width: 600px) {
  .media-grid { grid-template-columns: repeat(2, 1fr); gap: 0.8rem; }
  .hero-actions { flex-direction: column; }
  .hero-section { min-height: 60vh; padding-top: 6rem; }
}
