:root {
  --bg-main: #090607;
  --bg-card: #120e10;
  --bg-card-hover: #1c1518;
  --bg-header: rgba(9, 6, 7, 0.96);
  
  --primary: #dc2626; /* Time Movies Ruby Red */
  --primary-glow: rgba(220, 38, 38, 0.45);
  --accent-gold: #f59e0b; /* Gold VIP */
  --accent-gold-glow: rgba(245, 158, 11, 0.4);
  
  --text-main: #fafafa;
  --text-muted: #a1a1aa;
  --border-color: rgba(255, 255, 255, 0.08);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 8px;
  --shadow-lg: 0 12px 35px rgba(0, 0, 0, 0.7);
  --transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Cairo', sans-serif;
  -webkit-tap-highlight-color: transparent;
  scrollbar-width: thin;
  scrollbar-color: #dc2626 #07090e;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: #07090e;
}
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #dc2626, #f59e0b);
  border-radius: 999px;
  border: 2px solid #07090e;
}
::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #ef4444, #fbbf24);
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  padding-bottom: 70px;
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-header);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  padding: 12px 20px;
}

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

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.logo-box {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary), var(--accent-gold));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 20px;
  box-shadow: 0 0 20px var(--primary-glow);
}

.brand-text h1 {
  font-size: 20px;
  font-weight: 900;
  color: #fff;
  line-height: 1.2;
}

.brand-text span {
  font-size: 11px;
  font-weight: 800;
  color: var(--accent-gold);
  letter-spacing: 1.5px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  padding: 4px;
  border-radius: 30px;
  border: 1px solid var(--border-color);
}

.nav-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 700;
  padding: 8px 18px;
  border-radius: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}

.nav-btn:hover {
  color: #fff;
}

.nav-btn.active {
  background: linear-gradient(90deg, var(--primary), #ef4444);
  color: #fff;
  box-shadow: 0 4px 15px var(--primary-glow);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box i {
  position: absolute;
  right: 14px;
  color: var(--text-muted);
  font-size: 14px;
}

.search-box input {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: #fff;
  padding: 8px 38px 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  width: 220px;
  outline: none;
  transition: var(--transition);
}

.search-box input:focus {
  border-color: var(--primary);
  width: 280px;
  box-shadow: 0 0 12px var(--primary-glow);
}

.portal-back-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  text-decoration: none;
  transition: var(--transition);
}

.portal-back-btn:hover {
  color: #fff;
  border-color: var(--primary);
  transform: translateY(-2px);
}

/* Hero Slider */
.hero-slider {
  position: relative;
  min-height: 480px;
  display: flex;
  align-items: flex-end;
  padding: 60px 40px;
  overflow: hidden;
  border-bottom: 1px solid var(--border-color);
}

.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;
}

.hero-gradient-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, var(--bg-main) 10%, rgba(9, 6, 7, 0.75) 60%, transparent 100%),
              linear-gradient(90deg, var(--bg-main) 0%, transparent 60%);
}

.hero-content {
  position: relative;
  z-index: 10;
  max-width: 680px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(245, 158, 11, 0.2);
  color: var(--accent-gold);
  border: 1px solid rgba(245, 158, 11, 0.35);
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 14px;
}

.hero-title {
  font-size: 34px;
  font-weight: 900;
  line-height: 1.2;
  margin-bottom: 12px;
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.8);
}

.hero-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
  font-size: 14px;
  font-weight: 700;
}

.hero-meta .rating {
  color: var(--accent-gold);
  display: flex;
  align-items: center;
  gap: 4px;
}

.hero-meta .quality {
  background: var(--primary);
  color: #fff;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
}

.hero-overview {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 22px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn {
  border: none;
  font-size: 14px;
  font-weight: 800;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}

.btn-primary {
  background: linear-gradient(90deg, var(--primary), #ef4444);
  color: #fff;
  box-shadow: 0 4px 20px var(--primary-glow);
}

.btn-primary:hover {
  filter: brightness(1.15);
  transform: translateY(-2px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  backdrop-filter: blur(8px);
}

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

/* Main Container */
.main-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 30px 20px 60px;
}

/* Genre Filter Bar */
.genre-filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 16px;
  margin-bottom: 28px;
}

.genre-filter-bar::-webkit-scrollbar {
  height: 6px;
}

.genre-filter-bar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.genre-pill {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
  padding: 8px 18px;
  border-radius: 20px;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}

.genre-pill:hover {
  color: #fff;
  border-color: var(--primary);
}

.genre-pill.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 4px 15px var(--primary-glow);
}

/* Section Header */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title i {
  color: var(--primary);
  font-size: 20px;
}

.section-title h3 {
  font-size: 20px;
  font-weight: 800;
}

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

.media-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  display: flex;
  flex-direction: column;
}

.media-card:hover {
  transform: translateY(-6px);
  border-color: var(--primary);
  box-shadow: var(--shadow-lg);
}

.media-poster-wrap {
  position: relative;
  width: 100%;
  padding-top: 150%;
  background: #111;
  overflow: hidden;
}

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

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

.media-badge-rating {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  color: var(--accent-gold);
  font-size: 12px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.media-badge-type {
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
}

.media-card-info {
  padding: 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.media-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.media-card-year {
  font-size: 12px;
  color: var(--text-muted);
}

/* Details & Player Modal */
.media-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.media-modal.active {
  display: flex;
}

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

.modal-dialog {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 1000px;
  max-height: 90vh;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-close-btn {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 20;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid var(--border-color);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

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

/* Modal Player Container */
.modal-player-container {
  background: #000;
  border-bottom: 1px solid var(--border-color);
}

.player-iframe-wrapper {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
}

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

.servers-selection-bar {
  padding: 12px 20px;
  background: rgba(18, 14, 16, 0.95);
  display: flex;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
}

.server-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}

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

/* Modal Hero */
.modal-hero {
  position: relative;
  min-height: 320px;
  padding: 30px;
  overflow: hidden;
}

.modal-backdrop-img {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: brightness(0.3) blur(6px);
}

.modal-hero-content {
  position: relative;
  z-index: 10;
  display: flex;
  gap: 24px;
}

.modal-poster {
  width: 160px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
}

.modal-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal-info {
  flex: 1;
}

.modal-info h2 {
  font-size: 26px;
  font-weight: 900;
  margin-bottom: 10px;
}

.modal-tags {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.tag-badge {
  background: rgba(255, 255, 255, 0.1);
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 12px;
}

.modal-overview {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 20px;
}

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

.btn-fav {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.btn-fav.active {
  background: var(--accent-gold);
  color: #000;
}

/* TV Seasons & Episodes */
.seasons-container {
  padding: 24px 30px;
  border-top: 1px solid var(--border-color);
}

.seasons-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.season-select {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  color: #fff;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  outline: none;
}

.episodes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}

.episode-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}

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

/* Cast Section */
.cast-section {
  padding: 24px 30px 40px;
  border-top: 1px solid var(--border-color);
}

.cast-section h3 {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cast-slider {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 12px;
}

.cast-slider::-webkit-scrollbar {
  height: 6px;
}

.cast-slider::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.cast-card {
  flex-shrink: 0;
  width: 100px;
  text-align: center;
}

.cast-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  margin: 0 auto 8px;
  overflow: hidden;
  background: #222;
  border: 1px solid var(--border-color);
}

.cast-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cast-name {
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cast-character {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Mobile Bottom Navigation */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: rgba(9, 6, 7, 0.96);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-color);
  z-index: 90;
  align-items: center;
  justify-content: space-around;
}

.m-nav-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.m-nav-btn i { font-size: 16px; }

.m-nav-btn.active {
  color: var(--primary);
}

/* Loading & Empty State */
.loading-spinner, .empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 700;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

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

@media (max-width: 768px) {
  .nav-links { display: none; }
  .mobile-nav { display: flex; }
  .modal-hero-content {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .modal-poster { width: 130px; }
  .hero-slider { min-height: 400px; padding: 40px 20px; }
  .hero-title { font-size: 24px; }
  .media-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
}
