/* Sesame Network - Kid-friendly video player */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #ff6b9d;
  --secondary: #c06eff;
  --accent: #4ecdc4;
  --success: #4caf50;
  --warning: #ff9800;
  --bg: #fef5f9;
  --card-bg: white;
  --text: #2d1b3d;
  --text-soft: #6b5b7b;
  --watched: #e0e0e0;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: linear-gradient(135deg, #fef5f9 0%, #f0e6ff 100%);
  color: var(--text);
  min-height: 100vh;
}

header {
  text-align: center;
  padding: 2rem 1rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: white;
  box-shadow: 0 4px 20px rgba(255, 107, 157, 0.3);
}

header h1 {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.subtitle {
  font-size: 1.1rem;
  opacity: 0.95;
}

main {
  max-width: 1400px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  padding: 1rem;
}

.video-card {
  background: var(--card-bg);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  display: flex;
  flex-direction: column;
}

.video-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 12px 32px rgba(255, 107, 157, 0.25);
}

.video-card.watched {
  opacity: 0.6;
}

.video-card.watched:hover {
  opacity: 1;
}

.thumb-container {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 */
  background: linear-gradient(135deg, var(--accent) 0%, var(--secondary) 100%);
  overflow: hidden;
}

.thumb-container img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

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

.watched-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--success);
  color: white;
  padding: 0.4rem 0.8rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: rgba(0,0,0,0.2);
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  transition: width 0.3s ease;
}

.card-content {
  padding: 1rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  font-size: 0.85rem;
  color: var(--text-soft);
  margin-top: auto;
}

/* Player Overlay */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease;
}

.overlay.hidden {
  display: none;
}

.overlay video {
  max-width: 95%;
  max-height: 95%;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

.close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: white;
  font-size: 1.8rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  transition: all 0.2s ease;
}

.close-btn:hover {
  background: var(--secondary);
  transform: scale(1.1) rotate(90deg);
}

/* Toast notifications */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: white;
  padding: 1rem 1.5rem;
  border-radius: 30px;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  z-index: 2000;
  animation: slideUp 0.3s ease;
}

.toast.hidden {
  display: none;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* Responsive */
@media (max-width: 768px) {
  header h1 {
    font-size: 2rem;
  }
  
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
  }
}

/* Loading state */
.loading {
  text-align: center;
  padding: 3rem;
  font-size: 1.2rem;
  color: var(--text-soft);
}

.loading::after {
  content: '🍪';
  display: inline-block;
  animation: bounce 1s infinite;
  margin-left: 0.5rem;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}