/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #796753;
    --primary-dark: #796753;
    --bg-dark: #121212;
    --bg-card: #181818;
    --bg-hover: #282828;
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --border: #282828;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-weight: 400;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body::-webkit-scrollbar {
    width: 8px;
}

body::-webkit-scrollbar-track {
    background: transparent;
}

body::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

body::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* Login Screen */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background-color: #000000;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.login-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('/static/covers/loginback.jpg');
    background-size: cover;
    background-position: center;
    opacity: 0.2;
    z-index: 0;
}

.login-box {
    background-image: url('/static/covers/loginback.jpg');
    background-size: cover;
    background-position: center;
    padding: 3rem;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 400px;
    position: relative;
    z-index: 1;
}

.login-title {
    font-family: 'Caveat', cursive;
    color: white;
    text-align: center;
    margin-bottom: 2rem;
    font-size: 2.5rem;
    font-weight: 400;
}

.login-box input {
    width: 100%;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.login-box input:focus {
    outline: none;
    border-color: #000000;
}

.login-box button {
    width: 100%;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.login-box button:hover {
    background: rgba(0, 0, 0, 0.8);
}

.error-message {
    color: #e74c3c;
    text-align: center;
    margin-top: 1rem;
    font-size: 0.9rem;
}

/* Player Container */
.player-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    height: 100dvh;
    display: flex;
    flex-direction: column;
}

.background-image {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    filter: blur(5px);
    transform: scale(1.1);
    transition: background-image 0.5s ease;
    z-index: -2;
}

.background-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: -1;
}

/* Floating Logout Button */
.logout-btn-floating {
    position: fixed;
    top: 1.5rem;
    right: 2rem;
    padding: 0.4rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
    z-index: 100;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.logout-btn-floating:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 3rem 2rem 140px 2rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow-x: hidden;
}

/* Remove scrollbar when playlist view is active */
.main-content:has(#playlist-view:not([style*="display: none"])) {
    overflow-y: hidden;
}

.main-content::-webkit-scrollbar {
    width: 8px;
}

.main-content::-webkit-scrollbar-track {
    background: transparent;
}

.main-content::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

.main-content::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

.album-art-section {
    text-align: center;
    margin-bottom: 1.5rem;
    flex-shrink: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.album-art {
    width: 500px;
    height: 500px;
    max-width: 90vw;
    max-height: 35dvh;
    margin: 0 auto 2rem;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
    transition: transform 0.3s;
}

/* Make album cover flexible on playlist page */
#album-cover.album-art {
    width: min(500px, 90vw, 35dvh);
    height: min(500px, 90vw, 35dvh);
    aspect-ratio: 1 / 1;
    object-fit: contain;
}

/* Make song-specific album art flexible and maintain square aspect ratio */
#album-art.album-art {
    width: min(500px, 90vw, 35dvh);
    height: min(500px, 90vw, 35dvh);
    aspect-ratio: 1 / 1;
    object-fit: contain;
}

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

.album-art img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.song-info h2 {
    font-family: 'Caveat', cursive;
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.song-subtitle {
    font-size: 0.6rem;
    font-weight: 400;
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 0;
    white-space: pre-line;
    line-height: 1.4;
}

.song-info p {
    color: var(--text-secondary);
    font-size: 0.7rem;
}

/* Content Container */
.content-container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 0;
}

.playlist-section-single,
.lyrics-section-single {

    border-radius: 10px;
    padding: 1.0rem;
    display: flex;
    flex-direction: column;
    width: 500px;
    max-width: 90vw;
}

.playlist-section-single {
    flex: 0 0 auto;
    min-height: 0;
}

.album-title {
    font-family: 'Caveat', cursive;
    font-size: 2rem;
    font-weight: 400;
    text-align: center;
    margin-bottom: 1rem;
    color: white;
}

.copyright {
    font-size: 0.8rem;
    font-weight: 400;
    text-align: center;
    margin-top: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
}

.lyrics-section-single {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.lyrics-section-single::-webkit-scrollbar {
    width: 8px;
}

.lyrics-section-single::-webkit-scrollbar-track {
    background: transparent;
}

.lyrics-section-single::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

.lyrics-section-single::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

.lyrics-section-single h3 {
    margin-bottom: 1rem;
    font-size: 1.3rem;
    font-weight: 600;
    text-align: center;
}

.back-arrow-btn {
    position: fixed;
    top: 1.5rem;
    left: 2rem;
    padding: 0.4rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.back-arrow-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* Playlist */
.playlist {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    overflow-y: auto;
    flex: 0 1 auto;
    max-height: fit-content;
}

.song-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
}

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

.song-item-number {
    width: 30px;
    color: var(--text-secondary);
    font-weight: 600;
}

.song-item-info {
    flex: 1;
}

.song-item-title {
    font-weight: 600;
    margin-bottom: 0.2rem;
    font-size: 0.95rem;
}

.song-item-artist {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.song-item-duration {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Preface Popup */
.preface-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
}

.preface-content {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 0.3rem;
    max-width: 100%;
    max-height: 100%;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.preface-title {
    font-family: 'Caveat', cursive;
    font-size: 3rem;
    font-weight: 500;
    text-align: center;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.preface-text {
    flex: 1;
    overflow-y: auto;
    line-height: 1.5;
    white-space: pre-line;
    font-size: 1rem;
    font-weight: 300;
    padding: 0 1rem 1rem 1rem;
    color: var(--text-primary);
}

#preface-text-content {
    margin: 0;
    padding: 0;
}

.preface-text::-webkit-scrollbar {
    width: 8px;
}

.preface-text::-webkit-scrollbar-track {
    background: transparent;
}

.preface-text::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

.preface-text::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

.preface-close-btn {
    display: block;
    margin: 2rem auto 0 auto;
    padding: 0.6rem 1.5rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.preface-close-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

/* Lyrics */
.lyrics {
    overflow-y: auto;
    line-height: 1.8;
    white-space: pre-wrap;
    font-size: 1rem;
    font-weight: 300;
    padding: 1rem;
    flex: 1;
    min-height: 0;
}

.lyrics-placeholder {
    color: var(--text-secondary);
    text-align: center;
    padding: 2rem;
}

/* Player Controls */
.player-controls {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(24, 24, 24, 0.95);
    backdrop-filter: blur(20px);
    padding: 0.5rem 2rem 0.75rem 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
}

.mini-player-song-title {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    font-weight: 300;
}

.player-controls-row {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    width: 100%;
}

.progress-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.progress-container span {
    font-size: 0.75rem;
    color: var(--text-secondary);
    min-width: 35px;
    flex-shrink: 0;
}

.progress-bar {
    flex: 1;
    position: relative;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    min-width: 0;
}

.progress {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.1s linear;
}

#progress-slider {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 6px;
    transform: translateY(-50%);
    opacity: 0;
    cursor: pointer;
}

#progress-slider::-webkit-slider-thumb {
    width: 14px;
    height: 14px;
}

.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.control-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0.35rem;
    border-radius: 50%;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.play-btn {
    background: var(--primary);
    width: 40px;
    height: 40px;
}

.play-btn #play-icon {
    margin-left: 3px;
}

.play-btn #pause-icon {
    margin-left: 0;
}

.play-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.1);
}

.volume-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.volume-container svg {
    color: var(--text-secondary);
    width: 18px;
    height: 18px;
}

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

#volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: white;
    border-radius: 50%;
    cursor: pointer;
}

#volume-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: white;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* Landscape Warning for Mobile */
.landscape-warning {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.landscape-warning-content {
    text-align: center;
    padding: 2rem;
    color: white;
}

.landscape-warning-content svg {
    margin-bottom: 1.5rem;
    opacity: 0.8;
}

.landscape-warning-content h2 {
    font-family: 'Caveat', cursive;
    font-size: 2rem;
    margin-bottom: 0.5rem;
    font-weight: 400;
}

.landscape-warning-content p {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.7);
}

/* Show landscape warning only on mobile phones in landscape mode */
@media (max-width: 926px) and (orientation: landscape) and (max-height: 430px) {
    .landscape-warning {
        display: flex !important;
    }
}

/* Alternative for older iPhones */
@media (max-width: 896px) and (orientation: landscape) and (max-height: 414px) {
    .landscape-warning {
        display: flex !important;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .content-container {
        max-width: 100%;
    }

    .lyrics-header {
        justify-content: flex-start;
    }

    .album-art {
        width: 350px;
        height: 350px;
    }

    .song-info h2 {
        font-size: 2rem;
    }

    .logout-btn-floating {
        top: 1rem;
        right: 1rem;
        padding: 0.35rem;
    }

    .back-arrow-btn {
        top: 1rem;
        left: 1rem;
        padding: 0.35rem;
    }

    .main-content {
        padding: 2rem 1rem 100px 1rem;
    }

    .player-controls {
        padding: 0.5rem 1rem;
    }

    .volume-container {
        display: none;
    }

    .controls {
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .album-art {
        width: 280px;
        height: 280px;
    }

    .song-info h2 {
        font-size: 1.5rem;
    }

    .song-info p {
        font-size: 0.6rem;
    }

    .login-box {
        padding: 2rem;
    }
}