:root {
    --bg-color: #F8F4F0; 
    --text-main: #4A3B32; 
    --text-muted: #96847A; 
    --accent: #E2D9D3; 
    --card-bg: #ffffffb3;
    --hover-bg: #F0EBE6;
    --shadow: rgba(74, 59, 50, 0.06);
    --progress-bg: #E2D9D3;
}

.dark-theme {
    --bg-color: #1A1614; 
    --text-main: #E8E2DD; 
    --text-muted: #A69B95; 
    --accent: #3B322D; 
    --card-bg: #241F1C;
    --hover-bg: #2F2925;
    --shadow: rgba(0, 0, 0, 0.3);
    --progress-bg: #3B322D;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

body {
    font-family: 'Lato', sans-serif;
    font-weight: 400;
    line-height: 1.6;
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

h1, h2, h3 {
    font-family: 'Playfair Display', serif;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.top-nav {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    z-index: 100;
}

.mobile-logo { display: none; }

.icon-btn {
    background: var(--card-bg);
    color: var(--text-main);
    border: 1px solid var(--accent);
    border-radius: 50%;
    width: 45px;
    height: 45px;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: 0 4px 10px var(--shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.icon-btn:hover { background: var(--hover-bg); transform: scale(1.05); }

.container {
    display: flex;
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: 0 20px 40px var(--shadow);
    width: 900px;
    max-width: 95%;
    overflow: hidden;
}

.player-section {
    flex: 1;
    padding: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    border-right: 1px solid var(--accent);
    position: relative;
}

.desktop-logo { font-size: 2rem; margin-bottom: 30px; }

.record-player {
    width: 220px;
    height: 220px;
    background: #1a1a1a;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 10px 20px rgba(0,0,0,0.4);
    margin-bottom: 30px;
}

.record {
    width: 200px;
    height: 200px;
    background: linear-gradient(135deg, #111 25%, #2a2a2a 50%, #111 75%);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 2px solid #333;
}

.record.playing { animation: spin 4s linear infinite; }
@keyframes spin { 100% { transform: rotate(360deg); } }

.record-label {
    width: 70px;
    height: 70px;
    background: var(--text-muted);
    border-radius: 50%;
    border: 4px solid #111;
}

.track-info { text-align: center; margin-bottom: 25px; width: 100%; }
.track-info h2 { font-size: 1.4rem; margin-bottom: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-info p { color: var(--text-muted); font-size: 0.95rem; font-weight: 300; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;}

.controls { display: flex; align-items: center; gap: 20px; }
.controls button {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-main);
    cursor: pointer;
}
.controls button:hover { transform: scale(1.1); color: var(--text-muted); }
.controls .main-play-btn { font-size: 2rem; }

.secondary-btn { font-size: 1.1rem !important; opacity: 0.5; }
.secondary-btn.active { opacity: 1; color: var(--text-main); }
.repeat-one-indicator { position: absolute; font-size: 0.6rem; font-family: sans-serif; font-weight: bold; margin-left: -5px; margin-top: 5px; }

.progress-container {
    width: 100%;
    height: 4px;
    background: var(--progress-bg);
    margin-top: 25px;
    border-radius: 2px;
    cursor: pointer;
}
.progress { height: 100%; background: var(--text-main); width: 0%; border-radius: 2px; transition: width 0.1s linear; }

.volume-container { display: flex; align-items: center; justify-content: center; width: 100%; margin-top: 20px; gap: 12px; }
.volume-icon { font-size: 0.8rem; color: var(--text-muted); }
#volume-slider { flex: 1; max-width: 120px; accent-color: var(--text-main); height: 4px; cursor: pointer; }

.playlist-section { flex: 1; padding: 40px; background: var(--hover-bg);padding-top:30px; }
.playlist-section h3 { margin-bottom: 20px; font-style: italic; color: var(--text-muted); font-weight: 400; }

.filter-container { display: flex; gap: 8px; margin-bottom: 15px; flex-wrap: wrap; }
.filter-chip {
    padding: 6px 14px;
    border-radius: 20px;
    background: var(--accent);
    color: var(--text-main);
    border: none;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
}
.filter-chip:hover { background: var(--text-muted); color: var(--card-bg); }
.filter-chip.active { background: var(--text-main); color: var(--card-bg); }

.playlist { list-style: none; max-height: 400px; overflow-y: auto; padding-bottom: 20px; }
.playlist::-webkit-scrollbar { width: 6px; }
.playlist::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 3px; }

.playlist li {
    padding: 12px 15px;
    border-bottom: 1px solid var(--accent);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.playlist li:hover { background: var(--card-bg); }
.playlist li.active { border-left: 4px solid var(--text-main); background: var(--card-bg); }

.track-left strong { font-weight: 500; display: block; }
.artist-sub { font-size: 0.85rem; color: var(--text-muted); margin-top: 2px; display: block; font-weight: 300; }
.track-tags { margin-top: 6px; display: flex; gap: 5px; }
.tiny-tag { font-size: 0.65rem; background: var(--accent); padding: 2px 6px; border-radius: 4px; color: var(--text-main); }

/* Updated layout container for tracking elements */
.track-right { display: flex; align-items: center; font-size: 0.85rem; color: var(--text-muted); font-family: monospace; }

/* Subtle Inline Download Icon */
.download-btn-inline {
    background: none;
    border: none;
    color: var(--text-muted);
    opacity: 0.35;
    cursor: pointer;
    margin-left: 12px;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}
.download-btn-inline:hover { opacity: 1; color: var(--text-main); transform: translateY(0.5px); }

.admin-container { max-width: 95%; width: 950px; }
.admin-card { background: var(--card-bg); padding: 40px; width: 400px; border-right: 1px solid var(--accent); }
.input-group { margin-top: 15px; text-align: left; }
.input-group label { display: block; font-size: 0.9rem; margin-bottom: 6px; color: var(--text-muted); }
.input-group input[type="text"], .input-group input[type="password"], .input-group input[type="file"] {
    width: 100%; padding: 10px; border: 1px solid var(--accent); border-radius: 6px; font-family: inherit;
    background: var(--bg-color); color: var(--text-main);
}
.checkbox-group { display: flex; gap: 15px; margin-top: 5px; }
.checkbox-group label { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; cursor: pointer; color: var(--text-main); }
.upload-btn {
    width: 100%; padding: 12px; background: var(--text-main); color: var(--card-bg);
    border: none; border-radius: 6px; margin-top: 25px; cursor: pointer;
    font-family: 'Playfair Display', serif; font-size: 1.1rem;
}
.upload-btn:hover { opacity: 0.9; }
.delete-btn { background: transparent; color: #d9534f; border: 1px solid #d9534f; padding: 6px 12px; border-radius: 4px; cursor: pointer; font-size: 0.8rem; }
.delete-btn:hover { background: #d9534f; color: white; }

@media (max-width: 768px) {
    body {
        align-items: flex-start;
        padding-top: 70px;
        padding-bottom: 95px; /* Added slight cushion for layout spacing */
        display: block;
    }

    .top-nav {
        position: fixed;
        top: 0; left: 0; right: 0;
        background: var(--card-bg);
        padding: 12px 20px;
        box-shadow: 0 2px 10px var(--shadow);
        justify-content: space-between;
        border-bottom: 1px solid var(--accent);
    }
    
    .mobile-logo { display: block; font-size: 1.5rem; margin: 0; }
    .desktop-logo { display: none; }
    .icon-btn { width: 38px; height: 38px; font-size: 1rem; box-shadow: none; border: none; background: var(--bg-color); }

    .container {
        flex-direction: column;
        width: 100%;
        border-radius: 0;
        box-shadow: none;
        background: transparent;
    }

    .playlist-section, .admin-card {
        width: 100%;
        padding: 40px 15px;
        background: transparent;
        border-right: none;
    }
    .playlist { max-height: none; overflow: visible; }

    .player-section {
        position: fixed;
        bottom: 0; left: 0; right: 0;
        height: 85px;
        padding: 0 15px;
        background: var(--card-bg);
        border-top: 1px solid var(--accent);
        border-right: none;
        box-shadow: 0 -4px 15px var(--shadow);
        flex-direction: row;
        justify-content: space-between;
        z-index: 1000;
    }

    .progress-container {
        position: absolute;
        top: 0px;
        left: 0;
        width: 100%;
        margin: 0;
        height: 3px;
        border-radius: 0;
        background: var(--progress-bg);
    }
    .progress { border-radius: 0; }

    .record-player {
        width: 48px;
        height: 48px;
        margin: 0;
        box-shadow: 0 2px 6px rgba(0,0,0,0.4);
        flex-shrink: 0;
    }
    .record { width: 44px; height: 44px; border-width: 1px; }
    .record-label { width: 16px; height: 16px; border-width: 2px; }

    .track-info {
        flex: 1;
        margin: 0 10px; /* Swept in slightly for button clearance */
        text-align: left;
    }
    .track-info h2 { font-size: 0.90rem; }
    .track-info p { font-size: 0.75rem; }

    /* Reworked controls interface to cleanly stack all 5 items on mobile layout */
    .controls { gap: 12px; margin-right: 4px; }
    .controls button { font-size: 1rem; }
    .controls .main-play-btn { font-size: 1.35rem; }
    
    /* Enabled Shuffle and Repeat to render properly on mobile screens */
    .secondary-btn { display: inline-block !important; font-size: 0.9rem !important; }
    .repeat-one-indicator { margin-left: -3px; margin-top: 3px; font-size: 0.55rem; }
    
    .volume-container { display: none; }
}

/* Subtle Footer Signature */
.app-footer {
    text-align: center;
    margin-top: 40px;
    font-size: 0.75rem;
    color: var(--text-muted);
    opacity: 0.5;
    font-weight: 300;
    letter-spacing: 0.5px;
}

.app-footer a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px dashed transparent;
}

.app-footer a:hover {
    color: var(--text-main);
    border-bottom-color: var(--text-main);
}

.app-footer .footer-heart {
    color: #e28787;
    margin: 0 2px;
}

.app-footer .fa-cat {
    margin-left: 2px;
}

@media (max-width: 768px) {
    .app-footer {
        margin-top: 30px;
        margin-bottom: 20px;
    }
}