/* playlists-home.css */
@import url('/tailwind.css');
@import url('/fonts.css');

/* Size adjustment variables - Change these to modify grid size */
:root {
  --grid-max-width: 1150px; /* Adjust this to change overall grid width */
  --grid-gap: 1.5rem; /* Adjust this to change spacing between cards */
  --card-border-radius: 2rem; /* Adjust this to change card roundness */
}

/* Base container for playlists */
.container-all-music-grid-playlists-home {
  max-width: 1150px;
  margin: auto;
  padding-bottom: 5rem;
}

/* Header section with title and View All button */
.header-section-playlists-home {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* .header-section-playlists-home h2 {
  font-size: 1.5rem;
  margin: 0;
  color: black;
  padding-left: 1.25rem;
} */

.header-section-playlists-home h1 {
  /* font-size: 1.5rem; */
  margin: 0;
  color: black;
  padding-left: 1.25rem;

  text-transform: uppercase;
  font-family: var(--font-inter);
  font-weight: 900;
  font-size: 2rem; 
  text-align: center;
  /* margin: 0 0 1rem 0; */
  text-rendering: optimizeLegibility;
}

.header-section-playlists-home h2 {
  /* font-size: 1.5rem; */
  margin: 0;
  color: black;
  padding-left: 1.25rem;

  text-transform: uppercase;
  font-family: var(--font-inter);
  font-weight: 900;
  font-size: 2rem; 
  text-align: center;
  /* margin: 0 0 1rem 0; */
  text-rendering: optimizeLegibility;
}

.view-all-button-playlists-home {
  color: #4c4c4c;
  padding: 0.75rem 1.5rem;
  border-radius: 10rem;
  text-decoration: none;
  font-family: var(--font-inter);
  letter-spacing: 0;
  font-size: 0.95rem;
  transition: all 0.3s ease !important;
  flex-shrink: 0; /* Prevent button from shrinking */
}

.view-all-button-playlists-home:hover {
  color: black;
  text-decoration: underline;
}

/* Platform grid - 1x4 layout with proper aspect ratio */
.platforms-grid-playlists-home {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  /* BULLETPROOF FIX: Set minimum column width to prevent collapse */
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  max-width: 100%;
}

.playlist-title-link-playlists-home {
    text-decoration: none;
    color: inherit;
}

.playlist-title-link-playlists-home:hover,
.playlist-title-link-playlists-home:visited,
.playlist-title-link-playlists-home:active {
    text-decoration: none;
    color: inherit;
}

/* Individual platform section */
.platform-section-playlists-home {
  position: relative;
  display: flex;
  flex-direction: column;
  /* BULLETPROOF FIX: Set consistent width constraints */
  min-width: 0; /* Allow flex items to shrink below content size */
  width: 100%;
}

/* Platform card - positioned at the TOP (order: 1) */
.platform-card-playlists-home {
  order: 1;
  border-radius: 1rem;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  aspect-ratio: 1 / 1; /* Default square aspect ratio */
  display: flex;
  flex-direction: column;
  position: relative;
  /* BULLETPROOF FIX: Ensure consistent sizing */
  width: 100%;
  max-width: 100%;
}

/* SPOTIFY SPECIFIC HEIGHT FIX: Use taller aspect ratio for Spotify */
.platform-section-playlists-home[data-platform="spotify"] .platform-card-playlists-home {
  aspect-ratio: 1 / 1;
}

.platform-card-playlists-home:hover {
  cursor: pointer;
}

/* Playlist title section - positioned in the MIDDLE (order: 2) */
.playlist-title-section-playlists-home {
  order: 2;
  text-align: center;
  /* BULLETPROOF FIX: Constrain width to prevent overflow */
  width: 100%;
  min-width: 0;
}

.playlist-title-text-playlists-home {
  font-size: 0.95rem; /*15px*/
  font-weight: 600;
  line-height: 2.2rem;

  color: black;
  /* font-size: 1.1rem; */
  margin: 0;
  line-height: 1.3;
  text-align: left;
  margin-top: .5rem;
  margin-left: 1.25rem;
  transition: color 0.3s ease;
  display: block;
  
  /* FIXED: Proper text truncation with ellipsis */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap; /* This is the key - keep text on one line */
  
  /* FIXED: Proper width constraints */
  width: calc(100% - 2.5rem); /* Account for left margin and some right padding */
  max-width: calc(100% - 2.5rem);
  min-width: 0;
}

.playlist-title-text-playlists-home:hover {
  color: #4c4c4c;
  cursor: pointer;
}

/* Platform link section - positioned at the BOTTOM (order: 3) */
.platform-link-section-playlists-home {
  order: 3;
  text-align: center;
  /* BULLETPROOF FIX: Constrain width */
  width: 100%;
  min-width: 0;
}

/* Enhanced thumbnail container with smooth transitions */
.thumbnail-container-playlists-home {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: linear-gradient(135deg, #f8f9fa, #e9ecef);
}

.static-thumbnail-playlists-home {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  opacity: 1;
  transition: filter 0.3s ease;
}

.platform-card-playlists-home:hover .static-thumbnail-playlists-home {
  filter: brightness(0.6);
}

.platform-section-playlists-home[data-platform="youtube"] .static-thumbnail-playlists-home {
  /* Force the image to fill the entire height and width */
  object-fit: cover;
  object-position: center center;
  /* Ensure it takes up 100% of container */
  width: 100%;
  height: 100%;
  /* Additional properties to ensure proper scaling */
  min-width: 100%;
  min-height: 100%;
  /* Force hardware acceleration for better rendering */
  transform: translateZ(0);
  backface-visibility: hidden;
}

.platform-section-playlists-home[data-platform="youtube"] .platform-card-playlists-home {
  aspect-ratio: 1 / 1;
  /* Additional overflow hidden to prevent any spillover */
  overflow: hidden;
}

/* Play button overlay */
.play-button-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  
  /* This transition works for some reason */
  transition: background-color 0.6s cubic-bezier(0.4, 0, 0.2, 1) !important;
  /* opacity: 1 !important; */
  cursor: pointer;
  z-index: 2;
}

.play-button-overlay:hover {
  transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
  will-change: transform !important;
  
}

.play-button {
  width: 65px;
  height: 65px;
  color: white;
  opacity: 0;
  
  transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
  will-change: transform !important;
  pointer-events: none;
}

.play-button-overlay:hover .play-button {
  transition: background-color 0.6s cubic-bezier(0.4, 0, 0.2, 1) !important;
  will-change: transform !important;
  opacity: 1 !important;
}

.play-button-overlay:active .play-button {
  transition: all 0.15s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
}

/* Embed container for inline playlist */
.embed-container-playlists-home {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  overflow: hidden;
}

.playlist-embed-inline {
  width: 100% !important;
  height: 100% !important;
  border: none !important;
  border-radius: inherit;
  position: absolute;
  top: 0;
  left: 0;
}

.playlist-embed-inline.spotify-embed {
  width: 100% !important;
  height: 100% !important;
  min-height: 352px !important; /* Spotify's minimum height requirement */
  border: none !important;
  border-radius: inherit !important;
  background: transparent !important;
}

/* Close button for inline embed */
.close-embed-button {
  position: absolute;
  top: .9rem;
  right: -.37rem;
  width: 3rem;
  height: 1.75rem;
  background: rgba(0, 0, 0, 0.7);
  border: none;
  border-top-left-radius: .75rem;
  border-bottom-left-radius: .75rem;
  padding-left: .5rem;
  justify-content: left;

  display: flex;
  align-items: center;
  cursor: pointer;
  color: white;
  transition: all 0.2s ease !important;
  z-index: 10;
}

.close-embed-button:hover {
  background: rgba(0, 0, 0, 0.9);
}

/* Platform fallback overlay for platforms without embed */
.platform-fallback-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  z-index: 1;
}

/* Fallback for no thumbnails */
.no-thumbnail-fallback-playlists-home {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-secondary);
  font-size: 0.9rem;
  background: linear-gradient(135deg, #f8f9fa, #e9ecef);
}

.platform-icon-large-playlists-home {
  width: 48px;
  height: 48px;
  margin-bottom: 0.5rem;
  opacity: 0.6;
}

/* Platform info section - positioned below card */
.platform-info-playlists-home {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  /* BULLETPROOF FIX: Constrain width */
  width: 100%;
  min-width: 0;
}

/* Platform link and info - positioned below playlist title */
.platform-link-playlists-home {
  text-decoration: none;
  color: inherit;
  display: block;
  cursor: pointer;
}

.platform-link-playlists-home:hover {
  text-decoration: none;
  color: #0f0f0f;
}

.platform-link-playlists-home:hover .platform-title-playlists-home {
  color: #0f0f0f;
}

/* Platform header info - contains SVG and title horizontally */
.platform-header-info-playlists-home {
  display: flex;
  justify-content: left;
  margin-top: .25rem;
  margin-left: 1.25rem;
  gap: 0.5rem;
}

/* Platform SVG icon styling - ALL ICONS NOW USE #4c4c4c */
.platform-svg-icon {
  width: 1.25rem;
  /* height: 1.125rem; */
  transition: all 0.3s ease;
  flex-shrink: 0;
  color: #4c4c4c !important;
  fill: #4c4c4c !important;
}

/* Override all platform-specific colors with #4c4c4c */
.platform-section-playlists-home[data-platform="youtube"] .platform-svg-icon,
.platform-section-playlists-home[data-platform="spotify"] .platform-svg-icon,
.platform-section-playlists-home[data-platform="soundcloud"] .platform-svg-icon,
.platform-section-playlists-home[data-platform="audius"] .platform-svg-icon {
  color: #4c4c4c !important;
  fill: #4c4c4c !important;
}

/* Text fallback for platforms without SVG */
.platform-text-fallback {
  font-size: 0.9rem;
  font-weight: 600;
  color: #4c4c4c;
  transition: color 0.3s ease;
  /* BULLETPROOF FIX: Handle text overflow */
  flex-shrink: 0;
}

.platform-title-playlists-home {
  font-size: 0.95rem; /*15px*/
  font-weight: 500;

  margin: 0;
  color: #606060;
  letter-spacing: -0.025em;
  transition: color 0.3s ease;
  /* BULLETPROOF FIX: Handle long platform names */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* No platforms message */
.no-platforms-playlists-home {
  text-align: center;
  padding: 3rem;
  background: var(--background-secondary, #f8f9fa);
  border-radius: 1rem;
  color: var(--text-secondary);
  font-size: 1rem;
}

/* Apply CSS variables */
.container-all-music-grid-playlists-home {
  max-width: var(--grid-max-width);
}

.platforms-grid-playlists-home {
  gap: var(--grid-gap);
}

.platform-card-playlists-home {
  border-radius: 1.5rem;
}

/* Making playlists-home.php responsive on all devices */

/* Desktop | 1281px - 1440px  */
@media (max-width: 1280px) {
  /* None, coded on macbook m1 pro */
}

/* Medium Laptop/Desktop | 1515px - 1920px */
@media (max-width: 1515px) {
 /* None, coded on macbook m1 pro */
}

/* Small Laptop/Desktop | 1024px - 1280px */
@media (max-width: 1024px) {
  /* None, coded on macbook m1 pro */
}

/* Mobile Small Portrait (Normal) | up to 480px */
/* S20+, iPhone 12, iPhone 13 */
@media (max-width: 480px) and (orientation: portrait) {
 .container-all-music-grid-playlists-home {
   padding: 1rem;
   max-width: 100%;
   display: flex;
   flex-direction: column;
 }

 .header-section-playlists-home {
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
 }

 .header-section-playlists-home h2 {
    font-size: 1.5rem;
    padding-left: 0;
    text-align: center;
 }

 .view-all-button-playlists-home {
    display: none;
 }

 .platforms-grid-playlists-home {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: .5rem;
    order: 1;
 }

 .platforms-grid-playlists-home::after {
    content: "VIEW ALL";
    display: block;
    grid-column: 1 / -1;
    text-align: center;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    color: #4c4c4c;
    text-transform: uppercase;
    margin-top: 1rem;
    margin-bottom: .5rem;
    cursor: pointer;
 }

 .platforms-grid-playlists-home:hover::after {
    color: black;
    text-decoration: underline;
  }
 
 .platform-card-playlists-home {
    aspect-ratio: 1/1;
    border-radius: 1rem;
 }
 
 .playlist-title-text-playlists-home {
    font-size: 0.9rem;
    margin-left: 0.75rem;
    width: calc(100% - 1.5rem);
    max-width: calc(100% - 1.5rem);
 }
 
 .platform-header-info-playlists-home {
    margin-left: 0.75rem;
    gap: 0.4rem;
 }
 
 .platform-svg-icon {
    width: 1rem;
    height: 1rem;
 }
 
 .platform-title-playlists-home {
    font-size: 0.85rem;
 }

 .play-button {
    width: 48px;
    height: 48px;
 }

 .close-embed-button {
    width: 2.5rem;
    height: 1.5rem;
    top: 0.75rem;
    right: -0.25rem;
 }
}

/* Mobile Small Landscape (Seitlich gehlaten) | up to 950px */
/* S20+, iPhone 14, iPhone 15 Pro in Landscape (Seitlich gehlaten) */
@media (max-width: 950px) and (orientation: landscape) {
  .container-all-music-grid-playlists-home {
    padding: 1rem;
    max-width: 100%;
  }

  .header-section-playlists-home {
    padding: 0 1rem;
    margin-bottom: .25rem;
  }

  .header-section-playlists-home h2 {
    font-size: 1.5rem;
    padding-left: 0;
  }

  .view-all-button-playlists-home {
    padding: .5rem 1rem;
    font-size: 0.85rem;
  }

  .platforms-grid-playlists-home {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: .5rem;
  }
  
  .platform-card-playlists-home {
    aspect-ratio: 1/1;
    border-radius: 0.75rem;
  }
  
  .playlist-title-text-playlists-home {
    font-size: 0.75rem;
    margin-left: 0.5rem;
    line-height: 1.8rem;
    width: calc(100% - 1rem);
    max-width: calc(100% - 1rem);
  }
  
  .platform-header-info-playlists-home {
    margin-left: 0.5rem;
    margin-top: 0.15rem;
    gap: 0.3rem;
  }
  
  .platform-svg-icon {
    width: 0.9rem;
    height: 0.9rem;
  }
  
  .platform-title-playlists-home {
    font-size: 0.75rem;
  }

  .play-button {
    width: 40px;
    height: 40px;
  }

  .close-embed-button {
    width: 2rem;
    height: 1.25rem;
    top: 0.5rem;
    right: -0.2rem;
  }
}

/* Mobile Large Portrait (Normal) | 481px - 600px */
/* iPhone 14 Pro Max, Pixel 7 Pro, larger phones */
@media (min-width: 481px) and (max-width: 600px) and (orientation: portrait) {
  .container-all-music-grid-playlists-home {
    padding: 2rem 1.5rem 4rem 1.5rem;
    max-width: 100%;
  }

  .header-section-playlists-home {
    flex-direction: column;
    gap: 1.25rem;
    margin-bottom: 2.5rem;
  }

  .header-section-playlists-home h2 {
    font-size: 1.75rem;
    padding-left: 0;
    text-align: center;
  }

  .view-all-button-playlists-home {
    padding: 14px 28px;
    font-size: 0.85rem;
    letter-spacing: 1.2px;
  }

  .platforms-grid-playlists-home {
    grid-template-columns: 1fr;
    gap: 2.5rem;
    max-width: 400px;
    margin: 0 auto;
  }
  
  .platform-card-playlists-home {
    aspect-ratio: 4 / 3;
    border-radius: 1.25rem;
  }
  
  .playlist-title-text-playlists-home {
    font-size: 1rem;
    margin-left: 1rem;
    width: calc(100% - 2rem);
    max-width: calc(100% - 2rem);
  }
  
  .platform-header-info-playlists-home {
    margin-left: 1rem;
    gap: 0.5rem;
  }
  
  .platform-svg-icon {
    width: 1.1rem;
    height: 1.1rem;
  }
  
  .platform-title-playlists-home {
    font-size: 0.9rem;
  }

  .play-button {
    width: 56px;
    height: 56px;
  }
}

/* Tablet Portrait (Normal) | 601px - 1024px */
@media (min-width: 601px) and (max-width: 1024px) and (orientation: portrait) {
  .container-all-music-grid-playlists-home {
    padding: 1rem 1rem 4rem 1rem;
  }

  .header-section-playlists-home h2 {
    font-size: 2rem;
    padding-left: .5rem;
    text-align: center;

    margin-bottom: -.5rem;
  }

  .header-section-playlists-home {
    margin-bottom: .5rem;
  }

  .view-all-button-playlists-home {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
  }

  .platforms-grid-playlists-home {
    grid-template-columns: repeat(4, 1fr);
    gap: .5rem;
    width: 50rem;
  }
  
  .platform-card-playlists-home {
    aspect-ratio: 1 / 1;
    border-radius: 1.5rem;
  }
  
  .playlist-title-text-playlists-home {
    font-size: 1.1rem;
    margin-left: 1.25rem;
    width: calc(100% - 2.5rem);
    max-width: calc(100% - 2.5rem);
  }
  
  .platform-header-info-playlists-home {
    margin-left: 1.25rem;
    margin-top: 0.35rem;
    gap: 0.5rem;
  }
  
  .platform-svg-icon {
    width: 1.2rem;
    height: 1.2rem;
  }
  
  .platform-title-playlists-home {
    font-size: 1rem;
  }

  .play-button {
    width: 65px;
    height: 65px;
  }

  .close-embed-button {
    width: 3rem;
    height: 1.75rem;
    top: 0.9rem;
    right: -0.37rem;
  }
}

/* Tablet Landscape (Seitlich gehlaten) | 951px - 1366px */
@media (min-width: 951px) and (max-width: 1366px) and (orientation: landscape) {
  .container-all-music-grid-playlists-home {
    max-width: 100%;
  }

  .header-section-playlists-home {
    padding-left: 2.75rem;
  }

  .header-section-playlists-home h2 {
    font-size: 2rem;
    padding-left: 0;
    text-align: center;
  }

  .view-all-button-playlists-home {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
  }

  .platforms-grid-playlists-home {
    grid-template-columns: repeat(4, 1fr);
    gap: .5rem;
    margin: 0rem 1rem 0rem;
  }
  
  .platform-card-playlists-home {
    aspect-ratio: 1 / 1;
    border-radius: 1.25rem;
  }
  
  .playlist-title-text-playlists-home {
    font-size: 1rem;
    margin-left: 1rem;
    width: calc(100% - 2rem);
    max-width: calc(100% - 2rem);
  }
  
  .platform-header-info-playlists-home {
    margin-left: 1rem;
    margin-top: 0.2rem;
    gap: 0.4rem;
  }
  
  .platform-svg-icon {
    width: 1.1rem;
    height: 1.1rem;
  }
  
  .platform-title-playlists-home {
    font-size: 1rem;
  }

  .play-button {
    width: 58px;
    height: 58px;
  }

  .close-embed-button {
    width: 2.75rem;
    height: 1.6rem;
    top: 0.8rem;
    right: -0.3rem;
  }
}