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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  padding: 20px;
  color: #333;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
}

header {
  text-align: center;
  margin-bottom: 40px;
  color: white;
}

h1 {
  font-size: 3rem;
  margin-bottom: 10px;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.subtitle {
  font-size: 1.2rem;
  opacity: 0.9;
}

/* Search Section */
.search-section {
  background: white;
  padding: 30px;
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.1);
  margin-bottom: 30px;
}

.search-box {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

#searchInput {
  flex: 1;
  padding: 15px 20px;
  font-size: 1rem;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  transition: all 0.3s ease;
}

#searchInput:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn-primary {
  padding: 15px 40px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.quick-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.filter-label {
  font-weight: 600;
  color: #666;
  margin-right: 5px;
}

.filter-tag {
  padding: 8px 16px;
  background: #f0f0f0;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.9rem;
}

.filter-tag:hover {
  background: #667eea;
  color: white;
  transform: translateY(-2px);
}

/* Results Section */
.results-section {
  min-height: 400px;
}

.loading {
  text-align: center;
  padding: 60px 20px;
  background: white;
  border-radius: 20px;
  color: #667eea;
}

.spinner {
  width: 50px;
  height: 50px;
  margin: 0 auto 20px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.hidden {
  display: none !important;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 20px;
}

.testimony-card {
  background: white;
  padding: 25px;
  border-radius: 15px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
}

.testimony-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}

.card-header {
  margin-bottom: 15px;
}

.card-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: #333;
  margin-bottom: 8px;
}

.card-meta {
  display: flex;
  gap: 15px;
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.similarity-badge {
  display: inline-block;
  padding: 4px 12px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
}

.card-description {
  color: #555;
  line-height: 1.6;
  margin-bottom: 15px;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 15px;
}

.tag {
  padding: 4px 10px;
  background: #f0f0f0;
  border-radius: 12px;
  font-size: 0.8rem;
  color: #666;
}

.card-link {
  display: inline-block;
  color: #667eea;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
}

.card-link:hover {
  text-decoration: underline;
}

.empty-state {
  text-align: center;
  padding: 80px 20px;
  background: white;
  border-radius: 20px;
  color: #999;
  font-size: 1.1rem;
}

/* Footer */
footer {
  text-align: center;
  margin-top: 40px;
  padding: 20px;
}

.btn-secondary {
  display: inline-block;
  padding: 12px 30px;
  background: white;
  color: #667eea;
  text-decoration: none;
  border-radius: 12px;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.btn-secondary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(0,0,0,0.15);
}

/* Responsive */
@media (max-width: 768px) {
  h1 {
    font-size: 2rem;
  }
  
  .search-box {
    flex-direction: column;
  }
  
  .results-grid {
    grid-template-columns: 1fr;
  }
}

/* Video Player Styles */
.video-player-container {
  margin-bottom: 20px;
  border-radius: 12px;
  overflow: hidden;
  background: #1a1a2e;
}

.video-player-container.expanded .video-embed {
  max-height: none;
}

.video-player-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 15px;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

.video-platform-badge {
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
}

.expand-btn {
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  color: white;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.expand-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.video-embed {
  width: 100%;
  background: #000;
  position: relative;
}

.video-embed iframe {
  display: block;
  width: 100%;
}

/* Thumbnail click-to-play */
.video-thumbnail-wrapper {
  position: relative;
  cursor: pointer;
  background: #000;
  width: 100%;
  aspect-ratio: 16/9;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-thumbnail {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 0.2s;
}

.video-thumbnail-wrapper:hover .video-thumbnail {
  opacity: 0.85;
}

.play-button-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.play-button-circle {
  width: 64px;
  height: 64px;
  background: rgba(255, 0, 0, 0.85);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: white;
  padding-left: 5px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  transition: transform 0.2s, background 0.2s;
}

.video-thumbnail-wrapper:hover .play-button-circle {
  transform: scale(1.1);
  background: rgba(200, 0, 0, 0.95);
}

.video-iframe-wrapper {
  width: 100%;
}

/* Watch on YouTube fallback button */
.watch-on-youtube-btn {
  display: block;
  width: 100%;
  padding: 18px;
  background: #ff0000;
  color: white;
  text-align: center;
  text-decoration: none;
  font-weight: 700;
  font-size: 1rem;
  transition: background 0.2s;
  letter-spacing: 0.02em;
}

.watch-on-youtube-btn:hover {
  background: #cc0000;
}

/* Timestamp Links */
.timestamp-links {
  padding: 12px 15px;
  background: linear-gradient(135deg, #16213e 0%, #1a1a2e 100%);
}

.timestamp-header {
  color: #a0a0a0;
  font-size: 0.8rem;
  margin-bottom: 10px;
  font-weight: 500;
}

.timestamp-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.timestamp-btn {
  padding: 6px 14px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  border-radius: 20px;
  color: white;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.timestamp-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* AI Summary Styles */
.card-summary {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  padding: 15px;
  border-radius: 10px;
  margin-bottom: 15px;
  border-left: 4px solid #667eea;
}

.summary-header {
  font-weight: 600;
  color: #667eea;
  margin-bottom: 10px;
  font-size: 0.9rem;
}

.card-summary ul {
  margin: 0;
  padding-left: 20px;
}

.card-summary li {
  margin-bottom: 6px;
  color: #444;
  line-height: 1.5;
}

/* ============================================
   QUALITY SCORE SECTION STYLES
   ============================================ */

.quality-score-section {
  margin: 12px 0;
  padding: 0;
}

/* Base quality badge styling */
.quality-badge {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  text-align: center;
  transition: all 0.2s ease;
  border: none;
  animation: qualityBadgeFadeIn 0.3s ease-out;
}

/* HIGH QUALITY - Green */
.quality-badge-high {
  background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
  color: #155724;
  border: 1px solid #b8d9c2;
}

.quality-badge-high:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(21, 87, 36, 0.2);
}

/* MEDIUM QUALITY - Yellow/Orange */
.quality-badge-medium {
  background: linear-gradient(135deg, #fff3cd 0%, #ffefc2 100%);
  color: #856404;
  border: 1px solid #ffeaa7;
}

.quality-badge-medium:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(133, 100, 4, 0.2);
}

/* LOW QUALITY - Red */
.quality-badge-low {
  background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
  color: #721c24;
  border: 1px solid #f1b0b7;
}

.quality-badge-low:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(114, 28, 36, 0.2);
}

/* NOT SCORED - Gray */
.quality-badge-unscored {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 0.8rem;
  font-weight: 500;
  color: #888;
  background: #f0f0f0;
  white-space: nowrap;
}

@keyframes qualityBadgeFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ========================================
   USER RATING COMPONENT STYLES
   ======================================== */

/* Rating Container */
.rating-container {
  margin: 12px 0;
  padding: 12px 0;
  border-top: 1px solid #eee;
}

/* Rating Display */
.rating-display {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.rating-stars-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
}

.rating-stars {
  display: flex;
  gap: 2px;
}

/* Star Icons */
.star {
  font-size: 1.1rem;
  line-height: 1;
  display: inline-block;
  transition: color 0.2s ease;
}

.star.filled {
  color: #fbbf24; /* Amber for filled stars */
}

.star.half {
  color: #fbbf24;
}

.star.empty {
  color: #d1d5db; /* Gray for empty stars */
}

/* Rating text */
.rating-average {
  font-size: 0.9rem;
  font-weight: 600;
  color: #555;
}

.rating-count {
  font-size: 0.8rem;
  color: #888;
}

/* Interactive Rating Input */
.rating-interactive {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.rating-label {
  font-size: 0.8rem;
  color: #666;
}

.rating-stars-input {
  display: flex;
  gap: 4px;
}

.star-interactive {
  font-size: 1.3rem;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.star-interactive:hover {
  transform: scale(1.2);
}

.star-interactive.filled {
  color: #fbbf24;
}

.star-interactive.empty {
  color: #d1d5db;
}

/* Helpful Button */
.rating-helpful {
  margin-left: auto;
}

.helpful-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: #f8f9fa;
  border: 1px solid #e0e0e0;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

.helpful-btn:hover {
  background: #e9ecef;
  border-color: #ccc;
}

.helpful-btn.active {
  background: #d4edda;
  border-color: #28a745;
  color: #155724;
}

.helpful-count {
  font-weight: 600;
  color: #666;
}

/* Rating Message (success/error feedback) */
.rating-message {
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: 12px;
  animation: fadeIn 0.3s ease;
}

.rating-message.success {
  background: #d4edda;
  color: #155724;
}

.rating-message.error {
  background: #f8d7da;
  color: #721c24;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Mobile Responsive for Ratings */
@media (max-width: 768px) {
  .rating-display {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .rating-interactive {
    margin-left: 0;
    width: 100%;
    justify-content: flex-start;
  }
  
  .rating-helpful {
    margin-left: 0;
  }
  
  .quality-badge {
    padding: 6px 12px;
    font-size: 0.8rem;
  }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

.quality-badge-high:focus,
.quality-badge-medium:focus,
.quality-badge-low:focus,
.helpful-btn:focus,
.star-interactive:focus {
  outline: 2px solid #667eea;
  outline-offset: 2px;
}
