/* --- Global Resets & Variables (Apple Music Dark Mode Inspired) --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

:root {
    --primary-red: #FA2C56; /* Apple Music's primary accent */
    --primary-blue: #007AFF; /* Another common accent */
    --background-dark: #000000; /* Deeper dark background */
    --background-card: #2C2C2E; /* Slightly lighter for cards */
    --text-light: #F2F2F7; /* Lighter white text */
    --text-gray: #8E8E93; /* Subtle gray text */
    --border-color: rgba(255, 255, 255, 0.1); /* Subtle borders */
    --player-height-desktop: 90px;
    --player-height-mobile: 120px; /* Taller for the new stacked layout */
    --header-height-desktop: 70px;
    --header-height-mobile: 60px;
}

body {
    background: var(--background-dark);
    color: var(--text-light);
    min-height: 100vh;
    padding-bottom: var(--player-height-desktop); /* Default padding for player */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* === NEW: OPENING ANIMATION STYLES === */
#splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--background-dark);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 1s ease-in-out;
}

#splash-screen.fade-out {
    opacity: 0;
}

.splash-logo h1 {
    font-size: 3rem;
    font-weight: 700;
    color: var(--text-light);
    animation: logo-fade-in 1.5s ease-in-out;
}

.splash-logo span {
    color: var(--primary-red);
}

@keyframes logo-fade-in {
    from {
        opacity: 0;
        transform: scale(0.6);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.hidden {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}
/* === END OF ANIMATION STYLES === */

.container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 30px; /* More generous padding */
}

/* --- Header --- */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 30px;
    height: var(--header-height-desktop);
    position: sticky;
    top: 0;
    background: var(--background-dark);
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
}

.logo h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-light);
}

.logo span {
    color: var(--primary-red);
}

.main-nav .nav-list {
    display: flex;
    list-style: none;
    gap: 35px;
}

.main-nav .nav-list li a {
    color: var(--text-gray);
    text-decoration: none;
    font-size: 1.05rem;
    font-weight: 500;
    transition: color 0.2s ease-in-out;
}

.main-nav .nav-list li a:hover,
.main-nav .nav-list li a.active {
    color: var(--text-light);
    font-weight: 600;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-gray);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 5px;
    transition: color 0.2s ease-in-out;
}

.icon-btn:hover {
    color: var(--text-light);
}

.search-input-desktop {
    display: flex; /* Always visible on desktop */
}

#search-input {
    padding: 8px 15px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: var(--background-card);
    color: var(--text-light);
    font-size: 1rem;
    width: 200px;
    outline: none;
    transition: border-color 0.2s ease-in-out, width 0.3s ease-in-out;
}

#search-input:focus {
    border-color: var(--primary-red);
    width: 250px;
}

#search-input::placeholder {
    color: var(--text-gray);
}

#mobile-menu-btn {
    display: none; /* Hidden on desktop */
}

/* --- Mobile Navigation Overlay --- */
#mobile-nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7); /* Semi-transparent overlay */
    z-index: 1001;
    display: flex;
    justify-content: flex-end;
    visibility: hidden; /* Hidden by default */
    opacity: 0;
    transition: visibility 0s, opacity 0.3s ease-in-out;
}

#mobile-nav-overlay.show {
    visibility: visible;
    opacity: 1;
}

.mobile-nav-content {
    width: 300px; /* Width of the sidebar */
    height: 100%;
    background: var(--background-dark);
    padding: 20px;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.3);
    transform: translateX(100%); /* Start off-screen */
    transition: transform 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
}

#mobile-nav-overlay.show .mobile-nav-content {
    transform: translateX(0); /* Slide in */
}

.mobile-nav-content .close-btn {
    align-self: flex-start;
    margin-bottom: 20px;
    font-size: 1.8rem;
    color: var(--text-gray);
}

.mobile-search-field {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: var(--background-card);
    color: var(--text-light);
    font-size: 1rem;
    margin-bottom: 30px;
    outline: none;
}
.mobile-search-field::placeholder {
    color: var(--text-gray);
}

.mobile-nav-list {
    list-style: none;
    flex-grow: 1;
}

.mobile-nav-list li {
    margin-bottom: 15px;
}

.mobile-nav-list li a {
    color: var(--text-light);
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 500;
    display: block;
    padding: 8px 0;
}

.mobile-nav-list li a.active {
    color: var(--primary-red);
    font-weight: 600;
}

.mobile-nav-list .separator {
    height: 1px;
    background: var(--border-color);
    margin: 20px 0;
}

/* --- Main Content --- */
main {
    padding: 30px 0;
}

.home-section, .search-results-section {
    margin-bottom: 60px;
}

h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 30px;
    padding: 0 30px; /* Matches container padding */
}

/* Music Grid (for Trending, New Releases, Podcasts) */
.music-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 25px;
    padding: 0 30px; /* Matches container padding */
}

.music-card {
    background: none; /* No background for the card itself */
    border-radius: 0; /* No border-radius for the card itself */
    padding: 0; /* No padding for the card itself */
    cursor: pointer;
    transition: transform 0.2s ease-in-out;
    display: flex;
    flex-direction: column;
    align-items: flex-start; /* Align text to the left */
}

.music-card:hover {
    transform: translateY(-3px); /* Subtle lift on hover */
}

.music-card img {
    width: 100%;
    aspect-ratio: 1/1; /* Ensure square aspect ratio for album art */
    border-radius: 6px; /* Rounded corners for the image */
    object-fit: cover;
    margin-bottom: 8px; /* Space between image and title */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.music-card h3 {
    font-size: 1rem; /* Consistent title size */
    font-weight: 500; /* Slightly lighter weight than before */
    margin-bottom: 2px; /* Less space between title and artist */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    color: var(--text-light);
    line-height: 1.3; /* Ensure readability */
}

.music-card p {
    font-size: 0.85rem; /* Consistent artist size */
    color: var(--text-gray); /* Subtle gray for artist */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    line-height: 1.3; /* Ensure readability */
}

/* Music List (for Search Results - Apple Music style) */
.music-list {
    display: flex;
    flex-direction: column;
    padding: 0 30px; /* Matches container padding */
}

.music-list-item {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background-color 0.2s ease-in-out;
}

.music-list-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.music-list-item:first-child {
    border-top: 1px solid var(--border-color);
}

.music-list-item img {
    width: 50px;
    height: 50px;
    border-radius: 4px;
    object-fit: cover;
    margin-right: 15px;
    flex-shrink: 0;
}

.music-list-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.music-list-info .title {
    font-size: 1rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-light);
}

.music-list-info .artist {
    font-size: 0.9rem;
    color: var(--text-gray);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.music-list-item .options-btn {
    margin-left: 15px;
    color: var(--text-gray);
    font-size: 1.2rem;
    padding: 5px;
    background: none;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
}

.music-list-item .options-btn:hover {
    color: var(--text-light);
}

/* --- Player Bar --- */
.player-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--background-card);
    border-top: 1px solid var(--border-color);
    z-index: 1000;
    height: var(--player-height-desktop);
    display: flex;
    align-items: center;
    padding: 0 30px;
}

.player-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 20px;
}

.player-left {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 25%;
    min-width: 200px;
}

.player-left img {
    width: 50px;
    height: 50px;
    border-radius: 4px;
    object-fit: cover;
}

.player-left .song-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.player-left .song-info span {
    font-size: 0.9rem;
}

.player-left .song-info #song-title {
    font-weight: 600;
    color: var(--text-light);
}

.player-left .song-info #song-artist {
    color: var(--text-gray);
}

.truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.love-btn {
    font-size: 1.1rem;
}

.player-center {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    max-width: 600px;
}

.player-center .controls {
    display: flex;
    align-items: center;
    gap: 25px;
}

.player-center .controls .icon-btn {
    font-size: 1.3rem;
    color: var(--text-gray);
}

.player-center .controls .icon-btn.active { /* For shuffle/repeat active state */
    color: var(--primary-red);
}

.play-pause-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--text-light);
    color: var(--background-dark);
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: transform 0.2s ease-in-out;
}

.play-pause-btn:hover {
    transform: scale(1.05);
}

.progress-container {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.progress-container span {
    font-size: 0.85rem;
    color: var(--text-gray);
    width: 40px;
    text-align: center;
    flex-shrink: 0;
}

#progress-bar {
    -webkit-appearance: none;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.2);
    flex-grow: 1;
    cursor: pointer;
    outline: none;
}

#progress-bar::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary-red);
    box-shadow: 0 0 0 2px var(--background-dark);
}

.player-right {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 25%;
    justify-content: flex-end;
    min-width: 150px;
}

#volume-slider {
    -webkit-appearance: none;
    width: 100px;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.2);
    cursor: pointer;
    outline: none;
}

#volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary-red);
    box-shadow: 0 0 0 2px var(--background-dark);
}

/* --- Footer --- */
.footer {
    background: #000;
    padding: 50px 0 30px;
    padding-left: 15px;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 40px;
    margin-bottom: 40px;
}

.footer-col {
    flex: 1;
    min-width: 200px;
}

.footer-col h3 {
    color: var(--text-light);
    margin-bottom: 20px;
    font-size: 1.3rem;
}

.footer-col p {
    color: var(--text-gray);
    margin-bottom: 20px;
}

.footer-col ul {
    list-style: none;
    padding: 0;
}

.footer-col ul li {
    margin-bottom: 12px;
}

.footer-col ul li a {
    color: var(--text-gray);
    text-decoration: none;
    transition: color 0.3s;
}

.footer-col ul li a:hover {
    color: var(--primary-red);
}

.social-links {
    display: flex;
    gap: 15px;
}

.so-text-deco {
    text-decoration: none !important;
}

.social-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--background-card);
    color: var(--text-light);
    font-size: 1.2rem;
    transition: all 0.3s;
    text-decoration: none;
}

.social-links a:hover {
    background: var(--primary-red);
    transform: translateY(-3px);
}

.copyright {
    text-align: center;
    padding-top: 30px;
    border-top: 1px solid var(--border-color);
    color: var(--text-gray);
    font-size: 0.9rem;
}

.credit {
    margin-top: 8px;
}

.credit a {
  color: var(--primary-red);
  text-decoration: none;
  transition: color 0.3s ease;
}

.credit a:hover {
    text-decoration: underline;
}

/* --- Mobile Responsiveness --- */

/* === NEW: Mobile Playback Notice Styles === */
#mobile-playback-notice {
    display: none; /* Hidden by default on desktop */

}

@media (max-width: 1024px) {
    /* Make the notice visible only on mobile screens */
    #mobile-playback-notice {
        display: flex;
        align-items: center;
        gap: 15px;
        background-color: var(--background-card);
        color: var(--text-gray);
        padding: 12px 20px;
        margin: 0px 20px 20px 20px; /* Margin top/bottom and left/right */
        border-radius: 8px;
        font-size: 0.9rem;
        line-height: 1.5;
    }

    #mobile-playback-notice i {
        font-size: 1.2rem;
        color: var(--primary-red);
    }

    .container, header, h2, .music-grid, .music-list {
        padding: 0 20px;
    }

    .main-nav, .search-input-desktop {
        display: none;
    }

    #mobile-menu-btn {
        display: block;
    }

    body {
        padding-bottom: var(--player-height-mobile); /* Adjust body padding for new taller mobile player */
    }

    .player-bar {
        padding: 10px 20px;
        height: var(--player-height-mobile); /* Apply new height */
    }

    .player-content {
        flex-direction: column;
        justify-content: center;
        gap: 8px; /* Added a small gap between rows */
    }
    
    .player-center {
        /* On mobile, player-center elements are reorganized */
        display: contents; 
    }

    .player-left {
        width: 100%;
        min-width: 0;
        gap: 10px;
        order: 1; /* First row: Album art and song info */
    }
    
    .player-bar .progress-container {
        display: flex; /* Ensure progress bar is visible */
        width: 100%;
        order: 2; /* Second row: Progress bar */
    }
    
    .player-bar .controls {
        display: flex; /* Ensure controls are visible */
        width: 100%;
        justify-content: center;
        gap: 20px; /* Space between control buttons */
        order: 3; /* Third row: Playback controls */
    }

    .player-center .controls .icon-btn {
        font-size: 1.3rem; /* Adjust icon size for mobile */
    }

    .player-center .play-pause-btn {
        width: 45px;
        height: 45px;
        font-size: 1.4rem;
    }
    
    .player-right {
        display: none; /* Hide volume and other controls on mobile for simplicity */
    }

    .music-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 15px;
    }

    .footer-content {
        flex-direction: column;
        gap: 30px;
    }
}

@media (max-width: 768px) {
    header {
        height: var(--header-height-mobile);
    }
    .logo h1 {
        font-size: 1.5rem;
    }
    #search-toggle-btn {
        display: block;
        font-size: 1.2rem;
    }
    
}

@media (max-width: 480px) {
    .container, header, h2, .music-grid, .music-list {
        padding: 0 15px;
    }

    .music-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 10px;
    }
    .player-bar {
        padding: 10px 15px;
    }

    #mobile-playback-notice {
        margin: 15px 15px 15px 15px; /* Adjust margin for smaller screens */
    }
}