/* -----------------------------
   Global & Reset
----------------------------- */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #444031;
    min-height: 100vh;
    color: #efe7c7;
}


/* -----------------------------
   Navigation
----------------------------- */

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background-color: #5d5a4d;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(207, 230, 85, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar h1 {
    font-family: 'Papyrus', cursive;
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    color: #cfe655;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-right input.search-bar {
    padding: 0.75rem 1rem;
    border-radius: 20px;
    border: 1px solid #cfe655;
    background-color: #444031;
    color: #efe7c7;
    transition: all 0.3s ease;
}

.search-bar:focus {
    outline: none;
    border-color: #cfe655;
    background: rgba(239, 231, 199, 0.2);
    box-shadow: 0 0 20px rgba(207, 230, 85, 0.3);
    transform: scale(1.02);
}

.login-button {
    background-color: #cfe655;
    color: #444031;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: .50s linear;
}

.login-button:hover {
    background-color: #1ed760;
    transform: scale(1.05);
    background: linear-gradient(45deg, #1ed760, #cfe655);
}

/* Main Content */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    display: grid;
    gap: 3rem;
}

/* Optional: Add some visual indicators for scrolling */
#artists-container::before {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 20px;
    background: linear-gradient(to left, rgba(68, 64, 49, 0.8), transparent);
    pointer-events: none;
    z-index: 1;
}


/* -----------------------------
   Section Headers
----------------------------- */

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-header h2 {
    font-size: clamp(1.2rem, 2.5vw, 1.5rem);
    font-weight: 700;
}

.show-all-link {
    color: #868761;
    text-decoration: none;
    font-size: 0.9rem;
    position: relative;
    transition: all 0.3s ease;
}

.show-all-link:hover {
    color: #cfe655;
}

.show-all-link::after {
    content: ' →';
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.3s ease;
}

.show-all-link:hover::after {
    opacity: 1;
    transform: translateX(0);
}

.featured-artists {
    min-width: 0; /* This is the magic fix! */
}

/* Also add this for your other sections to prevent future issues */
.recently-played {
    min-width: 0;
}

.user-playlists {
    min-width: 0;
}

.trending-section {
    min-width: 0;
}


/* -----------------------------
   Card Styles
----------------------------- */
.card {
    flex: 0 0 auto; /* Prevent shrinking */
    width: 150px;
    background-color: #5d5a4d;
    border-radius: 15px;
    text-align: center;
    padding: 0.75rem 1.5rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 50%;
    margin-bottom: 0.9rem;
}

.card h3 {
    font-size: 14px;
    margin: 5px 0;
}

.card p {
    font-size: 12px;
    color: #bdba95;
    margin-bottom: 0.9rem;
}

.card button {
    padding: 6px 15px;
    border: none;
    border-radius: 20px;
    background-color: #cfe655;
    color: #444031;
    cursor: pointer;
    transition: all 0.3s ease;
}

.card button:hover {
    background-color: #8c9658;
    color: #ffffff;
    transform: translateY(-3px);
}


/* -----------------------------
   Loading Spinner
----------------------------- */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    color: #cfe655;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(207, 230, 85, 0.3);
    border-top: 4px solid #cfe655;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}


/*---------------------------------
 Featured Artists Styling
 ----------------------------------*/

#artists-container .card {
    flex: 0 0 auto;
    width: 180px;
    text-align: center;
    backdrop-filter: blur(10px);
    padding: 1.5rem;
    background-color: #5d5a4d;
    border-radius: 20px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

#artists-container .card img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 1rem;
    transition: all .3s ease;
}

/* Glow effect on hover for artists images */
#artists-container .card img:hover {
    box-shadow: 0 0 15px 3px rgba(207, 230, 85, 0.7); /* greenish glow */
    transform: scale(1.05);
}

#artists-container .card .follow-btn {
    background-color: #cfe655;
    color: #444031;
    border: none;
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
}

#artists-container .card .follow-btn:hover {
    background-color: #8c9658;
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 3px 6px rgba(0,0,0,0.2);
}

#artists-container {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 1.5rem 0;
    scroll-behavior: smooth;
    width: 100%;
    /* This is crucial - don't let the container compress */
    flex-wrap: nowrap;
}

#artists-container::-webkit-scrollbar {
    height: 6px;
}

#artists-container::-webkit-scrollbar-thumb {
    background-color: #cfe655;
    border-radius: 4px;
}

#artists-container::-webkit-scrollbar-track {
    background-color: #5d5a4d;
    border-radius: 4px;
}


/*---------------------------------
 Common cards container styling
 ----------------------------------*/

.cards-container {
    display: flex;
    overflow-x: auto;
    gap: 20px;
    padding: 1rem 0;
    scroll-behavior: smooth;
    width: 100%;
    flex-wrap: nowrap;
}

.cards-container .card {
    flex: 0 0 auto;
    width: 180px;
    min-width: 180px;
}

.cards-container::-webkit-scrollbar {
    height: 6px;
}

.cards-container::-webkit-scrollbar-thumb {
    background-color: #cfe655;
    border-radius: 4px;
}

.cards-container::-webkit-scrollbar-track {
    background-color: #5d5a4d;
    border-radius: 4px;
}

/*---------------------------------
 Recently Played Section styling
 ----------------------------------*/

#recent-container .card {
    flex: 0 0 auto;
    width: 200px; /* Slightly wider for track info */
    min-width: 200px;
    background-color: #5d5a4d;
    border-radius: 15px;
    padding: 1rem;
    text-align: left; /* Left align for track info */
}

#recent-container .card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

#recent-container .card img {
    width: 100%;
    height: 160px;
    border-radius: 10px;
    object-fit: cover;
    margin-bottom: 0.75rem;
    transition: transform 0.3s ease;
}

#recent-container .card h3 {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    color: #efe7c7;
    font-size: 0.95rem;
    margin: 0.5rem 0;
    line-height: 1.3;
    /* Limit to 2 lines */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

#recent-container .card p {
    font-family: 'Poppins', sans-serif;
    color: #bdba95;
    font-size: 0.8rem;
    margin-bottom: 0.75rem;
    /* Limit to 1 line */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#recent-container .card .play-button {
    background-color: #cfe655;
    color: #444031;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.3s ease;
    width: 100%;
}

#recent-container .card .play-button:hover {
    background-color: #8c9658;
    color: #ffffff;
    transform: translateY(-2px);
}

/* To ensure the cards-container base styles apply */
#recent-container.cards-container {
    display: flex;
    overflow-x: auto;
    gap: 20px;
    padding: 1rem 0;
    scroll-behavior: smooth;
    width: 100%;
    flex-wrap: nowrap;
}

/*---------------------------------
 User Playlists Section styling
 ----------------------------------*/

#playlists-container .card {
    flex: 0 0 auto;
    width: 200px;
    min-width: 200px;
    background-color: #5d5a4d;
    border-radius: 15px;
    padding: 1rem;
    text-align: left;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer; /* Make the whole card clickable */
}

#playlists-container .card img {
    width: 100%;
    height: 160px;
    border-radius: 10px;
    object-fit: cover;
    margin-bottom: 0.75rem;
    transition: transform 0.3s ease;
}

#playlists-container .card h3 {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    color: #efe7c7;
    font-size: 0.95rem;
    margin: 0.5rem 0;
    line-height: 1.3;
    /* Limit to 2 lines for long playlist names */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

#playlists-container .card p {
    font-family: 'Poppins', sans-serif;
    color: #bdba95;
    font-size: 0.75rem;
    margin-bottom: 0.75rem;
    line-height: 1.3;
    /* Limit to 2 lines for descriptions */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

#playlists-container .card .play-button {
    background-color: #cfe655;
    color: #444031;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.3s ease;
    width: 100%;
    position: relative;
    z-index: 2; /* Ensure button is clickable over card click */
}

#playlists-container .card .play-button:hover {
    background-color: #8c9658;
    color: #ffffff;
    transform: translateY(-2px);
}

/* Special styling for playlists without images */
#playlists-container .card img[src*="placeholder"] {
    background: linear-gradient(135deg, #5d5a4d 0%, #cfe655 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #444031;
    font-weight: bold;
    font-size: 0.9rem;
}

/* Ensure the cards-container base styles apply */
#playlists-container.cards-container {
    display: flex;
    overflow-x: auto;
    gap: 20px;
    padding: 1rem 0;
    scroll-behavior: smooth;
    width: 100%;
    flex-wrap: nowrap;
}

/* Animation when cards are loaded */
#playlists-container .card {
    opacity: 0;
    animation: fadeInUp 0.5s ease forwards;
}

#playlists-container .card:nth-child(1) { animation-delay: 0.1s; }
#playlists-container .card:nth-child(2) { animation-delay: 0.2s; }
#playlists-container .card:nth-child(3) { animation-delay: 0.3s; }
#playlists-container .card:nth-child(4) { animation-delay: 0.4s; }
#playlists-container .card:nth-child(5) { animation-delay: 0.5s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/*---------------------------------
 Trending Section Styling 
 ----------------------------------*/


#trending-container .card {
    flex: 0 0 auto;
    width: 200px;
    min-width: 200px;
    background-color: #5d5a4d;
    border-radius: 15px;
    padding: 1rem;
    text-align: left;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

#trending-container .card img {
    width: 100%;
    height: 160px;
    border-radius: 10px;
    object-fit: cover;
    margin-bottom: 0.75rem;
    transition: transform 0.3s ease;
}

#trending-container .card h3 {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    color: #efe7c7;
    font-size: 0.95rem;
    margin: 0.5rem 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

#trending-container .card p {
    font-family: 'Poppins', sans-serif;
    color: #bdba95;
    font-size: 0.75rem;
    margin-bottom: 0.75rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

#trending-container .card a {
    background-color: #cfe655;
    color: #444031;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.3s ease;
    width: 100%;
    display: inline-block;
    text-align: center;
    text-decoration: none;
}

#trending-container .card a:hover {
    background-color: #8c9658;
    color: #ffffff;
    transform: translateY(-2px);
}

/* Placeholder for missing album covers */
#trending-container .card img[src*="placeholder"] {
    background: linear-gradient(135deg, #5d5a4d 0%, #cfe655 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #444031;
    font-weight: bold;
    font-size: 0.9rem;
}

/* Scrolling row of cards */
#trending-container.cards-container {
    display: flex;
    overflow-x: auto;
    gap: 20px;
    padding: 1rem 0;
    scroll-behavior: smooth;
    width: 100%;
    flex-wrap: nowrap;
}

/* Animation when cards load */
#trending-container .card {
    opacity: 0;
    animation: fadeInUp 0.5s ease forwards;
}

#trending-container .card:nth-child(1) { animation-delay: 0.1s; }
#trending-container .card:nth-child(2) { animation-delay: 0.2s; }
#trending-container .card:nth-child(3) { animation-delay: 0.3s; }
#trending-container .card:nth-child(4) { animation-delay: 0.4s; }
#trending-container .card:nth-child(5) { animation-delay: 0.5s; }


/* -----------------------------
   Footer Styling
----------------------------- */
/* Footer Styles */
#site-footer {
    background-color: #2c2a24; /* dark tone for footer */
    color: #efe7c7;
    padding: 1.5rem 1rem;
    text-align: center;
    font-family: 'Poppins', sans-serif;
    margin-top: 2rem;
}

#site-footer .footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

#site-footer .footer-content p {
    margin: 0;
    font-size: 0.9rem;
    color: #bdba95;
    line-height: 1.4;
}

#site-footer .footer-content span {
    color: #cfe655;
    font-weight: 600;
}

#site-footer .developer a {
    text-decoration: none;
    color: #cfe655;
    transition: color 0.3s ease;
}

#site-footer .developer a:hover {
    color: #ffffff; /* hover effect */
}


/*---------------------------------*/
/* Responsive Design */
/*---------------------------------*/
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .nav-right {
        width: 100%;
        justify-content: center;
    }

    .search-bar {
        width: 100%;
        max-width: 300px;
    }

    .main-content {
        padding: 1rem;
        gap: 2rem;
    }

    .cards-container {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1rem;
    }

    .card {
        width: 120px;
        padding: 0.5rem 1rem;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .cards-container .card {
        width: 140px;
    }
}

/* Larger screens */
@media (min-width: 768px) {
    #site-footer .footer-content {
        flex-direction: row;
        justify-content: center;
        gap: 2rem;
    }

    #site-footer .footer-content p {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .navbar {
        flex-direction: column;
        gap: 10px;
    }

    .nav-right {
        width: 100%;
        flex-direction: column;
        gap: 10px;
    }

    .search-bar {
        width: 100%;
    }

    .cards-container {
        grid-template-columns: 1fr;
    }

    .artist-card, .song-card {
        padding: 1rem;
    }

    .artist-card img {
        width: 100px;
        height: 100px;
    }

    .cards-container .card {
        width: 120px;
    }


}

