/* ========================================
   NETFLIX-STYLE STREAMING UI - DARK MODE
   Modern, Mobile-Friendly Design
   ======================================== */

/* === RESET & BASE === */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Netflix-inspired color palette */
  --primary-red: #E50914;
  --primary-red-dark: #B20710;
  --primary-red-light: #F40612;
  --bg-dark: #141414;
  --bg-darker: #0A0A0A;
  --bg-card: #1F1F1F;
  --bg-hover: #2A2A2A;
  --text-primary: #FFFFFF;
  --text-secondary: #B3B3B3;
  --text-muted: #808080;
  --border-color: #2F2F2F;
  --shadow: rgba(0, 0, 0, 0.75);
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Netflix Sans', 'Helvetica Neue', 'Segoe UI', Roboto, Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* === TYPOGRAPHY === */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary);
  font-weight: 700;
  margin-bottom: 1rem;
  letter-spacing: -0.5px;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }

p {
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

/* === LINKS === */
a {
  color: var(--text-primary);
  text-decoration: none;
  transition: color 0.2s ease, opacity 0.2s ease;
}

a:hover {
  color: var(--primary-red);
  opacity: 0.9;
}

/* === CONTAINERS === */
.container, .container-fluid {
  padding: 1.5rem;
  max-width: 1920px;
  margin: 0 auto;
}

/* === HIDE FOOTER & BOTTOM NAV === */
footer, .footer, .bottom-nav, .navbar-bottom, .fixed-bottom, .sticky-bottom {
  display: none !important;
}

/* === HIDE OLD BOOTSTRAP NAVBAR === */
header, .navbar-light, .navbar-expand-sm, .bg-white, .border-bottom, .box-shadow {
  display: none !important;
}

/* === NAVIGATION BAR === */
.navbar {
  background: rgba(10, 10, 10, 0.95); /* Solid dark background, no gradient */
  padding: 0.75rem 2rem; /* Reduced from 1rem for thinner navbar */
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  transition: all 0.3s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); /* Subtle shadow always visible */
}

.navbar.scrolled {
  background: rgba(10, 10, 10, 1); /* Fully opaque when scrolled */
  box-shadow: 0 2px 8px var(--shadow);
}

.navbar .container-fluid {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: 0;
}

.navbar-brand {
  font-size: 1.5rem; /* Reduced from 1.8rem */
  font-weight: 900;
  color: var(--primary-red) !important;
  letter-spacing: 2px;
  text-shadow: 0 0 10px rgba(229, 9, 20, 0.3); /* Subtle glow instead of blur */
  transition: transform 0.2s ease;
  display: flex;
  align-items: center;
  white-space: nowrap;
  flex-shrink: 0;
}

.navbar-brand svg {
  width: 20px;
  height: 20px;
}

.navbar-brand:hover {
  transform: scale(1.05);
  text-shadow: 0 0 15px rgba(229, 9, 20, 0.5); /* Brighter glow on hover */
}

/* === BREADCRUMBS === */
.breadcrumb {
  background: transparent;
  padding: 0; /* Removed padding */
  margin: 0; /* Removed margin */
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.breadcrumb-item {
  color: var(--text-secondary);
  font-size: 0.85rem; /* Slightly smaller */
  display: inline-flex;
  align-items: center;
}

.breadcrumb-item a {
  color: var(--text-secondary);
  transition: color 0.2s ease;
  text-decoration: none;
}

.breadcrumb-item a:hover {
  color: var(--primary-red);
}

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

.breadcrumb-item + .breadcrumb-item::before {
  content: '›';
  padding: 0 0.5rem;
  color: var(--text-muted);
}

/* === CARD GRID (Netflix-Style) === */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.5rem;
  padding: 1rem 0;
  margin-top: 100px; /* Reduced from 140px since navbar is thinner now */
}

.media-card {
  background: var(--bg-card);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  position: relative;
  aspect-ratio: 2 / 3; /* Movie poster aspect ratio */
  margin-bottom: 0.5rem; /* Extra spacing between rows */
}

.media-card:hover {
  transform: scale(1.05) translateZ(0);
  box-shadow: 0 8px 24px var(--shadow);
  z-index: 10;
}

.media-card-folder {
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-darker) 100%);
  border: 2px solid var(--border-color);
  aspect-ratio: 1 / 1;
  margin-bottom: 1.5rem; /* Extra spacing after folder cards */
}

.media-card-folder:hover {
  border-color: var(--primary-red);
}

.media-thumbnail {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
  transition: opacity 0.5s ease;
}

/* Loading skeleton animation */
.media-thumbnail.thumbnail-placeholder {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

/* Loading spinner overlay */
.thumbnail-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary-red);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  z-index: 5;
  pointer-events: none;
}

.media-card-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1rem;
  background: linear-gradient(0deg, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.7) 50%, transparent 100%);
}

.media-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.3;
}

.media-subtitle {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin: 0.5rem 0 0 0;
}

/* === FOLDER ICON === */
.folder-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-size: 4rem;
  color: var(--primary-red);
  opacity: 0.8;
}

/* === VIDEO PLAYER MODAL === */
.video-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.95);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.video-container {
  width: 100%;
  max-width: 1400px;
  position: relative;
}

.video-js {
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  overflow: hidden;
}

.video-close {
  position: absolute;
  top: -3rem;
  right: 0;
  background: var(--primary-red);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s ease;
}

.video-close:hover {
  background: var(--primary-red-dark);
}

/* === BUTTONS === */
.btn {
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
}

.btn-primary {
  background: var(--primary-red);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-red-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(229, 9, 20, 0.4);
}

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

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--primary-red);
}

/* === LOADING SPINNER === */
.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid var(--border-color);
  border-top-color: var(--primary-red);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 2rem auto;
}

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

/* === RESPONSIVE IMAGES === */
img {
  max-width: 100%;
  height: auto;
}

/* === FORM CONTROLS === */
input, select, textarea {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.75rem 1rem;
  border-radius: 4px;
  font-size: 1rem;
  transition: border-color 0.2s ease;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary-red);
  box-shadow: 0 0 0 3px rgba(229, 9, 20, 0.1);
}

/* ========================================
   MOBILE-FIRST RESPONSIVE DESIGN
   ======================================== */

/* Mobile (< 768px) */
@media (max-width: 767px) {
  html {
    font-size: 14px;
  }
  
  .navbar {
    padding: 0.5rem 1rem; /* Thinner on mobile */
  }
  
  .navbar .container-fluid {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  
  .navbar-brand {
    font-size: 1.2rem; /* Smaller on mobile */
  }
  
  .navbar-brand svg {
    width: 16px;
    height: 16px;
  }
  
  .breadcrumb {
    font-size: 0.75rem;
  }
  
  .media-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 80px; /* Adjusted for thinner navbar */
  }
  
  .video-modal {
    padding: 1rem;
  }
  
  .video-close {
    top: -2.5rem;
    padding: 0.5rem 1rem;
  }
  
  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.25rem; }
}

/* Tablet (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
  .media-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }
}

/* Desktop (> 1024px) */
@media (min-width: 1025px) {
  .media-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 2rem;
  }
  
  .container, .container-fluid {
    padding: 2rem;
  }
}

/* Large Desktop (> 1440px) */
@media (min-width: 1441px) {
  .media-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }
}

/* === SMOOTH SCROLLING === */
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: var(--bg-darker);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-card);
  border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-red);
}

/* === ACCESSIBILITY === */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* === UTILITY CLASSES === */
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary-red); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

/* === RATING BADGE === */
.rating-badge {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  background: rgba(229, 9, 20, 0.9);
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  z-index: 5;
}

/* === QUALITY BADGE === */
.quality-badge {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  z-index: 5;
}

/* === HOVER OVERLAY === */
.media-card-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 15;
}

.media-card:hover .media-card-overlay {
  opacity: 1;
}

.play-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--primary-red);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: white;
  transition: transform 0.2s ease;
}

.media-card:hover .play-icon {
  transform: scale(1.1);
}

/* === DOWNLOAD BUTTON === */
.btn-download-icon {
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.2s ease;
  z-index: 20;
  border: 2px solid var(--border-color);
}

.media-card:hover .btn-download-icon {
  opacity: 1;
}

.btn-download-icon:hover {
  transform: scale(1.1);
  background: var(--primary-red);
  border-color: var(--primary-red);
}