:root {
    /* colors */
    --primary-color: #dfdfe2;
    --secondary-color: #ffffff;
    --app-background-color: #4d4d62;
    --background-color: #1b1b32;
    --foreground-color: #3b3b4f;
    --highlight-color: #f1be32;

    /* font sizes */
    --root-font-size: 16px;
    font-size: var(--root-font-size);

    /* font-families */
    --font-headline: "Roboto Mono", monospace;
    --font-family: "Lato", sans-serif;
}

*,
*::after,
*::before {
    box-sizing: border-box;
}

body {
    background-color: var(--app-background-color);
    color: var(--primary-color);
    font-family: var(--font-family);
}

h1 {
    font-size: 1.125rem;
    line-height: 1.6;
}

h2 {
    font-size: var(--root-font-size);
}

ul {
    margin: 0;
}

.container {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    row-gap: 5px;
}

.player,
.playlist {
    width: 450px;
    background-color: var(--background-color);
    border: 3px solid var(--foreground-color);
    border-radius: 8px;
}

.player {
    height: 320px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    row-gap: 10px;
}

.player-bar,
.playlist-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 5px;
    width: 100%;
    height: 30px;
    background-color: var(--foreground-color);
    border-radius: 4px;
}

.parallel-lines {
    display: flex;
    flex-wrap: wrap;
    row-gap: 6px;
    padding: 0 5px;
}

.parallel-lines>div {
    height: 2px;
    width: 100%;
    min-width: 75px;
    background-color: var(--highlight-color);
}

.fcc-title,
.playlist-title {
    color: var(--secondary-color);
    margin: 10px 10px;
    font-family: var(--font-headline);
    white-space: nowrap;
    flex-shrink: 0;
    /* Default: no shrinking */
}

/* Shrink only on mobile */
@media (max-width: 700px) {

    .fcc-title,
    .playlist-title {
        flex-shrink: 1;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: 0.85rem;
    }
}
.player-content {
    display: flex;
    background-color: var(--foreground-color);
    width: 430px;
    height: 260px;
    column-gap: 13px;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

#player-album-art {
    background-color: var(--secondary-color);
    border: 6px solid var(--background-color);
    border-radius: 4px;
    box-shadow: 0 0 20px rgba(241, 190, 50, 0.3);
    transition: box-shadow 0.3s ease;
}

#player-album-art:hover {
    box-shadow: 0 0 30px rgba(241, 190, 50, 0.5);
}

#player-album-art img {
    width: 150px;
    display: block;
    border-radius: 2px;
}

.player-display {
    display: flex;
    flex-direction: column;
    row-gap: 15px;
    padding: 14px;
    background-color: var(--background-color);
    height: 220px;
    width: 226px;
    border-radius: 6px;
}

.player-display-song-artist {
    height: 60px;
    text-align: center;
}

.player-buttons svg {
    fill: var(--primary-color);
    transition: fill 0.3s ease;
}

.playing>svg {
    fill: var(--highlight-color);
}

.player-buttons {
    display: flex;
    justify-content: space-around;
}

button {
    background: transparent;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-size: var(--root-font-size);
    outline-color: var(--highlight-color);
    text-align: center;
    transition: all 0.3s ease;
    border-radius: 4px;
    padding: 5px;
}

.playlist-song {
    outline-color: var(--highlight-color);
    transition: all 0.3s ease;
    border-radius: 4px;
}

.playlist li:not(:last-child) {
    border-bottom: 1px solid var(--background-color);
}

button:focus,
.playlist-song:focus {
    outline: none;
}

/* Enhanced button hover effects */
.player-buttons button:hover {
    transform: scale(1.1);
    filter: brightness(1.2);
    background-color: rgba(241, 190, 50, 0.1);
}

.player-buttons button:hover svg {
    fill: var(--highlight-color);
}

/* Playlist song hover effects */
.playlist-song:hover {
    background-color: rgba(59, 59, 79, 0.8);
    transform: translateX(5px);
}

/* Current playing song enhancement */
[aria-current="true"] {
    background: linear-gradient(90deg, var(--background-color) 0%, rgba(59, 59, 79, 0.8) 100%);
    border-left: 3px solid var(--highlight-color);
}

.player-display {
    display: flex;
    flex-direction: column;
    row-gap: 12px;
    padding: 14px;
    background-color: var(--background-color);
    height: 220px;
    /* Fixed height */
    width: 226px;
    border-radius: 6px;
    /* Add these to handle content overflow */
    min-height: 220px;
    /* Ensure minimum height */
    overflow: hidden;
    /* Prevent content from overflowing */
}

.player-display-song-artist {
    height: auto;
    min-height: 60px;
    /* Reserve space for song info */
    max-height: 80px;
    /* Limit maximum height */
    overflow: hidden;
    /* Hide any overflow */
    display: flex;
    flex-direction: column;
    justify-content: center;
}

#player-song-title {
    font-weight: bold;
    margin: 0;
    font-size: 1.125rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

@media (max-width: 700px) {
    #player-song-title {
        white-space: normal;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        line-height: 1.3;
        max-height: 2.6em;
        overflow: hidden;
    }
}

#player-song-artist {
    color: var(--highlight-color);
    font-size: 0.75rem;
    margin: 5px 0 0 0;
    /* Add text truncation for long artist names */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* Progress bar */
.progress-container {
    width: 100%;
    height: 6px;
    background-color: var(--foreground-color);
    border-radius: 3px;
    cursor: pointer;
    margin: 5px 0;
    flex-shrink: 0;
    /* Prevent squeezing */
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--highlight-color), #f1a632);
    border-radius: 3px;
    width: 0%;
    transition: width 0.1s ease;
    position: relative;
}

.progress-bar::after {
    content: '';
    position: absolute;
    right: -4px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background: var(--highlight-color);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.progress-container:hover .progress-bar::after {
    opacity: 1;
}

/* Mobile adjustments for progress bar */
@media (max-width: 700px) {
    .progress-container {
        height: 5px;
        /* Slightly thinner on mobile */
        margin: 8px 0 4px 0;
        /* Adjusted spacing */
    }

    .progress-bar::after {
        width: 6px;
        /* Smaller handle on mobile */
        height: 6px;
        right: -3px;
    }
}

/* Time display - keep it compact */
.time-display {
    display: flex;
    justify-content: space-between;
    width: 100%;
    font-size: 0.75rem;
    color: var(--primary-color);
    margin-top: -5px;
    flex-shrink: 0;
    /* Prevent squeezing */
}

/* Volume control */
.volume-control {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    margin-top: 5px;
}

.volume-slider {
    flex: 1;
    height: 4px;
    background: var(--foreground-color);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--highlight-color);
    cursor: pointer;
    transition: all 0.3s ease;
}

.volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: #f1a632;
}

/* Search container */
.search-container {
    width: 430px;
    padding: 10px;
}

.search-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--foreground-color);
    background-color: var(--background-color);
    color: var(--primary-color);
    border-radius: 4px;
    font-size: 0.875rem;
}

.search-input:focus {
    outline: 2px solid var(--highlight-color);
    border-color: var(--highlight-color);
}

.search-input::placeholder {
    color: #8a8a9e;
}

/* Loading animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--foreground-color);
    border-radius: 50%;
    border-top-color: var(--highlight-color);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Pulse animation for play button when playing */
.playing {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

/* Enhanced scrollbar for playlist */
#playlist-songs {
    scrollbar-color: var(--highlight-color) var(--foreground-color);
    scrollbar-width: thin;
}

#playlist-songs::-webkit-scrollbar {
    width: 8px;
}

#playlist-songs::-webkit-scrollbar-track {
    background: var(--foreground-color);
    border-radius: 4px;
}

#playlist-songs::-webkit-scrollbar-thumb {
    background: var(--highlight-color);
    border-radius: 4px;
}

#playlist-songs::-webkit-scrollbar-thumb:hover {
    background: #f1a632;
}

/* Delete button enhancement */
.playlist-song-delete {
    padding: 0;
    width: 20px;
    height: 20px;
    transition: all 0.3s ease;
}

.playlist-song-delete:hover {
    transform: scale(1.2);
}

.playlist-song-delete:hover circle {
    fill: #ff4444;
}

/* Disabled state for buttons */
button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

button:disabled:hover {
    filter: none;
    background-color: transparent;
}

/* Playlist */
.playlist {
    height: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    row-gap: 10px;
}

#playlist-songs {
    width: 430px;
    height: 300px;
    background-color: var(--foreground-color);
    display: flex;
    flex-direction: column;
    row-gap: 8px;
    padding: 8px 9px;
    visibility: visible;
    justify-content: start;
    list-style: none;
    border-radius: 6px;
    overflow-y: auto;
}

.playlist-song {
    display: flex;
    height: 55px;
    justify-content: space-between;
    align-items: center;
    padding: 5px 10px;
}

.playlist-song-info {
    height: 100%;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-around;
    column-gap: 7px;
    padding: 5px 0;
    font-family: var(--font-family);
    flex: 1;
}

#player-song-title,
#player-song-artist {
    margin: 0;
}

#player-song-artist {
    color: var(--highlight-color);
    font-size: 0.75rem;
}

#player-song-title {
    font-size: 1.125rem;
    font-weight: bold;
}

.playlist-song-title {
    font-size: 0.85rem;
    width: 200px;
    text-align: left;
    font-weight: 500;
}

.playlist-song-artist {
    font-size: 0.725rem;
    width: 80px;
    color: #8a8a9e;
}

.playlist-song-duration {
    font-size: 0.725rem;
    margin: auto;
    font-family: var(--font-headline);
    width: 40px;
    text-align: center;
    color: var(--highlight-color);
}

@media (max-width: 700px) {

    .player,
    .playlist {
        width: 300px;
    }

    .player {
        height: 400px;
    }

    #playlist-songs {
        height: 280px;
        padding: 5px 6px;
        overflow-y: scroll;
        overflow-x: hidden;
    }

    #playlist-songs::-webkit-scrollbar {
        width: 5px;
    }

    #playlist-songs::-webkit-scrollbar-track {
        background: var(--background-color);
    }

    #playlist-songs::-webkit-scrollbar-thumb {
        background: var(--secondary-color);
    }

    h1 {
        font-size: 0.813rem;
    }

    h2 {
        font-size: 0.75rem;
    }

    .player-bar,
    .playlist-bar,
    .player-content,
    #playlist-songs,
    .search-container {
        width: 280px;
    }

    .playlist-song {
        justify-content: space-between;
    }

    .playlist-song-title {
        width: 140px;
    }

    .playlist-song-artist {
        width: 40px;
    }

    .playlist-song-duration>button {
        padding: 0;
    }

    .player-content {
        display: inline;
        position: relative;
        justify-items: center;
        height: 100%;
    }

    #player-album-art {
        z-index: -100;
        height: 280px;
        box-shadow: none;
        background: #000;
    }

    #player-album-art img {
        width: 100%;
        opacity: 0.6;
    }

    .player-display-song-artist {
        padding: 0 10px;
    }

    .player-display-song-artist>p {
        white-space: pre-wrap;
    }

    .player-display {
        position: absolute;
        width: 100%;
        z-index: 1000;
        background-color: transparent;
        top: 0;
        height: 280px;
        justify-content: space-between;
        text-align: center;
    }
}

