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

:root {
  --primary: #e50914;
  --primary-dark: #b20710;
  --bg-dark: #0a0a0f;
  --bg-card: #16161e;
  --bg-secondary: #1a1a2e;
  --text-primary: #ffffff;
  --text-secondary: #8a8a9a;
  --accent: #e50914;
  --success: #2ecc71;
  --gradient: linear-gradient(135deg, #e50914 0%, #b20710 100%);
  --shadow: 0 4px 20px rgba(0,0,0,0.4);
  --radius: 12px;
  --radius-sm: 8px;
  --nav-height: 65px;
  --header-height: 60px;
}

html, body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

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

.app-container {
  min-height: 100vh;
  padding-bottom: var(--nav-height);
}

/* Header Styles */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: rgba(10, 10, 15, 0.95);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary);
}

.logo i {
  font-size: 1.6rem;
}

.header-search {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border-radius: 50%;
  color: var(--text-secondary);
  transition: all 0.3s ease;
}

.header-search:hover {
  background: var(--primary);
  color: white;
}

/* Bottom Navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: rgba(10, 10, 15, 0.98);
  backdrop-filter: blur(10px);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 100;
  border-top: 1px solid rgba(255,255,255,0.05);
  padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-secondary);
  font-size: 0.7rem;
  padding: 8px 16px;
  border-radius: var(--radius);
  transition: all 0.3s ease;
}

.nav-item i {
  font-size: 1.3rem;
}

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

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

/* Page Content */
.page {
  min-height: 100vh;
}

.content {
  padding-top: var(--header-height);
}

/* Tabs */
.tabs {
  display: flex;
  gap: 8px;
  padding: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  background: var(--bg-card);
  border: none;
  color: var(--text-secondary);
  padding: 10px 20px;
  border-radius: 25px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.3s ease;
}

.tab.active {
  background: var(--gradient);
  color: white;
}

.tab-content {
  display: none;
  padding: 0 16px 16px;
  animation: fadeIn 0.3s ease;
}

.tab-content.active {
  display: block;
}

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

/* Category Section */
.category-section {
  margin-bottom: 24px;
}

.category-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.drama-scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 8px;
}

.drama-scroll::-webkit-scrollbar {
  display: none;
}

/* Drama Cards */
.drama-card {
  flex-shrink: 0;
  width: 130px;
}

.drama-poster {
  position: relative;
  aspect-ratio: 3/4;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-card);
}

.drama-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.drama-card:hover .drama-poster img {
  transform: scale(1.05);
}

.drama-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.drama-overlay i {
  font-size: 2rem;
  color: white;
}

.drama-card:hover .drama-overlay,
.drama-card-grid:hover .drama-overlay {
  opacity: 1;
}

.episode-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--primary);
  color: white;
  font-size: 0.7rem;
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: 600;
}

.episode-badge-sm {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0,0,0,0.7);
  color: white;
  font-size: 0.65rem;
  padding: 3px 6px;
  border-radius: 4px;
  font-weight: 500;
}

.rank-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: linear-gradient(135deg, #ffd700 0%, #ff8c00 100%);
  color: #000;
  font-size: 0.7rem;
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: 700;
}

.new-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: linear-gradient(135deg, #00c853 0%, #009624 100%);
  color: white;
  font-size: 0.6rem;
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.hot-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: linear-gradient(135deg, #ff5722 0%, #e64a19 100%);
  color: white;
  font-size: 0.75rem;
  padding: 4px 6px;
  border-radius: 4px;
}

.drama-info {
  padding: 8px 0;
}

.drama-info h4 {
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.drama-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Drama Grid */
.drama-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
}

.drama-card-grid {
  display: block;
}

/* Detail Page */
.detail-header, .list-header, .player-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: rgba(10, 10, 15, 0.95);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  z-index: 100;
}

.back-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border-radius: 50%;
  color: var(--text-primary);
  transition: all 0.3s ease;
}

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

.detail-header h1, .list-header h1 {
  font-size: 1.1rem;
  font-weight: 600;
}

.detail-content, .list-content {
  padding: calc(var(--header-height) + 16px) 16px calc(var(--nav-height) + 16px);
}

.drama-hero {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
}

.hero-poster {
  width: 140px;
  flex-shrink: 0;
}

.hero-poster img {
  width: 100%;
  border-radius: var(--radius);
}

.hero-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hero-info h2 {
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.3;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.meta i {
  margin-right: 4px;
  color: var(--primary);
}

.play-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--gradient);
  color: white;
  padding: 12px 24px;
  border-radius: 25px;
  font-weight: 600;
  font-size: 0.95rem;
  margin-top: auto;
  transition: all 0.3s ease;
}

.play-btn:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 20px rgba(229, 9, 20, 0.4);
}

.synopsis {
  background: var(--bg-card);
  padding: 16px;
  border-radius: var(--radius);
  margin-bottom: 24px;
}

.synopsis h3 {
  font-size: 1rem;
  margin-bottom: 8px;
  color: var(--primary);
}

.synopsis p {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.episodes-section h3 {
  font-size: 1rem;
  margin-bottom: 16px;
}

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

.episode-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--bg-card);
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  transition: all 0.3s ease;
}

.episode-item:hover {
  background: var(--primary);
}

.episode-item.locked {
  opacity: 0.5;
}

.episode-item i {
  font-size: 0.8rem;
}

/* Player Page */
.player-page {
  background: #000;
}

.player-header {
  background: rgba(0,0,0,0.8);
}

.player-title h1 {
  font-size: 1rem;
  font-weight: 600;
}

.player-title span {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.video-container {
  position: relative;
  width: 100%;
  height: calc(100vh - var(--header-height) - 150px);
  max-height: 60vh;
  background: #000;
  margin-top: var(--header-height);
}

.video-container video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.video-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-secondary);
  gap: 12px;
  padding: 20px;
  text-align: center;
}

.video-error i {
  font-size: 3rem;
  color: var(--primary);
}

.video-error p {
  font-size: 1rem;
  max-width: 300px;
}

.error-btn {
  margin-top: 16px;
  padding: 12px 24px;
  background: var(--gradient);
  color: white;
  border-radius: 25px;
  font-weight: 600;
  transition: all 0.3s ease;
}

.error-btn:hover {
  transform: scale(1.05);
}

.video-controls-overlay {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 16px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.video-container:hover .video-controls-overlay {
  opacity: 1;
}

.control-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.2);
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

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

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

.control-btn.play-pause {
  width: 60px;
  height: 60px;
  font-size: 1.5rem;
}

.episode-nav {
  padding: 20px 16px calc(var(--nav-height) + 20px);
  background: var(--bg-dark);
}

.episode-nav h3 {
  font-size: 1rem;
  margin-bottom: 12px;
}

.episode-list-horizontal {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 8px;
}

.episode-list-horizontal::-webkit-scrollbar {
  display: none;
}

.ep-chip {
  flex-shrink: 0;
  padding: 10px 16px;
  background: var(--bg-card);
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.3s ease;
}

.ep-chip.active {
  background: var(--primary);
}

.ep-chip.locked {
  opacity: 0.5;
}

/* Search Page */
.search-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  padding: 12px 16px;
  background: rgba(10, 10, 15, 0.95);
  backdrop-filter: blur(10px);
  z-index: 100;
}

.search-form {
  width: 100%;
}

.search-input-wrapper {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border-radius: 25px;
  padding: 0 16px;
}

.search-input-wrapper i {
  color: var(--text-secondary);
}

.search-input-wrapper input {
  flex: 1;
  background: none;
  border: none;
  padding: 14px 12px;
  color: white;
  font-size: 1rem;
  outline: none;
}

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

.clear-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px;
}

.search-content {
  padding: calc(var(--header-height) + 16px) 16px calc(var(--nav-height) + 16px);
}

.search-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 50vh;
  color: var(--text-secondary);
  text-align: center;
}

.search-placeholder i {
  font-size: 4rem;
  margin-bottom: 16px;
  opacity: 0.3;
}

.search-placeholder p {
  font-size: 1.2rem;
  margin-bottom: 8px;
}

.search-results h3 {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.drama-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.drama-list-item {
  display: flex;
  gap: 12px;
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all 0.3s ease;
}

.drama-list-item:hover {
  transform: translateX(4px);
}

.list-poster {
  width: 100px;
  min-height: 130px;
  flex-shrink: 0;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.list-poster img {
  width: 100%;
  height: 100%;
  min-height: 130px;
  object-fit: cover;
  background: var(--bg-secondary);
}

.list-poster img.loading-placeholder {
  background: linear-gradient(110deg, var(--bg-card) 8%, var(--bg-secondary) 18%, var(--bg-card) 33%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.list-info {
  flex: 1;
  padding: 12px 12px 12px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.list-info h4 {
  font-size: 0.95rem;
  font-weight: 600;
}

.list-info p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ep-count {
  font-size: 0.75rem;
  color: var(--primary);
  margin-top: auto;
}

.live-results {
  margin-top: 16px;
}

/* Info Page */
.info-page {
  padding-bottom: var(--nav-height);
}

.info-header {
  padding: 40px 16px 30px;
  text-align: center;
  background: var(--gradient);
}

.logo-big {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: white;
}

.logo-big i {
  font-size: 4rem;
}

.logo-big span {
  font-size: 2rem;
  font-weight: 700;
}

.info-content {
  padding: 20px 16px;
}

.info-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-card);
  padding: 20px;
  border-radius: var(--radius);
  margin-bottom: 24px;
}

.card-icon {
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient);
  border-radius: 50%;
  font-size: 1.5rem;
}

.card-content h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.card-content p {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.api-info {
  display: block;
  font-size: 0.8rem;
  color: var(--primary);
  margin-top: 8px;
}

.social-links h3 {
  font-size: 1rem;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.social-link {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--bg-card);
  border-radius: var(--radius);
  margin-bottom: 12px;
  transition: all 0.3s ease;
}

.social-link:hover {
  transform: translateX(4px);
}

.social-icon {
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  font-size: 1.5rem;
}

.youtube .social-icon {
  background: #ff0000;
}

.whatsapp .social-icon, .whatsapp-channel .social-icon {
  background: #25d366;
}

.social-info {
  flex: 1;
}

.social-name {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
}

.social-handle {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.social-link > i:last-child {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.app-info {
  margin-top: 24px;
}

.app-info h3 {
  font-size: 1rem;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.info-list {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
}

.info-item {
  display: flex;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.info-item:last-child {
  border-bottom: none;
}

.info-item .label {
  color: var(--text-secondary);
}

.info-item .value {
  font-weight: 500;
}

.disclaimer {
  margin-top: 24px;
  padding: 16px;
  background: rgba(229, 9, 20, 0.1);
  border-radius: var(--radius);
  border-left: 3px solid var(--primary);
}

.disclaimer p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.disclaimer i {
  color: var(--primary);
  margin-right: 4px;
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-secondary);
  text-align: center;
}

.empty-state i {
  font-size: 4rem;
  margin-bottom: 16px;
  opacity: 0.3;
}

/* Loading */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--bg-card);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Responsive */
@media (min-width: 768px) {
  .drama-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }
  
  .drama-card {
    width: 150px;
  }
  
  .episodes-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }
  
  .drama-hero {
    gap: 24px;
  }
  
  .hero-poster {
    width: 200px;
  }
  
  .hero-info h2 {
    font-size: 1.5rem;
  }
}

@media (min-width: 1024px) {
  .app-container {
    max-width: 1200px;
    margin: 0 auto;
  }
  
  .bottom-nav {
    max-width: 1200px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: var(--radius) var(--radius) 0 0;
  }
  
  .drama-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }
  
  .video-container {
    max-height: 70vh;
  }
}
