/* Custom CSS for Modern Video Library */
:root {
  --primary: #0057ff;
  --primary-dark: #0046cc;
  --bg: #f6f8fc;
  --card-bg: #fff;
  --font-main: 'Inter', sans-serif;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --border-color: #e5e7eb;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

* {
  box-sizing: border-box;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
}

/* Category Tabs */
.category-tab {
  position: relative;
  transition: all 0.3s ease;
}

.category-tab:hover {
  color: var(--primary);
}

.category-tab.active {
  color: var(--primary);
  border-color: var(--primary);
}

.category-tab::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--primary);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.category-tab.active::after {
  transform: scaleX(1);
}

/* Hide scrollbar for category tabs */
.scrollbar-hide {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.scrollbar-hide::-webkit-scrollbar {
  display: none;
}

/* Video Cards */
.video-card {
  background: var(--card-bg);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
  cursor: pointer;
  border: 1px solid var(--border-color);
  animation: fadeInUp 0.5s ease forwards;
  opacity: 0;
}

.video-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

.video-card-thumbnail {
  position: relative;
  aspect-ratio: 16/9;
  overflow: hidden;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.video-card-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.video-card:hover .video-card-thumbnail img {
  transform: scale(1.05);
}

.video-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.7) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.video-card:hover .video-card-overlay {
  opacity: 1;
}

.video-card-duration {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

.video-card-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all 0.3s ease;
}

.video-card:hover .video-card-play {
  opacity: 1;
}

.video-card-play svg {
  width: 20px;
  height: 20px;
  fill: var(--primary);
  margin-left: 2px;
}

.video-card-content {
  padding: 20px;
}

.video-card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  /* Standard property for compatibility */
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.video-card-description {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  /* Standard property for compatibility */
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.video-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.video-card-category {
  font-size: 12px;
  color: var(--primary);
  font-weight: 500;
}

.video-card-level {
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.video-card-level.beginner {
  background: #dcfce7;
  color: #166534;
}

.video-card-level.intermediate {
  background: #fef3c7;
  color: #92400e;
}

.video-card-level.advanced {
  background: #fee2e2;
  color: #991b1b;
}

.video-card-progress {
  margin-top: 12px;
}

.video-card-progress-bar {
  height: 4px;
  background: var(--border-color);
  border-radius: 2px;
  overflow: hidden;
}

.video-card-progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.video-card-progress-text {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Skeleton Loading */
.video-card-skeleton {
  background: var(--card-bg);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Staggered Content Animation for Category Cards */
@keyframes staggeredSlideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Floating Animation */
@keyframes float {

  0%,
  100% {
    translate: 0 0;
  }

  50% {
    translate: 0 -10px;
  }
}

.stagger-slide-up {
  opacity: 0;
  /* Important for entrance */
  /* Combine entrance and float animations */
  /* Entrance: staggeredSlideUp (0.8s), Float: float (6s infinite) starting AFTER entrance */
  animation:
    staggeredSlideUp 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards,
    float 6s ease-in-out infinite 0.8s;
  /* Start float after 0.8s */
}

/* Category Card Interactions */
.category-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  will-change: transform, translate;
  /* Optimize for animations */
}

/* Hover effects: Scale up slightly and deepen shadow */
/* Hover effects handled by Tailwind utility classes in JS */
/* .category-card:hover removed to prevent transform conflicts */

@keyframes pulse-slow {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.7;
  }
}

.animate-pulse-slow {
  animation: pulse-slow 3s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Responsive Design */
@media (max-width: 768px) {
  .category-tab {
    font-size: 14px;
    padding: 8px 12px;
  }

  .video-card-content {
    padding: 16px;
  }

  .video-card-title {
    font-size: 15px;
  }

  .video-card-description {
    font-size: 13px;
  }
}

@media (max-width: 640px) {
  .video-card-thumbnail {
    aspect-ratio: 16/9;
  }

  .video-card-play {
    width: 40px;
    height: 40px;
  }

  .video-card-play svg {
    width: 16px;
    height: 16px;
  }
}

/* Loading States */
.loading {
  pointer-events: none;
  opacity: 0.6;
}

/* Focus States */
.category-tab:focus,
input:focus,
select:focus,
button:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Transitions */
* {
  transition-property: color, background-color, border-color, transform, box-shadow;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 150ms;
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* Print styles */
@media print {

  .category-tab,
  #searchInput,
  #levelFilter,
  #mobileFilterToggle {
    display: none;
  }

  .video-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid var(--border-color);
  }
}