* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: #121212;
    color: #ffffff;
    margin: 0;
    padding: 0;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.app {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    overflow: hidden;
    min-height: 0;
}

/* ============================================
   HEADER
   ============================================ */
header {
    padding: 10px 16px;
    border-bottom: 2px solid #4CAF50;
    background: #1f1f1f;
    flex-shrink: 0;
}

header h1 {
    margin: 0;
    font-size: clamp(18px, 3vw, 24px);
    color: #4CAF50;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-align: center;
}

/* ============================================
   NOW PLAYING + SPECTRUM
   ============================================ */
#info {
    background: #1a1a1a;
    padding: 12px 16px 8px 16px;
    flex-shrink: 0;
    display: flex;
    gap: 12px;
    align-items: center;
}

.info-text {
    flex: 1;
    min-width: 0;
}

#modTitle {
    font-size: clamp(15px, 2.5vw, 20px);
    font-weight: 700;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#nowPlaying {
    font-size: 13px;
    color: #aaaaaa;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#status {
    margin-top: 4px;
    font-size: 12px;
    color: #888888;
}

/* ============================================
   SPECTRUM CANVAS
   ============================================ */
#spectrumCanvas {
    width: 160px;
    height: 60px;
    flex-shrink: 0;
    background: #0d0d0d;
    border-radius: 6px;
    border: 1px solid #333;
    display: block;
}

/* ============================================
   PROGRESS BAR
   ============================================ */
.progress-container {
    padding: 8px 16px 0 16px;
    background: #1a1a1a;
    flex-shrink: 0;
}

#progressBar {
    width: 100%;
    height: 36px;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    cursor: pointer;
}

#progressBar::-webkit-slider-runnable-track {
    height: 6px;
    background: #333;
    border-radius: 3px;
}

#progressBar::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #4CAF50;
    margin-top: -7px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

#progressBar::-moz-range-track {
    height: 6px;
    background: #333;
    border-radius: 3px;
}

#progressBar::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #4CAF50;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

#progressTime {
    font-size: 12px;
    color: #888;
    text-align: right;
    display: block;
    padding: 2px 0 8px 0;
}

/* ============================================
   LAYOUT
   ============================================ */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 8px;
    gap: 8px;
    overflow: hidden;
    min-height: 0;
}

/* ============================================
   CONTROLS
   ============================================ */
#controls {
    background: #1a1a1a;
    border-radius: 8px;
    border: 1px solid #333;
    padding: 12px 12px 10px 12px;
    flex-shrink: 0;
}

.controls-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

button {
    border: none;
    border-radius: 999px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.08s, background 0.15s;
    touch-action: manipulation;
}

button:active { transform: scale(0.95); }

button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

#playBtn, #pauseBtn {
    width: 64px;
    height: 64px;
    background: #4CAF50;
    color: #ffffff;
    font-size: 26px;
    box-shadow: 0 3px 9px rgba(76, 175, 80, 0.4);
}

#prevBtn, #nextBtn {
    width: 52px;
    height: 52px;
    background: #333333;
    color: #dddddd;
    font-size: 22px;
}

/* ============================================
   VOLUME
   ============================================ */
.volume-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.icon {
    font-size: 18px;
}

#muteBtn {
    background: none;
    border: none;
    border-radius: 4px;
    font-size: 20px;
    cursor: pointer;
    padding: 4px 6px;
    line-height: 1;
    color: #dddddd;
    transition: transform 0.08s, color 0.15s;
    touch-action: manipulation;
    flex-shrink: 0;
}

#muteBtn:active {
    transform: scale(0.9);
}

body.is-muted #muteBtn {
    color: #e57373;
}

body.is-muted #volumeSlider {
    opacity: 0.4;
}

#volumeSlider {
    flex: 1;
    height: 32px;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    transition: opacity 0.2s;
}

#volumeSlider::-webkit-slider-runnable-track {
    height: 6px;
    background: #333;
    border-radius: 3px;
}

#volumeSlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #4CAF50;
    margin-top: -8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

#volumeSlider::-moz-range-track {
    height: 6px;
    background: #333;
    border-radius: 3px;
}

#volumeSlider::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #4CAF50;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

/* ============================================
   PLAYLIST
   ============================================ */
#playlist-container {
    flex: 1;
    background: #121212;
    border-radius: 8px;
    border: 1px solid #333;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

#playlist-header {
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
    color: #bbbbbb;
    border-bottom: 1px solid #222;
    flex-shrink: 0;
}

#playlist {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

#playlist::-webkit-scrollbar        { width: 4px; }
#playlist::-webkit-scrollbar-track  { background: transparent; }
#playlist::-webkit-scrollbar-thumb  { background: #333; border-radius: 2px; }
#playlist::-webkit-scrollbar-thumb:hover { background: #555; }

.mod-item {
    padding: 10px 12px;
    border-bottom: 1px solid #1f1f1f;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.mod-item:last-child { border-bottom: none; }
.mod-item:active     { background: #242424; }

.mod-item.playing {
    background: #1c381f;
    border-left: 4px solid #4CAF50;
}

.mod-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.mod-name {
    font-size: 14px;
    color: #dddddd;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mod-item.playing .mod-name {
    color: #4CAF50;
    font-weight: 600;
}

.mod-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.mod-title-tag {
    font-size: 12px;
    color: #888888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.mod-item.playing .mod-title-tag {
    color: #81c784;
}

.mod-dur {
    font-size: 11px;
    color: #666666;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ============================================
   FOOTER
   ============================================ */
footer {
    flex-shrink: 0;
    font-size: 11px;
    color: #555;
    text-align: center;
    padding: 4px;
    background: #000;
}

/* ============================================
   PLAY/PAUSE TOGGLE
   ============================================ */
#pauseBtn { display: none; }
body.is-playing #playBtn  { display: none; }
body.is-playing #pauseBtn { display: inline-flex; }

/* ============================================
   RESPONSIVE - DESKTOP
   ============================================ */
@media (min-width: 900px) {
    .main {
        flex-direction: row;
        align-items: stretch;
    }

    #controls {
        flex: 0 0 320px;
        align-self: flex-start;
        position: sticky;
        top: 0;
    }

    #playlist-container {
        flex: 1;
    }

    #spectrumCanvas {
        width: 200px;
        height: 64px;
    }
}

@media (max-width: 480px) {
    #spectrumCanvas {
        width: 110px;
        height: 50px;
    }
}

#shuffleBtn {
    width: 44px;
    height: 44px;
    background: #333333;
    color: #dddddd;
    font-size: 18px;
}

body.is-shuffle #shuffleBtn {
    background: #1c381f;
    color: #4CAF50;
    box-shadow: 0 0 0 2px #4CAF50;
}

/* ============================================
   RATING
   ============================================ */
   .rating-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.rating-label {
    font-size: 12px;
    color: #aaa;
    flex-shrink: 0;
}

#ratingStars {
    display: flex;
    gap: 2px;
}

#ratingStars .star {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    border: none;
    background: transparent;
    color: #444;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: transform 0.08s, color 0.15s;
}

#ratingStars .star:hover,
#ratingStars .star:hover ~ .star {
    transform: scale(1.15);
}

#ratingStars .star.active {
    color: #FFD54F;
}

#ratingStars .star.inactive {
    color: #444;
}

/* Sterne in der Playlist */
.mod-rating {
    font-size: 10px;
    color: #FFD54F;
    letter-spacing: -1px;
    flex-shrink: 0;
}

/* ============================================
   PLAYLIST FILTER
   ============================================ */
   #playlist-filter {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #161616;
    border-bottom: 1px solid #2a2a2a;
    flex-shrink: 0;
}

#filterText {
    flex: 1;
    background: #222;
    border: 1px solid #333;
    border-radius: 6px;
    color: #ddd;
    font-size: 13px;
    padding: 6px 10px;
    outline: none;
    font-family: inherit;
    min-width: 0;
}

#filterText:focus {
    border-color: #4CAF50;
}

#filterText::placeholder {
    color: #555;
}

#filterRating {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
}

.filter-star {
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 11px;
    color: #666;
    cursor: pointer;
    transition: background 0.1s, color 0.1s;
    white-space: nowrap;
    user-select: none;
}

.filter-star:hover {
    background: #2a2a2a;
    color: #FFD54F;
}

.filter-star.active {
    background: #2a2a2a;
    color: #FFD54F;
}

.mod-size {
    font-size: 11px;
    color: #555;
    white-space: nowrap;
    flex-shrink: 0;
}

.mod-name-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    min-width: 0;
}

.mod-name-row .mod-name {
    flex: 1;
    min-width: 0;
}

.mod-name-row .mod-size {
    flex-shrink: 0;
}

#filterTextWrapper {
    flex: 1;
    position: relative;
    min-width: 0;
}

#filterTextWrapper #filterText {
    width: 100%;
    padding-right: 28px; /* Platz für X */
}

#filterClearBtn {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    border-radius: 4px;
    color: #555;
    font-size: 12px;
    cursor: pointer;
    padding: 2px 4px;
    line-height: 1;
    display: none; /* nur sichtbar wenn Text vorhanden */
}

#filterClearBtn:hover {
    color: #e57373;
}

body.filter-active #filterClearBtn {
    display: flex;
}
