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

body {
  background: #111;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Generator Header */
.generator {
  padding: 20px;
  background: linear-gradient(180deg, #1a1a1a 0%, #111 100%);
  border-bottom: 1px solid #222;
}

.generator-form {
  display: flex;
  gap: 12px;
  max-width: 800px;
  margin: 0 auto;
}

.generator-input {
  flex: 1;
  padding: 14px 18px;
  font-size: 1rem;
  border: 2px solid #333;
  border-radius: 8px;
  background: #1a1a1a;
  color: #fff;
  outline: none;
  transition: border-color 0.2s;
}

.generator-input:focus {
  border-color: #4ade80;
}

.generator-input::placeholder {
  color: #666;
}

.generator-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.generator-btn {
  padding: 14px 28px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
  color: #000;
  cursor: pointer;
  transition: transform 0.2s, opacity 0.2s;
}

.generator-btn:hover:not(:disabled) {
  transform: scale(1.02);
}

.generator-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.generator-info {
  text-align: center;
  color: #666;
  font-size: 0.875rem;
  margin-top: 12px;
}

.generator-info.error {
  color: #ef4444;
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.loading-overlay.active {
  opacity: 1;
  visibility: visible;
}

.loading-content {
  text-align: center;
  color: #fff;
}

.loading-spinner {
  width: 60px;
  height: 60px;
  border: 4px solid #333;
  border-top-color: #4ade80;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

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

.loading-content p {
  font-size: 1.25rem;
  margin-bottom: 8px;
}

.loading-subtext {
  font-size: 0.875rem !important;
  color: #666;
}

/* New Video Highlight */
.card.new-video {
  animation: highlight 2s ease-out;
}

@keyframes highlight {
  0% {
    box-shadow: 0 0 0 4px #4ade80;
  }
  100% {
    box-shadow: 0 0 0 0 transparent;
  }
}

/* Grid Layout */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 10px;
  padding: 10px;
}

/* Video Card */
.card {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  cursor: pointer;
  border-radius: 4px;
  background: #000;
  transition: transform 0.2s ease;
}

.card:hover {
  transform: scale(1.02);
  z-index: 1;
}

.card video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Hover Overlay */
.card-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.2s ease;
  color: #fff;
}

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

.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.card-description {
  font-size: 0.875rem;
  opacity: 0.85;
  margin-bottom: 12px;
  line-height: 1.4;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.tag {
  background: rgba(255, 255, 255, 0.2);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  text-transform: lowercase;
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.lightbox.active {
  opacity: 1;
  visibility: visible;
}

.lightbox-content {
  max-width: 90vw;
  max-height: 90vh;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.lightbox-content video {
  max-width: 100%;
  max-height: 90vh;
  border-radius: 4px;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: none;
  border: none;
  color: #fff;
  font-size: 2.5rem;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
  line-height: 1;
}

.lightbox-close:hover {
  opacity: 1;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  font-size: 3rem;
  cursor: pointer;
  padding: 20px 15px;
  opacity: 0.7;
  transition: opacity 0.2s, background 0.2s;
  border-radius: 4px;
}

.lightbox-nav:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.2);
}

.lightbox-prev {
  left: 20px;
}

.lightbox-next {
  right: 20px;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .card,
  .card-overlay,
  .lightbox {
    transition: none;
  }

  .card video {
    animation: none;
  }
}

/* Loading State */
.card.loading video {
  opacity: 0;
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #222 25%, #333 50%, #222 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.card:not(.loading)::before {
  display: none;
}

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