/* Dark/Light Mode Variables */
:root {
  --bg-primary: #121212;
  --bg-secondary: #1e1e1e;
  --text-primary: #ffffff;
  --text-secondary: #cccccc;
  --text-muted: #888888;
  --accent-color: #ff0000;
  --card-bg: #272727;
  --border-color: #333333;
}

[data-theme="light"] {
  --bg-primary: #ffffff;
  --bg-secondary: #f5f5f5;
  --text-primary: #000000;
  --text-secondary: #333333;
  --text-muted: #666666;
  --accent-color: #ff0000;
  --card-bg: #f0f0f0;
  --border-color: #dddddd;
}

/* Theme Toggle Button */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--card-bg);
  border: none;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--text-primary);
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  transition: all 0.3s ease;
}

.theme-toggle:hover {
  transform: scale(1.1);
}

/* Update existing styles to use CSS variables */
body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  transition: background-color 0.3s ease, color 0.3s ease;
}

.header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
}

.search-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

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

.category-btn {
  background: var(--card-bg);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.category-btn.active {
  background: var(--accent-color);
  color: white;
}

.movie-card {
  background: transparent;
}

.movie-title {
  color: var(--text-primary);
}

.movie-views {
  color: var(--text-muted);
}

.loading-movies, .no-movies {
  color: var(--text-muted);
}
/* 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;
}

/* 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;
}

/* PINTEREST STYLE MASONRY LAYOUT - FIXED */
.movies-grid {
  /* GANTI: Gunakan columns bukan grid */
  column-count: 4;
  column-gap: 12px;
}

.movie-card {
  background: transparent;
  transition: all 0.3s ease;
  cursor: pointer;
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 0.6s ease-out forwards;
  /* PENTING: Untuk masonry layout */
  break-inside: avoid;
  margin-bottom: 12px;
  display: inline-block;
  width: 100%;
}

.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 Container dengan Aspect Ratio Dinamis */
.movie-thumbnail-container {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: 12px;
}

/* Aspect Ratio Classes - Biarkan natural untuk masonry */
.movie-thumbnail-container.aspect-16-9 {
  aspect-ratio: 16 / 9;
}

.movie-thumbnail-container.aspect-9-16 {
  aspect-ratio: 9 / 16;
}

.movie-thumbnail-container.aspect-3-4 {
  aspect-ratio: 3 / 4;
}

.movie-thumbnail-container.aspect-4-3 {
  aspect-ratio: 4 / 3;
}

.movie-thumbnail {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 12px;
  transition: transform 0.3s ease;
}

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

/* Info section */
.movie-info {
  padding: 10px 4px 4px 4px;
  min-height: 50px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

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

.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-colmek { 
  background: rgba(239, 68, 68, 0.9); 
  color: white; 
}
.category-berdua { 
  background: rgba(16, 185, 129, 0.9); 
  color: white; 
}
.category-bergilir { 
  background: rgba(139, 92, 246, 0.9); 
  color: white; 
}
.category-lainnya { 
  background: rgba(97, 97, 97, 0.9); 
  color: white; 
}

/* Loading States */
.loading-movies {
  column-span: all;
  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 {
  column-span: all;
  text-align: center;
  padding: 60px 20px;
  color: #666;
  font-style: italic;
  animation: fadeInScale 0.5s ease-out;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .movies-grid {
    column-count: 3;
  }
}

@media (max-width: 768px) {
  .movies-grid {
    column-count: 2;
    column-gap: 10px;
  }
  
  .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: 8px 2px 2px 2px;
    min-height: 45px;
  }
  
  .movie-title {
    font-size: 0.75rem;
  }
  
  .category-badge {
    font-size: 0.55rem;
    padding: 3px 6px;
  }
}

@media (max-width: 480px) {
  .movies-grid {
    column-count: 2;
    column-gap: 8px;
  }
  
  .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-info {
    min-height: 40px;
  }
  
  .movie-title {
    font-size: 0.7rem;
  }
  
  .movie-meta {
    font-size: 0.65rem;
  }
  
  .category-badge {
    font-size: 0.5rem;
    padding: 2px 4px;
  }
}

@media (max-width: 360px) {
  .movies-grid {
    column-count: 2;
    column-gap: 6px;
  }
  
  .search-box {
    width: 150px;
  }
}