:root {
  --primary-bg: #f5f7fa;
  --secondary-bg: #e2e8f0;
  --accent: #3b82f6;
  --text-light: #1f2937;
  --text-muted: #475569;
  --card-bg: rgba(0, 0, 0, 0.05);
  --radius: 0.75rem;
}

/* Dark mode (system) */
@media (prefers-color-scheme: dark) {
  :root {
    --primary-bg: #0f172a;
    --secondary-bg: #1e293b;
    --accent: #3b82f6;
    --text-light: #f8fafc;
    --text-muted: #94a3b8;
    --card-bg: rgba(255, 255, 255, 0.05);
  }
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  transition: background-color 0.4s ease, color 0.4s ease, border-color 0.4s ease;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--primary-bg);
  color: var(--text-light);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  position: sticky;
  top: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  backdrop-filter: blur(12px);
  background: rgba(30, 41, 59, 0.7);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.75rem 2rem;
  z-index: 1000;
}

@media (min-width: 768px) {
  .header {
    padding: 0.75rem 3rem;
  }
}

.logo {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.5px;
  flex-shrink: 0;
}

/* Search */
.search-container {
  position: relative;
  width: 100%;
  max-width: 300px;
  margin-left: 1rem;
  flex-shrink: 0;
}

.search-container input {
  width: 100%;
  padding: 0.5rem 0.75rem 0.5rem 2.5rem;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  outline: none;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-light);
  font-size: 1rem;
  backdrop-filter: blur(4px);
}

.search-container input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.search-container input:focus {
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.6);
  transform: scale(1.02);
  border: 1px solid rgba(59, 130, 246, 0.5);
  animation: pulse-glow 1.5s infinite alternate;
}

@keyframes pulse-glow {
  0% { box-shadow: 0 0 10px rgba(59, 130, 246, 0.4); }
  100% { box-shadow: 0 0 20px rgba(59, 130, 246, 0.6); }
}

.search-icon {
  position: absolute;
  top: 50%;
  left: 0.9rem;
  transform: translateY(-50%);
  color: rgba(255, 255, 255, 0.5);
  font-size: 1rem;
  pointer-events: none;
}

/* Video Grid */
video {
  width: 100%;
  height: auto;
  object-fit: contain;
  background: black;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  padding: 2rem;
}

.video-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(6px);
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.video-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  background: rgba(255, 255, 255, 0.08);
}

.video-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.video-card:hover img {
  transform: scale(1.05);
}

.video-content {
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.video-content h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-light);
  line-height: 1.2;
}

.video-content p {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.3;
}

/* Skeleton Loader */
.skeleton-card {
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  aspect-ratio: 16 / 9;
  animation: pulse 1.5s infinite;
}

.skeleton-thumbnail {
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.05) 25%,
    rgba(255, 255, 255, 0.1) 50%,
    rgba(255, 255, 255, 0.05) 75%
  );
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

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

/* Footer */
.footer {
  text-align: center;
  padding: 1rem;
  background: var(--secondary-bg);
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: auto;
}

/* Watch Page Styles */
.watch-container {
  display: flex;
  justify-content: center;
  padding: 2rem;
  background: var(--primary-bg);
}

.video-player-container {
  max-width: 800px;
  width: 100%;
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 0 20px rgba(0,0,0,0.3);
}

#videoPlayer {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: black;
}

.video-details {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

#videoTitle {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-light);
  line-height: 1.3;
}

#videoDescription {
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.5;
}

@media (max-width: 768px) {
  .watch-container { padding: 1rem; }
  #videoTitle { font-size: 1.2rem; }
  #videoDescription { font-size: 0.95rem; }
}

/* Plyr Player Styling */
.plyr--full-ui input[type=range]::-webkit-slider-thumb {
  background: var(--accent);
}
.plyr__control {
  color: var(--text-light);
}
.plyr__menu__container {
  background: var(--secondary-bg);
  color: var(--text-light);
}
.plyr__tooltip {
  background: var(--secondary-bg);
  color: var(--text-light);
}

@media (prefers-color-scheme: dark) {
  .plyr--full-ui input[type=range]::-webkit-slider-thumb {
    background: var(--accent);
  }
  .plyr__control {
    color: var(--text-light);
  }
  .plyr__menu__container {
    background: var(--secondary-bg);
    color: var(--text-light);
  }
  .plyr__tooltip {
    background: var(--secondary-bg);
    color: var(--text-light);
  }
}
