/* Reset dan Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: #0f0f0f;
  color: #ffffff;
  line-height: 1.6;
  padding-bottom: 80px; /* Space untuk bottom nav */
}

/* Header */
.main-header {
  background: #0f0f0f;
  padding: 15px 0;
  border-bottom: 1px solid #272727;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo h1 {
  font-size: 1.5rem;
  color: #ff0000;
}

/* Search Box */
.search-box {
  display: flex;
  background: #272727;
  border-radius: 20px;
  overflow: hidden;
  width: 250px;
}

#search-input {
  flex: 1;
  padding: 10px 15px;
  border: none;
  outline: none;
  font-size: 0.9rem;
  background: transparent;
  color: white;
}

#search-input::placeholder {
  color: #888;
}

#search-btn {
  background: #ff0000;
  color: white;
  border: none;
  padding: 10px 15px;
  cursor: pointer;
  font-size: 1rem;
}

/* Categories Section */
.categories-section {
  padding: 20px 0 10px;
  border-bottom: 1px solid #272727;
}

.categories-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 15px;
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scrollbar-width: none;
}

.categories-container::-webkit-scrollbar {
  display: none;
}

.category-btn {
  background: #272727;
  color: #aaa;
  border: none;
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.85rem;
  white-space: nowrap;
  transition: all 0.3s ease;
}

.category-btn.active {
  background: #ff0000;
  color: white;
}

.category-btn:hover {
  background: #3d3d3d;
}

/* Tabs Section */
.tabs-section {
  padding: 15px 0;
}

.tabs-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 15px;
  display: flex;
  gap: 0;
  border-bottom: 2px solid #272727;
}

.tab-btn {
  background: none;
  color: #aaa;
  border: none;
  padding: 12px 20px;
  cursor: pointer;
  font-size: 0.9rem;
  border-bottom: 2px solid transparent;
  transition: all 0.3s ease;
}

.tab-btn.active {
  color: #ff0000;
  border-bottom-color: #ff0000;
}

.tab-btn:hover {
  color: #ff0000;
}

/* Main Content */
.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 15px;
}

/* Movies Grid - 3 Columns dengan Aspect Ratio 3:4 */
.movies-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px; /* Gap lebih kecil agar menyatu */
}

.movie-card {
  background: transparent; /* Background transparan */
  transition: all 0.3s ease;
  cursor: pointer;
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 0.6s ease-out forwards;
}

.movie-card:hover {
  transform: translateY(-5px);
}

/* Animasi untuk movie cards */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Staggered animation delay untuk movie cards */
.movie-card:nth-child(1) { animation-delay: 0.1s; }
.movie-card:nth-child(2) { animation-delay: 0.15s; }
.movie-card:nth-child(3) { animation-delay: 0.2s; }
.movie-card:nth-child(4) { animation-delay: 0.25s; }
.movie-card:nth-child(5) { animation-delay: 0.3s; }
.movie-card:nth-child(6) { animation-delay: 0.35s; }
.movie-card:nth-child(7) { animation-delay: 0.4s; }
.movie-card:nth-child(8) { animation-delay: 0.45s; }
.movie-card:nth-child(9) { animation-delay: 0.5s; }
.movie-card:nth-child(10) { animation-delay: 0.55s; }
.movie-card:nth-child(11) { animation-delay: 0.6s; }
.movie-card:nth-child(12) { animation-delay: 0.65s; }

/* Thumbnail dengan Aspect Ratio 3:4 dan Sudut Tumpul */
.movie-thumbnail-container {
  position: relative;
  width: 100%;
  padding-bottom: 133.33%; /* 3:4 aspect ratio (3/4 = 0.75 * 100 = 75%) */
  overflow: hidden;
  border-radius: 12px; /* Sudut tumpul */
}

.movie-thumbnail {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 12px; /* Sudut tumpul sama dengan container */
  transition: transform 0.3s ease;
}

.movie-card:hover .movie-thumbnail {
  transform: scale(1.05);
}

.movie-info {
  padding: 8px 4px 4px 4px; /* Padding lebih kecil */
}

.movie-title {
  font-size: 0.8rem;
  font-weight: 500;
  color: #ffffff;
  line-height: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  height: 2.9em;
  text-align: center;
}

.movie-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #666;
  font-size: 0.7rem;
  margin-top: 4px;
}

.movie-views {
  display: flex;
  align-items: center;
  gap: 2px;
}

.movie-duration {
  display: flex;
  align-items: center;
  gap: 2px;
}

/* Category Badge */
.category-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.6rem;
  font-weight: 600;
  background: rgba(0,0,0,0.8);
  color: white;
  backdrop-filter: blur(10px);
  z-index: 2;
  text-transform: uppercase;
}

/* Warna khusus untuk setiap kategori */
.category-drakor { 
  background: rgba(25, 118, 210, 0.9); 
  color: white; 
}
.category-dracin { 
  background: rgba(123, 31, 162, 0.9); 
  color: white; 
}
.category-donghua { 
  background: rgba(56, 142, 60, 0.9); 
  color: white; 
}
.category-lainnya { 
  background: rgba(97, 97, 97, 0.9); 
  color: white; 
}

/* Loading States */
.loading-movies {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: #666;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #333;
  border-top: 4px solid #ff0000;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.no-movies {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: #666;
  font-style: italic;
  animation: fadeInScale 0.5s ease-out;
}

/* Bottom Navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background-color: white;
  display: flex;
  justify-content: space-around;
  padding: 12px 0;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  z-index: 100;
}

.nav-item {
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.8rem;
  color: #666;
  cursor: pointer;
  padding: 8px 15px;
  border-radius: 8px;
  transition: all 0.3s;
  text-decoration: none;
  min-width: 60px;
}

.nav-item:hover {
  color: #6a11cb;
  background-color: #f5f5f5;
}

.nav-item.active {
  color: #6a11cb;
  background-color: #f5f5f5;
}

.nav-icon {
  font-size: 0.8rem;
  margin-bottom: 3px;
}

.nav-text {
  font-size: 0.75rem;
  font-weight: 500;
}

/* Responsive Design */
@media (max-width: 768px) {
  .movies-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }
  
  .header-container {
    padding: 0 10px;
  }
  
  .search-box {
    width: 200px;
  }
  
  .categories-container {
    padding: 0 10px;
  }
  
  .tabs-container {
    padding: 0 10px;
  }
  
  .main-content {
    padding: 15px 10px;
  }
  
  .movie-thumbnail-container {
    border-radius: 10px;
  }
  
  .movie-thumbnail {
    border-radius: 10px;
  }
  
  .movie-info {
    padding: 6px 2px 2px 2px;
  }
  
  .movie-title {
    font-size: 0.75rem;
  }
  
  .category-badge {
    font-size: 0.55rem;
    padding: 3px 6px;
  }
}

@media (max-width: 480px) {
  .movies-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
  }
  
  .search-box {
    width: 180px;
  }
  
  #search-input {
    padding: 8px 12px;
    font-size: 0.85rem;
  }
  
  #search-btn {
    padding: 8px 12px;
  }
  
  .category-btn {
    padding: 6px 12px;
    font-size: 0.8rem;
  }
  
  .tab-btn {
    padding: 10px 15px;
    font-size: 0.85rem;
  }
  
  .movie-thumbnail-container {
    border-radius: 8px;
  }
  
  .movie-thumbnail {
    border-radius: 8px;
  }
  
  .movie-title {
    font-size: 0.7rem;
    height: 2.2em;
  }
  
  .movie-meta {
    font-size: 0.65rem;
  }
  
  .category-badge {
    font-size: 0.5rem;
    padding: 2px 4px;
  }
}

@media (max-width: 360px) {
  .movies-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  
  .search-box {
    width: 150px;
  }
}