/* Winamp 2.x Classic Style - Base CSS */

/* Container for pixel-perfect rendering */
.winamp-container {
    font-family: 'Arial', sans-serif;
    font-size: 8px;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    -webkit-font-smoothing: none;
    -moz-osx-font-smoothing: unset;
    user-select: none;
}

/* Scale wrapper for modern screens */
/* Uses transform scale which doesn't affect layout, so we need margin-bottom to reserve space */
.winamp-scale-wrapper {
    transform: scale(2);
    transform-origin: top center;
    width: 275px;
    margin: 0 auto;
    /* Reserve space: content height * (scale - 1) = ~116px * 1 = 116px for main window only */
    /* When EQ is shown: (116 + 116) * 1 = 232px */
    /* When playlist is shown it will naturally extend */
    margin-bottom: 116px; /* Base margin for main window at 2x */
}

@media (max-width: 768px) {
    .winamp-scale-wrapper {
        transform: scale(1.5);
        margin-bottom: 58px; /* 116 * 0.5 */
    }
}

@media (max-width: 500px) {
    .winamp-scale-wrapper {
        transform: scale(1.2);
        margin-bottom: 23px; /* 116 * 0.2 */
    }
}

/* ==========================================
   MAIN WINDOW
   ========================================== */

.winamp-main-window {
    width: 275px;
    height: 116px;
    background-color: #232323;
    border: 1px solid #000;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Title bar */
.winamp-titlebar {
    height: 14px;
    background: linear-gradient(180deg, #3a5779 0%, #1a3050 50%, #0a1830 100%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 3px;
    cursor: default;
}

.winamp-titlebar.inactive {
    background: linear-gradient(180deg, #4a4a4a 0%, #2a2a2a 50%, #1a1a1a 100%);
}

.winamp-titlebar-left {
    display: flex;
    align-items: center;
    gap: 2px;
}

.winamp-titlebar-text {
    color: #fff;
    font-size: 8px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-shadow: 1px 1px 0 #000;
    overflow: hidden;
    white-space: nowrap;
    max-width: 200px;
}

.winamp-titlebar-buttons {
    display: flex;
    gap: 1px;
}

.winamp-titlebar-btn {
    width: 9px;
    height: 9px;
    border: none;
    cursor: pointer;
    background-color: #3a3a3a;
    font-size: 6px;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.winamp-titlebar-btn:hover {
    background-color: #5a5a5a;
}

.winamp-titlebar-btn:active {
    background-color: #2a2a2a;
}

/* Display area (time, bitrate, etc) */
.winamp-display {
    height: 42px;
    background-color: #000;
    margin: 2px 7px;
    display: flex;
    position: relative;
    border: 1px solid #1a1a1a;
    overflow: hidden;
    max-width: calc(275px - 14px); /* Account for margins */
}

.winamp-display-left {
    width: 63px;
    display: flex;
    flex-direction: column;
    padding: 2px;
}

.winamp-display-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 2px;
    overflow: hidden;
    max-width: calc(275px - 63px - 14px); /* Total width - left section - margins */
}

/* LED Time display */
.winamp-time {
    display: flex;
    align-items: center;
    height: 20px;
    gap: 2px;
}

.winamp-time-digit {
    width: 9px;
    height: 13px;
    background-color: #000;
    color: #00ff00;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    text-shadow: 0 0 4px #00ff00;
}

.winamp-time-separator {
    width: 5px;
    height: 13px;
    color: #00ff00;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    text-shadow: 0 0 4px #00ff00;
}

/* Bitrate/Kbps display */
.winamp-info {
    font-size: 7px;
    color: #00aa00;
    display: flex;
    gap: 8px;
    padding: 2px 0;
}

.winamp-info-item {
    display: flex;
    gap: 2px;
}

/* Scrolling song title */
.winamp-song-title {
    height: 12px;
    color: #00ff00;
    font-size: 8px;
    font-family: 'Arial', sans-serif;
    text-transform: uppercase;
    overflow: hidden;
    white-space: nowrap;
    margin-bottom: 2px;
    width: 100%;
    max-width: 100%;
    position: relative;
}

.winamp-song-title-text {
    display: inline-block;
    animation: winamp-scroll 10s linear infinite;
    padding-left: 100%;
}

@keyframes winamp-scroll {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-100%);
    }
}

/* Visualizer placeholder */
.winamp-visualizer {
    flex: 1;
    background-color: #000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 1px;
    padding: 2px;
    overflow: hidden;
    max-width: 100%;
}

.winamp-vis-bar {
    width: 3px;
    background: linear-gradient(180deg, #ff0000 0%, #ffff00 40%, #00ff00 100%);
    transition: height 0.1s ease;
}

/* Stereo/Mono indicator */
.winamp-stereo-mono {
    display: flex;
    gap: 4px;
    font-size: 6px;
    padding: 2px 0;
}

.winamp-indicator {
    color: #005500;
}

.winamp-indicator.active {
    color: #00ff00;
    text-shadow: 0 0 3px #00ff00;
}

/* Position/Seek bar */
.winamp-posbar {
    height: 10px;
    margin: 0 7px;
    display: flex;
    align-items: center;
}

.winamp-posbar-track {
    flex: 1;
    height: 6px;
    background-color: #000;
    border: 1px solid #1a1a1a;
    position: relative;
    cursor: pointer;
}

.winamp-posbar-fill {
    height: 100%;
    background: linear-gradient(180deg, #3a5779 0%, #1a3050 100%);
    width: 0%;
    transition: width 0.1s linear;
}

.winamp-posbar-thumb {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 10px;
    background: linear-gradient(180deg, #6a6a6a 0%, #4a4a4a 50%, #2a2a2a 100%);
    border: 1px solid #888;
    cursor: pointer;
    left: 0%;
}

.winamp-posbar-thumb:hover {
    background: linear-gradient(180deg, #8a8a8a 0%, #6a6a6a 50%, #4a4a4a 100%);
}

/* Control buttons area */
.winamp-controls {
    height: 26px;
    margin: 2px 4px 4px 4px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2px;
    overflow: hidden;
}

.winamp-transport {
    display: flex;
    gap: 0;
    flex-shrink: 0;
}

.winamp-btn {
    width: 20px;
    height: 16px;
    border: none;
    background: linear-gradient(180deg, #5a5a5a 0%, #3a3a3a 50%, #2a2a2a 100%);
    color: #fff;
    font-size: 7px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #666;
    border-bottom-color: #222;
    border-right-color: #222;
    padding: 0;
    flex-shrink: 0;
}

.winamp-btn:hover {
    background: linear-gradient(180deg, #7a7a7a 0%, #5a5a5a 50%, #4a4a4a 100%);
}

.winamp-btn:active {
    background: linear-gradient(180deg, #2a2a2a 0%, #3a3a3a 50%, #4a4a4a 100%);
    border: 1px solid #222;
    border-bottom-color: #666;
    border-right-color: #666;
}

.winamp-btn.active {
    background: linear-gradient(180deg, #4a6a8a 0%, #2a4a6a 50%, #1a3a5a 100%);
}

/* Toggle buttons (EQ, PL, S, R) */
.winamp-toggles {
    display: flex;
    gap: 1px;
    flex-shrink: 0;
}

.winamp-toggle-btn {
    width: 18px;
    height: 12px;
    font-size: 6px;
    font-weight: bold;
}

.winamp-toggle-btn.active {
    background: linear-gradient(180deg, #00aa00 0%, #008800 50%, #006600 100%);
    color: #000;
}

/* Volume slider */
.winamp-volume {
    display: flex;
    align-items: center;
    flex-shrink: 1;
    min-width: 40px;
}

.winamp-volume-track {
    width: 50px;
    height: 8px;
    background: linear-gradient(90deg,
        #006600 0%,
        #00aa00 30%,
        #ffff00 60%,
        #ff6600 80%,
        #ff0000 100%
    );
    border: 1px solid #1a1a1a;
    position: relative;
    cursor: pointer;
}

.winamp-volume-thumb {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 9px;
    background: linear-gradient(180deg, #6a6a6a 0%, #4a4a4a 50%, #2a2a2a 100%);
    border: 1px solid #888;
    cursor: pointer;
}

/* ==========================================
   EQUALIZER WINDOW
   ========================================== */

.winamp-equalizer {
    width: 275px;
    height: 116px;
    background-color: #232323;
    border: 1px solid #000;
    border-top: none;
    display: flex;
    flex-direction: column;
}

.winamp-eq-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2px 7px;
}

.winamp-eq-toggles {
    display: flex;
    gap: 4px;
}

.winamp-eq-btn {
    padding: 2px 6px;
    font-size: 7px;
    font-weight: bold;
    background: linear-gradient(180deg, #3a3a3a 0%, #2a2a2a 100%);
    border: 1px solid #555;
    border-bottom-color: #111;
    border-right-color: #111;
    color: #888;
    cursor: pointer;
}

.winamp-eq-btn.active {
    background: linear-gradient(180deg, #00aa00 0%, #008800 100%);
    color: #000;
}

.winamp-eq-presets {
    position: relative;
}

.winamp-eq-presets select {
    font-size: 7px;
    padding: 2px 12px 2px 4px;
    background-color: #2a2a2a;
    border: 1px solid #555;
    color: #00ff00;
    cursor: pointer;
}

/* EQ Sliders area */
.winamp-eq-sliders {
    flex: 1;
    display: flex;
    padding: 4px 7px;
    gap: 2px;
    background-color: #1a1a1a;
    margin: 0 4px 4px 4px;
}

.winamp-eq-slider {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 14px;
}

.winamp-eq-slider.preamp {
    width: 20px;
    margin-right: 8px;
    border-right: 1px solid #333;
    padding-right: 8px;
}

.winamp-eq-slider-track {
    width: 6px;
    height: 50px;
    background: linear-gradient(180deg,
        #ff0000 0%,
        #ff0000 10%,
        #000 10%,
        #000 50%,
        #000 50%,
        #00ff00 90%,
        #00ff00 100%
    );
    border: 1px solid #333;
    position: relative;
    cursor: pointer;
}

.winamp-eq-slider-thumb {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 5px;
    background: linear-gradient(180deg, #888 0%, #666 50%, #444 100%);
    border: 1px solid #aaa;
    cursor: pointer;
    top: 50%;
}

.winamp-eq-slider-label {
    font-size: 5px;
    color: #00aa00;
    margin-top: 2px;
    white-space: nowrap;
}

/* ==========================================
   PLAYLIST WINDOW
   ========================================== */

.winamp-playlist {
    width: 275px;
    min-height: 116px;
    background-color: #232323;
    border: 1px solid #000;
    border-top: none;
    display: flex;
    flex-direction: column;
}

.winamp-playlist-header {
    height: 20px;
    background-color: #1a1a1a;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 4px;
}

.winamp-playlist-title {
    color: #00ff00;
    font-size: 8px;
    font-weight: bold;
}

.winamp-playlist-info {
    color: #00aa00;
    font-size: 7px;
}

.winamp-playlist-content {
    background-color: #000;
    margin: 2px 4px;
    border: 1px solid #1a1a1a;
}

.winamp-playlist-item {
    display: flex;
    padding: 1px 4px;
    color: #00ff00;
    font-size: 8px;
    cursor: pointer;
    border-bottom: 1px solid #111;
}

.winamp-playlist-item:hover {
    background-color: #1a1a1a;
}

.winamp-playlist-item.active {
    background-color: #0000aa;
    color: #fff;
}

.winamp-playlist-item.playing {
    background-color: #00aa00;
    color: #000;
}

.winamp-playlist-item-num {
    width: 24px;
    color: #00aa00;
}

.winamp-playlist-item-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.winamp-playlist-item-duration {
    width: 40px;
    text-align: right;
    color: #00aa00;
}

.winamp-playlist-footer {
    height: 18px;
    background-color: #1a1a1a;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 4px;
}

.winamp-playlist-actions {
    display: flex;
    gap: 2px;
}

.winamp-playlist-btn {
    padding: 1px 4px;
    font-size: 6px;
    background: linear-gradient(180deg, #3a3a3a 0%, #2a2a2a 100%);
    border: 1px solid #555;
    color: #888;
    cursor: pointer;
}

.winamp-playlist-btn:hover {
    background: linear-gradient(180deg, #4a4a4a 0%, #3a3a3a 100%);
    color: #aaa;
}

.winamp-playlist-total {
    color: #00aa00;
    font-size: 7px;
}

/* ==========================================
   MINI PLAYER (80px adapted)
   ========================================== */

.winamp-mini-player {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: linear-gradient(180deg, #2a2a2a 0%, #1a1a1a 100%);
    border-top: 2px solid #3a5779;
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 16px;
    z-index: 1000;
    font-family: 'Arial', sans-serif;
}

.winamp-mini-display {
    width: 200px;
    height: 50px;
    background-color: #000;
    border: 2px solid #1a1a1a;
    border-radius: 2px;
    display: flex;
    flex-direction: column;
    padding: 4px 8px;
    overflow: hidden;
}

.winamp-mini-title {
    color: #00ff00;
    font-size: 12px;
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-shadow: 0 0 4px #00ff00;
}

.winamp-mini-title-scroll {
    display: inline-block;
    animation: winamp-scroll 8s linear infinite;
}

.winamp-mini-artist {
    color: #00aa00;
    font-size: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.winamp-mini-time {
    color: #00ff00;
    font-size: 14px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    text-shadow: 0 0 4px #00ff00;
    margin-top: auto;
}

.winamp-mini-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.winamp-mini-btn {
    width: 40px;
    height: 40px;
    background: linear-gradient(180deg, #4a4a4a 0%, #2a2a2a 100%);
    border: 2px solid #666;
    border-bottom-color: #222;
    border-right-color: #222;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 2px;
}

.winamp-mini-btn:hover {
    background: linear-gradient(180deg, #5a5a5a 0%, #3a3a3a 100%);
}

.winamp-mini-btn:active {
    background: linear-gradient(180deg, #2a2a2a 0%, #4a4a4a 100%);
    border: 2px solid #222;
    border-bottom-color: #666;
    border-right-color: #666;
}

.winamp-mini-btn.play-pause {
    width: 50px;
    height: 50px;
    font-size: 20px;
    background: linear-gradient(180deg, #3a6a3a 0%, #1a4a1a 100%);
    border-color: #4a8a4a;
    border-bottom-color: #0a2a0a;
    border-right-color: #0a2a0a;
}

.winamp-mini-btn.play-pause:hover {
    background: linear-gradient(180deg, #4a8a4a 0%, #2a6a2a 100%);
}

.winamp-mini-volume {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.winamp-mini-volume-track {
    width: 100px;
    height: 8px;
    background: linear-gradient(90deg,
        #006600 0%,
        #00aa00 30%,
        #ffff00 60%,
        #ff6600 80%,
        #ff0000 100%
    );
    border: 1px solid #333;
    border-radius: 2px;
    cursor: pointer;
    position: relative;
}

.winamp-mini-volume-fill {
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    position: absolute;
    right: 0;
    top: 0;
}

.winamp-mini-close {
    width: 32px;
    height: 32px;
    background: linear-gradient(180deg, #6a3a3a 0%, #4a1a1a 100%);
    border: 2px solid #8a4a4a;
    border-bottom-color: #2a0a0a;
    border-right-color: #2a0a0a;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    border-radius: 2px;
}

.winamp-mini-close:hover {
    background: linear-gradient(180deg, #8a4a4a 0%, #6a2a2a 100%);
}

/* Scrollbar styling for playlist */
.winamp-playlist-content::-webkit-scrollbar {
    width: 8px;
}

.winamp-playlist-content::-webkit-scrollbar-track {
    background: #1a1a1a;
}

.winamp-playlist-content::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #4a4a4a 0%, #2a2a2a 100%);
    border: 1px solid #555;
}

.winamp-playlist-content::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #5a5a5a 0%, #3a3a3a 100%);
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .winamp-mini-player {
        padding: 0 8px;
        gap: 8px;
    }

    .winamp-mini-display {
        width: 150px;
    }

    .winamp-mini-volume {
        display: none;
    }
}

/* ==========================================
   WINAMP PLAYER PAGE LAYOUT
   ========================================== */

.winamp-player-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    padding-bottom: 2rem;
    overflow-x: hidden;
    overflow-y: visible;
}

.winamp-player-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 600px;
    margin-bottom: 1rem;
    padding: 0 1rem;
}

.winamp-player-header h4 {
    color: var(--text-primary, #333);
    margin: 0;
    font-weight: 600;
    font-size: 1rem;
}

[data-theme="dark"] .winamp-player-header h4 {
    color: #fff;
}

.winamp-toggle-btn {
    background: linear-gradient(135deg, #232323 0%, #1a1a1a 100%);
    border: 1px solid #444;
    color: #00ff00;
}

.winamp-toggle-btn:hover {
    background: linear-gradient(135deg, #333 0%, #2a2a2a 100%);
    color: #00ff00;
    border-color: #00ff00;
}

/* Make Winamp windows centered and contained */
.winamp-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 600px;
    overflow-x: hidden;
    overflow-y: visible;
}

/* Account for the 2x scale - need space for scaled content */
/* main(116) + eq(116) + playlist(300 max) = 532px at 2x = 1064px */
.winamp-player-page .winamp-container {
    min-height: auto;
}

/* Scale wrapper should not clip content */
.winamp-scale-wrapper {
    overflow: visible;
}

/* Dark mode mini player override to match Winamp style */
.winamp-mini-player {
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
}

/* Hide persistent player wrapper when Winamp is active */
.persistent-player-wrapper.winamp-hidden {
    display: none !important;
    visibility: hidden !important;
}

/* Contain Winamp player - no special overflow handling needed */
.player-page.winamp-active {
    overflow-x: hidden;
}

.player-page.winamp-active .winamp-player-page {
    overflow-x: hidden;
}

/* ==========================================
   STYLE SWITCH BUTTONS
   ========================================== */

/* "Modern View" button in Winamp mode */
.btn-modern-switch {
    background: linear-gradient(180deg, #4a4a4a 0%, #2a2a2a 100%);
    border: 1px solid #666;
    border-bottom-color: #222;
    border-right-color: #222;
    color: #00ff00;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.35rem 0.6rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border-radius: 2px;
    text-shadow: 0 0 4px rgba(0, 255, 0, 0.3);
    transition: all 0.2s ease;
}

.btn-modern-switch:hover {
    background: linear-gradient(180deg, #5a5a5a 0%, #3a3a3a 100%);
    color: #00ff00;
    border-color: #00ff00;
    text-shadow: 0 0 8px rgba(0, 255, 0, 0.5);
}

.btn-modern-switch:active {
    background: linear-gradient(180deg, #2a2a2a 0%, #4a4a4a 100%);
    border: 1px solid #222;
    border-bottom-color: #666;
    border-right-color: #666;
}

.btn-modern-switch i {
    font-size: 0.8rem;
}

/* "Classic" button in modern player - make it highly visible */
.controls .winamp-toggle-btn,
.youtube-player .winamp-toggle-btn {
    background: linear-gradient(180deg, #1a3a1a 0%, #0a2a0a 100%) !important;
    border: 2px solid #00ff00 !important;
    color: #00ff00 !important;
    font-weight: 700;
    text-shadow: 0 0 6px rgba(0, 255, 0, 0.5);
    padding: 0.4rem 0.75rem !important;
    font-size: 0.85rem !important;
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.3), inset 0 1px 0 rgba(0, 255, 0, 0.2);
    animation: classic-btn-glow 2s ease-in-out infinite alternate;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.4rem !important;
    line-height: 1 !important;
}

@keyframes classic-btn-glow {
    from {
        box-shadow: 0 0 8px rgba(0, 255, 0, 0.3), inset 0 1px 0 rgba(0, 255, 0, 0.2);
    }
    to {
        box-shadow: 0 0 15px rgba(0, 255, 0, 0.5), inset 0 1px 0 rgba(0, 255, 0, 0.3);
    }
}

.controls .winamp-toggle-btn:hover,
.youtube-player .winamp-toggle-btn:hover {
    background: linear-gradient(180deg, #2a5a2a 0%, #1a4a1a 100%) !important;
    border-color: #00ff00 !important;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.6), inset 0 1px 0 rgba(0, 255, 0, 0.3);
    animation: none;
}

.controls .winamp-toggle-btn i,
.youtube-player .winamp-toggle-btn i {
    color: #00ff00 !important;
    display: inline-flex !important;
    align-items: center !important;
    line-height: 1 !important;
}

/* ==========================================
   WINAMP MINI PLAYER WRAPPER FIX
   ========================================== */

/* When Winamp mini player is inside the .mini-player wrapper,
   reset the wrapper's styles that interfere with fixed positioning */
.mini-player:has(.winamp-mini-player) {
    position: static;
    transform: none;
    opacity: 1;
    height: auto;
    background: transparent;
    border: none;
    box-shadow: none;
}

/* Ensure the Winamp mini player shows correctly */
.mini-player.visible .winamp-mini-player {
    display: flex;
}
