:root {
    --bg-color: #0b0b0b;
    --text-primary: #ffffff;
    --text-secondary: #a7a7a7;
    --accent-color: #1db954;
    --surface-color: rgba(18, 18, 18, 0.6);
    --blur-amount: 90px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text-primary);
    background-color: var(--bg-color);
    overflow: hidden;
    height: 100vh;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

#background {
    position: fixed;
    top: -15%;
    left: -15%;
    width: 130%;
    height: 130%;
    background-size: cover;
    background-position: center;
    filter: blur(var(--blur-amount)) brightness(0.5) saturate(1.2);
    z-index: -1;
    transition: background-image 1.5s ease-in-out;
}

.content-wrapper {
    width: 500px;
    max-width: calc(100vw - 2rem);
    padding: 2rem;
    z-index: 1;
    position: relative;
}

.player-container,
.offline-container {
    background: var(--surface-color);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-radius: 28px;
    padding: 2rem 1.75rem;
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    opacity: 1;
    transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.hidden {
    opacity: 0 !important;
    transform: translateY(30px) scale(0.95);
    pointer-events: none;
    position: absolute;
    visibility: hidden;
    width: calc(100% - 4rem);
}

.hide-element {
    display: none !important;
}

.album-art-container {
    position: relative;
    width: 260px;
    height: 260px;
    margin-bottom: 2.5rem;
    border-radius: 16px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.7);
    overflow: hidden;
    background: #282828;
}

#album-art {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.album-art-container:hover #album-art {
    transform: scale(1.05);
}

.bars {
    position: absolute;
    bottom: 16px;
    right: 16px;
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 24px;
    background: rgba(0, 0, 0, 0.5);
    padding: 6px 8px;
    border-radius: 8px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.player-container.is-playing .bars {
    opacity: 1;
}

.bar {
    width: 4px;
    background-color: var(--accent-color);
    border-radius: 2px;
    animation: bounce 1s infinite alternate;
}

.bar:nth-child(1) {
    animation-delay: 0s;
    height: 40%;
}

.bar:nth-child(2) {
    animation-delay: 0.3s;
    height: 100%;
}

.bar:nth-child(3) {
    animation-delay: 0.6s;
    height: 60%;
}

@keyframes bounce {
    0% {
        height: 20%;
    }

    100% {
        height: 100%;
    }
}

.player-controls-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.track-info {
    width: 100%;
    margin-bottom: 2rem;
}

.track-title-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 0.5rem;
}

#track-name {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.01em;
}

.liked-icon {
    color: var(--accent-color);
    flex-shrink: 0;
}

.track-link {
    text-decoration: none;
    color: inherit;
    display: inline-block;
    min-width: 0;
    overflow: hidden;
}

.track-link:hover #track-name {
    text-decoration: underline;
    text-underline-offset: 4px;
}

#artist-name {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#album-name {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.4);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.progress-wrapper {
    width: 100%;
    padding: 0 0.5rem;
}

.progress-details {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    font-variant-numeric: tabular-nums;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background-color: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background-color: #fff;
    width: 0%;
    border-radius: 3px;
    transition: width 0.15s linear;
}

.controls {
    margin-top: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.like-btn {
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.like-btn.is-liked {
    color: var(--accent-color);
    background: rgba(29, 185, 84, 0.15);
}

.like-btn.is-liked:hover {
    background: rgba(29, 185, 84, 0.25);
}

@keyframes likedPop {
    0% {
        transform: scale(1);
    }

    40% {
        transform: scale(1.35);
    }

    70% {
        transform: scale(0.9);
    }

    100% {
        transform: scale(1);
    }
}

.like-btn.is-liked svg {
    animation: likedPop 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}


.control-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.control-btn:active {
    transform: scale(0.95);
}

.control-btn.is-loading {
    opacity: 0.5;
    pointer-events: none;
    animation: pulse 1s infinite alternate;
}

@keyframes pulse {
    0% {
        opacity: 1;
    }

    100% {
        opacity: 0.5;
    }
}

.last-played-banner {
    margin-top: 1.5rem;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    width: 100%;
}

.last-played-banner strong {
    color: var(--text-primary);
    margin-left: 4px;
    font-weight: 600;
}

.premium-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 0.5rem 1rem;
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s;
}

.premium-input:focus {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--accent-color);
}

.premium-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.premium-button {
    background: var(--accent-color);
    border: none;
    border-radius: 20px;
    padding: 0.5rem 1.25rem;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, filter 0.2s;
}

.premium-button:hover {
    transform: scale(1.05);
    filter: brightness(1.1);
}

.premium-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 8px;
    background: rgba(30, 30, 30, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    max-height: 250px;
    overflow-y: auto;
    list-style: none;
    z-index: 100;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    padding: 0.5rem 0;
}

.search-result-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: background 0.2s;
    text-align: left;
}

.search-result-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.search-result-img {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    margin-right: 12px;
    object-fit: cover;
    background: #282828;
}

.search-result-text {
    flex: 1;
    overflow: hidden;
}

.search-result-title {
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

.search-result-artist {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.offline-container {
    justify-content: center;
    padding: 5rem 2rem;
}

.spotify-icon {
    width: 72px;
    height: 72px;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    opacity: 0.4;
}

.offline-container p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Loading spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: var(--accent-color);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Small Screens (Portrait Phones) */
@media screen and (max-width: 480px) {
    .content-wrapper {
        padding: 0.5rem;
        width: 100%;
        max-width: 100%;
    }

    .player-container,
    .offline-container {
        padding: 1.5rem 1.25rem;
        border-radius: 24px;
    }

    .album-art-container {
        width: 220px;
        height: 220px;
    }

    #track-name {
        font-size: 1.75rem;
    }

    #artist-name {
        font-size: 1.1rem;
    }

    #album-name {
        font-size: 0.95rem;
    }

    .control-btn {
        width: 56px;
        height: 56px;
    }

    .progress-details {
        font-size: 0.85rem;
    }

    .last-played-banner {
        font-size: 1rem;
    }
}

/* Landscape Phone Layout */
@media screen and (max-height: 600px) and (orientation: landscape) {
    body {
        overflow: hidden;
        height: 100vh;
        align-items: center;
    }

    #background {
        position: fixed;
        width: 130vw;
        height: 130vh;
    }

    .content-wrapper {
        margin: auto;
        max-width: 700px;
        padding: 0.5rem;
        width: 100%;
    }

    .player-container {
        flex-direction: row;
        padding: 1.25rem 1.5rem;
        gap: 2rem;
        text-align: left;
        align-items: center;
        border-radius: 20px;
    }

    .album-art-container {
        width: 200px;
        height: 200px;
        margin-bottom: 0;
        flex-shrink: 0;
        box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
    }

    #track-name {
        font-size: 1.4rem;
    }

    #artist-name {
        font-size: 1rem;
    }

    #album-name {
        font-size: 0.9rem;
    }

    .control-btn {
        width: 54px;
        height: 54px;
    }

    .progress-details {
        font-size: 0.82rem;
    }

    .player-controls-wrapper {
        flex: 1;
        align-items: flex-start;
        min-width: 0;
    }

    .track-info {
        margin-bottom: 1rem;
    }

    .track-title-wrapper {
        justify-content: flex-start;
    }

    .controls {
        margin-top: 1rem;
        justify-content: flex-start;
    }

    #queue-container {
        margin-top: 0.75rem !important;
    }

    .last-played-banner {
        margin-top: 1rem;
        justify-content: flex-start;
    }

    .offline-container {
        flex-direction: row;
        padding: 1.5rem;
        gap: 1.5rem;
    }

    .spotify-icon {
        margin-bottom: 0;
        width: 60px;
        height: 60px;
    }

    #loading {
        flex-direction: column;
    }
}

/* Gesture ripple feedback */
.gesture-ripple {
    position: fixed;
    transform: translate(-50%, -50%) scale(0);
    width: 90px;
    height: 90px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 9999;
    animation: gestureRipple 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.gesture-ripple--like {
    background: rgba(29, 185, 84, 0.3);
    color: #1db954;
}

.gesture-ripple--skip {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

@keyframes gestureRipple {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 1;
    }

    60% {
        transform: translate(-50%, -50%) scale(1.1);
        opacity: 1;
    }

    100% {
        transform: translate(-50%, -50%) scale(1.4);
        opacity: 0;
    }
}