/**
 * Song Teaser styles
 */

/* Song Teaser Container - Responsive 160px to 645px */
.song-teaser {
  background: white;
  border-radius: 8px;
  overflow: visible; /* Allow tooltips to overflow */
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  margin-bottom: 12px;
  min-width: 160px;
  max-width: 645px;
  width: 100%;
  position: relative; /* Establish stacking context */
}

.song-teaser:hover {
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.song-teaser-content {
  display: flex;
  flex-direction: column;
  overflow: visible; /* Allow tooltips to overflow */
}

/* Play Section - Compact at top */
.song-teaser-play-section {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  padding: 8px;
  background: #f8f9fa;
  border-radius: 6px;
  position: relative;
  border: 1px solid #e9ecef;
}

.song-teaser-play {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #7d11ff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  text-decoration: none;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
}

.song-teaser-play:hover {
  background: var(--color-primary-dark);
  transform: scale(1.05);
  text-decoration: none;
}

.song-teaser-play .icon {
  width: 16px;
  height: 16px;
  color: white;
  margin-left: 2px; /* Optical alignment for play icon */
}

/* Audio Progress Bar for Teasers - now inline */
.song-teaser-progress {
  flex: 1;
  height: 8px;
  background: #dee2e6;
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  border: 1px solid #ced4da;
  min-width: 100px;
}

.song-teaser-progress.active {
  background: var(--color-primary-light);
}

.song-teaser-progress-bar {
  height: 100%;
  background: #7d11ff;
  width: 0%;
  transition: width 0.1s ease;
  border-radius: 4px;
  box-shadow: 0 0 4px rgba(125, 17, 255, 0.3);
}

/* Song Info - Responsive padding from 160px+ */
.song-teaser-info {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: visible; /* Allow tooltips to overflow */
}

@media (min-width: 200px) {
  .song-teaser-info {
    padding: var(--spacing-sm);
  }
}

@media (min-width: 300px) {
  .song-teaser-info {
    padding: var(--spacing-md);
  }
}

.song-teaser-title {
  font-size: 18px;
  font-weight: bold;
  line-height: 1.3;
  margin: 0;
}

.song-teaser-title a {
  color: var(--color-text-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.song-teaser-title a:hover {
  color: var(--color-primary);
  text-decoration: none;
}

/* Two column header row */
.song-teaser-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 40px; /* Ensure consistent height for vertical centering */
}

.song-teaser-author-col {
  flex: 1;
  min-width: 0; /* Allow text truncation */
}

.song-teaser-stats-col {
  flex-shrink: 0;
}

/* Two column bottom row for tracks and metadata */
.song-teaser-bottom-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e9ecef;
}

.song-teaser-tracks-col {
  flex: 1;
  min-width: 0; /* Allow text truncation */
  overflow: visible; /* Allow tooltips to overflow */
}

.song-teaser-metadata-col {
  flex-shrink: 0;
}

/* Author Info */
.song-teaser-author {
  display: flex;
  align-items: center;
  gap: 8px;
}

.song-teaser-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  object-fit: cover;
}

.song-teaser-avatar-placeholder {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--color-text-muted);
  color: var(--color-white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-sm);
}

.song-teaser-author-name {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  gap: var(--spacing-xxs);
}

/* Metadata */
.song-teaser-metadata {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
}

.song-teaser-meta-item {
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
  background: var(--color-bg-secondary);
  padding: var(--spacing-xxs) var(--spacing-xs);
  border-radius: var(--radius-sm);
  font-weight: var(--font-weight-medium);
}

/* Stats */
.song-teaser-stats {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
  margin-bottom: 0;
}

/* Override any inherited margin from song-stats */
.song-teaser .song-stats {
  margin-bottom: 0;
}

.song-teaser-stat {
  display: flex;
  align-items: center;
  gap: var(--spacing-xxs);
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

.song-teaser-stat .icon {
  width: 14px;
  height: 14px;
}

/* Make download icon visible in stats by darkening it and fixing height issue */
.song-teaser-stat .icon-download {
  filter: brightness(0) saturate(100%) invert(25%) sepia(8%) saturate(0%) hue-rotate(162deg) brightness(95%) contrast(88%);
  height: 14px !important;
}

/* Compact Channels Section */
.song-teaser-channels {
}

.song-teaser-channels-label {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-secondary);
  margin-bottom: var(--spacing-xs);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.song-teaser-channels-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-xs);
  align-items: center;
}

.song-teaser-channel {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  position: relative;
  cursor: pointer;
}

/* Override purple background from song.css for teaser channels */
.song-teaser .song-channel {
  background-color: transparent !important;
  border-radius: 0;
  padding: 0;
  min-height: auto;
  transform: none !important;
  transition: none;
}

.song-teaser .song-channel:hover {
  transform: none !important;
  box-shadow: none !important;
  filter: none !important;
  background-color: transparent !important;
}

/* Simplified tooltip for teaser channels */
.song-teaser-channel .channel-tooltip {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: var(--color-white);
  padding: var(--spacing-xxs) var(--spacing-xs);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xxs);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-fast);
  pointer-events: none;
  z-index: 9999; /* Very high z-index to appear above everything */
  margin-bottom: 4px;
}

.song-teaser-channel:hover .channel-tooltip {
  opacity: 1;
  visibility: visible;
}

/* Make empty track tooltips fully opaque */
.song-teaser-channel.empty .channel-tooltip {
  background: rgba(0, 0, 0, 1); /* Fully opaque black background */
}

.song-teaser-channel.empty:hover .channel-tooltip {
  background: rgba(0, 0, 0, 1); /* Maintain full opacity on hover */
}

.song-teaser-channel-avatar-container {
  position: relative;
  flex-shrink: 0;
}

.song-teaser-channel-avatar {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  overflow: hidden;
  border: 2px solid var(--color-white);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.song-teaser-channel-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.song-teaser-channel-avatar .avatar-placeholder {
  width: 100%;
  height: 100%;
  background: var(--color-text-muted);
  color: var(--color-white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-xxs);
  font-weight: var(--font-weight-bold);
}

/* Removed detailed channel info styles since we're now just showing avatars */

.song-teaser-author-count {
  position: absolute;
  bottom: -2px;
  right: -2px;
  background: var(--color-primary);
  color: var(--color-white);
  border-radius: var(--radius-full);
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: var(--font-weight-bold);
  border: 1px solid var(--color-white);
}

/* Compact layout for very small widths */
@media (max-width: 280px) {
  .song-teaser-channels-list {
    gap: 2px;
  }
  
  .song-teaser-channel-avatar {
    width: 20px;
    height: 20px;
  }
  
  .song-teaser-author-count {
    width: 12px;
    height: 12px;
    font-size: 8px;
  }
}

/* Actions */
.song-teaser-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}

.song-teaser-view-link {
  color: var(--color-text-secondary);
  text-decoration: none;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  transition: color var(--transition-fast);
}

.song-teaser-view-link:hover {
  color: var(--color-primary);
  text-decoration: none;
}

.song-teaser-actions .btn {
  flex: 0 0 auto;
  font-size: 13px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.song-teaser-actions .btn .icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* Responsive Design for 160px-645px range */

/* Ultra small (160px-200px) - Very compact, essential info only */
@media (max-width: 200px) {
  .song-teaser-title {
    font-size: var(--font-size-sm);
    margin-bottom: var(--spacing-xxs);
    line-height: 1.2;
  }
  
  .song-teaser-author {
    margin-bottom: var(--spacing-xs);
  }
  
  .song-teaser-avatar,
  .song-teaser-avatar-placeholder {
    width: 20px;
    height: 20px;
  }
  
  .song-teaser-author-name {
    font-size: 10px;
  }
  
  .song-teaser-metadata {
    display: none; /* Hide metadata at ultra small sizes */
  }
  
  .song-teaser-stats {
    gap: var(--spacing-xs);
    margin-bottom: var(--spacing-xs);
  }
  
  .song-teaser-stat {
    font-size: 10px;
  }
  
  .song-teaser-stat .icon {
    width: 10px;
    height: 10px;
  }
  
  .song-teaser-channels-label {
    font-size: 9px;
  }
  
  .song-teaser-channel-avatar {
    width: 16px;
    height: 16px;
  }
  
  .song-teaser-author-count {
    width: 10px;
    height: 10px;
    font-size: 7px;
  }
  
  .song-teaser-actions .btn {
    font-size: 10px;
    padding: var(--spacing-xxs);
  }
}

/* Very small (200px-280px) - Stack everything vertically, compact spacing */
@media (min-width: 200px) and (max-width: 280px) {
  .song-teaser-title {
    font-size: var(--font-size-base);
    margin-bottom: var(--spacing-xs);
  }
  
  .song-teaser-metadata {
    gap: var(--spacing-xs);
    margin-bottom: var(--spacing-xs);
  }
  
  .song-teaser-meta-item {
    font-size: 10px;
    padding: 2px var(--spacing-xxs);
  }
  
  .song-teaser-stats {
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-xs);
  }
  
  .song-teaser-stat {
    font-size: 11px;
  }
  
  .song-teaser-actions .btn {
    font-size: 11px;
    padding: var(--spacing-xxs) var(--spacing-xs);
  }
}

/* Small (280px-400px) - Keep stacked but with better spacing */
@media (min-width: 280px) and (max-width: 400px) {
  .song-teaser-content {
    flex-direction: column;
  }
  
  .song-teaser-stats {
    gap: var(--spacing-sm);
  }
}

/* Container-based responsive layout for song teasers - simplified without image */
@container (min-width: 450px) {
  .song-teaser-title {
    font-size: var(--font-size-xl);
  }
  
  .song-teaser-play-section {
    margin-bottom: var(--spacing-md);
  }
  
  .song-teaser-actions {
    margin-top: auto;
  }
}

/* Container-based responsive layout */
.songs-grid {
  display: grid;
  gap: var(--spacing-md);
}

/* Grid adjusts based on available space */
@container (min-width: 160px) {
  .songs-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }
}

@container (min-width: 500px) {
  .songs-grid {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  }
}

@container (min-width: 800px) {
  .songs-grid {
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  }
}

/* Ensure teasers don't exceed max width */
.song-teaser {
  container-type: inline-size;
}