/* ============================
   detail.css (NO VIDEO ADS VERSION)
   ============================ */

/* 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 */
.simple-header {
  position: sticky;
  top: 0;
  background: #0f0f0f;
  padding: 12px 20px;
  border-bottom: 1px solid #272727;
  z-index: 100;
}
.back-home-btn {
  background: #ff0000;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.3s;
}
.back-home-btn:hover { background: #cc0000; }

/* Iklan Banner (Tetap Dipertahankan) */
.ad-banner {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 15px auto;
  background: #1a1a1a;
  border-radius: 8px;
  padding: 5px;
  max-width: 320px;
  min-height: 60px;
  overflow: hidden;
}

/* Social Bar */
.social-bar {
  position: fixed;
  bottom: 20px;
  right: 10px;
  z-index: 99;
  pointer-events: none;
}
.social-bar > * { pointer-events: auto; }

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

/* Video Container */
.yt-video-container {
  position: relative;
  width: 100%;
  height: 0;
  padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
  margin-bottom: 20px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  background: #000;
}

#video-player { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: none; background: #000; }
.yt-video-container video { position:absolute; top:0; left:0; width:100%; height:100%; object-fit:contain; }

/* Video Info */
.yt-info { background: #1a1a1a; padding: 20px; border-radius: 12px; margin-bottom: 20px; border: 1px solid #272727; }
.yt-video-title { font-size: 1.5rem; margin-bottom: 15px; color: #ffffff; line-height: 1.3; }
.yt-stats { display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:15px; }
#view-count { color:#aaa; font-size:0.9rem; }
.yt-actions { display:flex; gap:10px; flex-wrap:wrap; }
.yt-action-btn { background:#272727; color:#ffffff; border:1px solid #333; padding:8px 16px; border-radius:20px; cursor:pointer; transition: all 0.3s ease; font-size:0.9rem; display:flex; align-items:center; gap:5px; }
.yt-action-btn:hover { background:#3d3d3d; transform: translateY(-1px); border-color: #555; }
.like-btn.liked { background:#4CAF50; color:white; border-color:#4CAF50; }
.fav-btn.favorited { background:#FFC107; color:white; border-color:#FFC107; }

/* Description */
.yt-desc { background:#1a1a1a; padding:20px; border-radius:12px; margin-bottom:20px; border:1px solid #272727; }
.description-text { color:#aaa; line-height:1.6; font-size: 0.95rem; }
.description-text.description-collapsed { display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden; }
.toggle-desc-btn { background:transparent; border:none; color:#bbb; padding:5px 0; cursor:pointer; font-size:0.85rem; margin-top:10px; font-weight: 600; }
.toggle-desc-btn:hover { color:#fff; text-decoration: underline; }

/* Tab Navigation */
.tab-navigation { background:#1a1a1a; padding:0; border-radius:12px; border:1px solid #272727; margin-top:30px; overflow:hidden; }
.tab-buttons { display:flex; border-bottom:1px solid #272727; background:#0f0f0f; }
.tab-btn { flex:1; padding:15px 20px; border:none; background:transparent; cursor:pointer; font-size:1rem; font-weight:500; color:#aaa; transition: all 0.3s ease; border-bottom:3px solid transparent; }
.tab-btn:hover { background:#222; color:#fff; }
.tab-btn.active { color:#ff0000; border-bottom-color:#ff0000; background:#1a1a1a; }
.tab-content { display:none; padding:20px; }
.tab-content.active { display:block; }

/* Grids */
.episodes-grid, .recommendations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 15px;
}

/* Episode & Recommendation Items */
.episode-item, .recommend-item {
  background: #252525;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s;
  border: 1px solid #333;
}
.episode-item:hover, .recommend-item:hover { transform: translateY(-3px); border-color: #555; }
.episode-item.current { border: 2px solid #ff0000; }

.episode-thumbnail-container, .recommend-thumbnail-container {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 for episodes */
  background: #111;
  overflow: hidden;
}
.recommend-thumbnail-container { padding-bottom: 140%; } 

.episode-thumbnail-container img, .recommend-thumbnail-container img {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover;
}

.episode-info, .recommend-info { padding: 12px; }
.episode-title, .recommend-title-text { color: #fff; font-size: 0.9rem; margin-bottom: 5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.episode-meta, .recommend-meta { font-size: 0.75rem; color: #888; display: flex; justify-content: space-between; }
.episode-number { color: #ff0000; font-size: 0.8rem; font-weight: bold; margin-bottom: 4px; }
.genre { background: #ff0000; color: white; padding: 2px 6px; border-radius: 4px; font-size: 0.65rem; }

/* Skeleton Loading Animation */
.skeleton-item {
  background: #252525;
  height: 200px;
  border-radius: 8px;
  position: relative;
  overflow: hidden;
}
.skeleton-item::after {
  content: "";
  position: absolute; top: 0; right: 0; bottom: 0; left: 0;
  transform: translateX(-100%);
  background-image: linear-gradient(90deg, rgba(255, 255, 255, 0) 0, rgba(255, 255, 255, 0.05) 20%, rgba(255, 255, 255, 0.1) 60%, rgba(255, 255, 255, 0));
  animation: shimmer 2s infinite;
}
@keyframes shimmer { 100% { transform: translateX(100%); } }

/* Popups - Z-INDEX DINAIKKAN AGAR AMAN */
.popup-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.85); display: flex; justify-content: center; align-items: center; z-index: 9999; }
.popup-box { background: #1a1a1a; padding: 30px; border-radius: 12px; text-align: center; max-width: 400px; width: 90%; border: 1px solid #333; }
.popup-actions { display: flex; gap: 10px; justify-content: center; margin-top: 20px; }
.popup-cancel-btn { background: #333; color: white; border: none; padding: 10px 20px; border-radius: 6px; cursor: pointer; }
.popup-login-btn, .popup-ok-btn { background: #ff0000; color: white; border: none; padding: 10px 20px; border-radius: 6px; cursor: pointer; }

.hidden { display: none !important; }

/* Responsive Mobile Fixes */
@media (max-width: 768px) {
  .yt-main { padding: 10px; }
  .yt-video-title { font-size: 1.1rem; }
  
  .tab-buttons {
    flex-direction: row;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 5px;
  }
  .tab-buttons::-webkit-scrollbar { height: 3px; }
  .tab-buttons::-webkit-scrollbar-thumb { background: #ff0000; border-radius: 3px; }
  
  .tab-btn { flex: 0 0 auto; padding: 12px 20px; }
  
  .episodes-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .recommendations-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .recommend-thumbnail-container { padding-bottom: 140%; }
}

@media (max-width: 480px) {
  .recommendations-grid { grid-template-columns: repeat(2, 1fr); }
}