:root {
    --bg-dark: #0a0101;
    --card-bg: rgba(45, 10, 10, 0.7);
    --accent: #ff3333;
    --accent-gradient: linear-gradient(to right, #ff4c4c, #e60000);
    --text-primary: #ffffff;
    --text-secondary: #fca5a5;
}

* {
    box-sizing: border-box;
}

body {
    background: var(--bg-dark);
    color: var(--text-primary);
    font-family: sans-serif;
    margin: 0;
    padding-top: var(--header-offset, 150px);
    padding-bottom: 80px;
    min-height: 100vh;
    background-image: radial-gradient(circle at center, #2e0505 0%, #0a0101 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stale-sync-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20000;
}

.stale-sync-card {
    background: rgba(20, 5, 5, 0.98);
    border: 1px solid rgba(255, 90, 90, 0.6);
    border-radius: 14px;
    padding: 24px;
    width: 92%;
    max-width: 520px;
    color: #fff;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}

.stale-sync-card h3 {
    margin: 0 0 10px 0;
    color: var(--accent);
}

.stale-sync-card p {
    margin: 0 0 12px 0;
    color: var(--text-secondary);
}

.stale-sync-list {
    max-height: 180px;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    font-size: 0.95rem;
}

.stale-sync-list div {
    padding: 4px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.stale-sync-list div:last-child {
    border-bottom: none;
}

.stale-sync-actions {
    margin-top: 16px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.stale-sync-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}

.stale-sync-btn.danger {
    background: rgba(255, 60, 60, 0.2);
    border-color: rgba(255, 80, 80, 0.6);
}

/* Header & Nav */
header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 8px 12px;
    gap: 10px;
    background: rgba(10, 1, 1, 0.95);
    backdrop-filter: blur(15px);
    z-index: 1000;
    border-bottom: 1px solid rgba(255, 100, 100, 0.1);
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.6rem;
    padding: 0;
    width: auto;
    position: relative;
    flex: 0 0 auto;
}

.global-nav {
    display: flex;
    justify-content: flex-start;
    gap: 6px;
    padding: 0;
    width: auto;
    margin-left: 6px;
    flex: 0 0 auto;
}

.nav-btn {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid rgba(255, 100, 100, 0.2);
    padding: 6px 16px;
    border-radius: 20px;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.nav-btn:hover,
.nav-btn.active {
    background: rgba(255, 50, 50, 0.1);
    color: white;
    border-color: var(--accent);
}

.logo {
    width: 50px;
    height: 50px;
    object-fit: contain;
    background: white;
    padding: 3px;
    border-radius: 8px;
}

h1 {
    font-size: 1.8rem;
    margin: 0;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Sync Indicator Styles */
.header-sync-btn {
    margin-left: auto;
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    background: #ffffff;
    border: 2px solid white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    padding: 0;
    overflow: hidden;
}

.header-sync-btn svg {
    width: 26px;
    height: 26px;
}

.header-sync-btn:hover {
    filter: brightness(0.95);
    transform: scale(1.05);
}

/* Mobile Optimization */
@media screen and (max-width: 850px) {
    body {
        padding-top: var(--header-offset, 120px);
    }

    header {
        padding-right: 12px;
    }

    .header-top {
        position: static;
    }

    .nav-btn {
        padding: 4px 8px;
        font-size: 0.78rem;
    }

    h1 {
        font-size: 1.2rem !important;
    }

    .logo {
        width: 36px;
        height: 36px;
    }

    .header-sync-btn {
        margin-left: auto;
        width: 32px;
        height: 32px;
    }

    .header-sync-btn svg {
        width: 20px;
        height: 20px;
    }
}

/* Footer (Fixed, Non-collapsible) */
.footer-drawer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(10, 1, 1, 0.95);
    backdrop-filter: blur(15px);
    border-top: 1px solid rgba(255, 100, 100, 0.15);
    z-index: 2000;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.footer-drawer-toggle {
    display: none;
}

.footer-content {
    text-align: center;
    padding: 0.6rem 1rem;
}

.footer-content a {
    color: var(--accent) !important;
    text-decoration: none !important;
    margin-left: 10px;
    transition: 0.2s;
    cursor: pointer !important;
    display: inline-block;
}

.footer-content a:hover {
    color: white !important;
    text-decoration: underline !important;
}

/* Footer Panel Trigger Button */
.footer-panel-trigger {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 48px;
    height: 24px;
    background: rgba(20, 5, 5, 0.95);
    border: 1px solid rgba(255, 100, 100, 0.3);
    border-bottom: none;
    border-radius: 12px 12px 0 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
    z-index: 2001;
}

.footer-panel-trigger:hover {
    background: rgba(40, 10, 10, 0.98);
    border-color: var(--accent);
}

.footer-trigger-arrow {
    color: var(--text-secondary);
    font-size: 0.8rem;
    transition: 0.2s;
}

.footer-panel-trigger:hover .footer-trigger-arrow {
    color: var(--accent);
}

.footer-panel-trigger.active .footer-trigger-arrow {
    transform: rotate(180deg);
}

/* Footer Panel - Bottom Player Bar */
.footer-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: linear-gradient(to top, rgba(10, 1, 1, 0.8), rgba(18, 4, 4, 0.7));
    border-top: 1px solid rgba(255, 100, 100, 0.2);
    z-index: 2500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
    gap: 16px;
    backdrop-filter: blur(20px);
    transform: translateY(0);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.footer-panel.collapsed {
    transform: translateY(100%);
    opacity: 0;
    pointer-events: none;
}

.footer-panel-toggle {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 28px;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.footer-panel-toggle::before {
    content: '';
    width: 10px;
    height: 10px;
    border-left: 2px solid rgba(255, 255, 255, 0.6);
    border-bottom: 2px solid rgba(255, 255, 255, 0.6);
    transform: rotate(-45deg);
    transition: 0.2s;
}

.footer-panel.collapsed .footer-panel-toggle::before {
    transform: rotate(135deg);
}

.footer-panel-toggle:hover::before {
    border-color: var(--accent);
}

.footer-panel-content {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    max-width: 1200px;
    padding-top: 0;
}

.footer-panel.collapsed .footer-panel-content {
    opacity: 0;
    pointer-events: none;
}

.fp-artwork {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    background-size: cover;
    background-position: center;
    background-color: rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
}

.fp-artwork:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(255, 50, 50, 0.3);
}

.fp-artwork-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 8px;
    color: #fff;
    font-size: 1.2rem;
    opacity: 0;
    transition: 0.2s;
}

.fp-artwork:hover .fp-artwork-overlay {
    opacity: 1;
}

.fp-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.fp-title {
    color: #fff;
    font-size: 0.95rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

.fp-title:hover {
    color: var(--accent);
}

.fp-subtitle {
    color: var(--text-secondary);
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    position: relative;
    height: 1.2rem;
    width: 100%;
}

.fp-subtitle-inner {
    display: inline-block;
    white-space: nowrap;
    position: absolute;
    left: 0;
    top: 0;
    animation: none;
    will-change: transform;
}

.footer-panel.is-playing .fp-subtitle-inner {
    animation: fpMarquee 80s linear infinite;
}

@keyframes fpMarquee {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-50%);
    }
}

/* Card play button state synchronization - global classes */
.is-playing .btn-play,
.btn-play.is-playing {
    background: rgba(255, 70, 70, 0.8) !important;
    color: #fff !important;
    box-shadow: 0 0 16px rgba(255, 70, 70, 0.65) !important;
    animation: playGlow 1.4s ease-in-out infinite !important;
}

.is-playing .btn-play .icon-play,
.btn-play.is-playing .icon-play {
    display: none !important;
}

.is-playing .btn-play .icon-pause,
.btn-play.is-playing .icon-pause {
    display: flex !important;
    align-items: center;
    justify-content: center;
    fill: white !important;
}

.is-playing .btn-play .icon-pause svg,
.btn-play.is-playing .icon-pause svg {
    width: 18px;
    height: 18px;
}

.fp-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.fp-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    transition: 0.2s;
}

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

/* Play Button - Default (Paused) -> Neutral Glassy */
#fpPlayBtn {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.15);
    font-size: 1.2rem;
    color: #fff;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

#fpPlayBtn:hover {
    background: rgba(255, 255, 255, 0.25);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
    transform: scale(1.05);
    border-color: rgba(255, 255, 255, 0.4);
}

/* Play Button - Playing -> Red Theme (Matches Song Card Active State) */
.footer-panel.is-playing #fpPlayBtn {
    background: rgba(255, 70, 70, 0.8);
    color: #fff;
    box-shadow: 0 0 16px rgba(255, 70, 70, 0.65);
    animation: playGlow 1.4s ease-in-out infinite;
    border-color: rgba(255, 200, 200, 0.3);
}

.footer-panel.is-playing #fpPlayBtn:hover {
    background: rgba(255, 70, 70, 1);
}

@keyframes playGlow {
    0% {
        box-shadow: 0 0 8px rgba(255, 70, 70, 0.4);
    }

    50% {
        box-shadow: 0 0 20px rgba(255, 70, 70, 0.7);
    }

    100% {
        box-shadow: 0 0 8px rgba(255, 70, 70, 0.4);
    }
}

/* Play Button Icons Toggle */
#fpPlayBtn .icon-play {
    display: block;
}

#fpPlayBtn .icon-pause {
    display: none;
}

.footer-panel.is-playing #fpPlayBtn .icon-play {
    display: none;
}

.footer-panel.is-playing #fpPlayBtn .icon-pause {
    display: block;
}

.fp-expand-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: transparent;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.2s;
    margin-left: auto;
}

.fp-expand-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-color: var(--accent);
}

.fp-progress-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.1);
}

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

/* Footer Panel hidden state */
.footer-panel[data-hidden="true"] {
    display: none;
}

/* Adjust body padding when footer panel is visible */
body:has(.footer-panel:not(.collapsed)) {
    padding-bottom: 120px;
}

/* Mobile responsive */
@media screen and (max-width: 600px) {
    .footer-panel {
        height: 100px;
        padding: 0 12px;
        gap: 10px;
    }

    .fp-artwork {
        width: 76px;
        height: 76px;
    }

    .fp-btn {
        width: 36px;
        height: 36px;
    }

    .fp-btn.fp-play {
        width: 42px;
        height: 42px;
    }
}

.sim-edit-panel {
    display: none;
    gap: 8px;
    margin-top: 8px;
}

.sim-edit-panel input {
    width: 100%;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(0, 0, 0, 0.35);
    color: #fff;
    font-size: 0.9rem;
    box-sizing: border-box;
}