/* Pixel Perfect Boombox CSS */

/* Import Rootleaf CSS Variables */
@import url('/css/style.css');

/* CSS Reset & Pixel Rendering */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: var(--background);
    font-family: 'Press Start 2P', monospace;
    color: var(--foreground);
    min-height: 100vh;
    font-size: 12px;
    line-height: 1.6;
    image-rendering: pixelated;
    position: relative;
}

/* Topographic Background Canvas */
#topoMap {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0.3;
}

img {
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

.pixel-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* Navigation */
.pixel-nav {
    width: 100%;
    margin-bottom: 20px;
}

.nav-link {
    color: var(--golden-yellow);
    text-decoration: none;
    font-size: 10px;
    padding: 8px 16px;
    border: 2px solid var(--golden-yellow);
    background: var(--background);
    display: inline-block;
    transition: all 0.1s ease;
}

.nav-link:hover {
    background: var(--golden-yellow);
    color: var(--background);
}

/* Header */
.pixel-header {
    text-align: center;
    margin-bottom: 40px;
}

.pixel-header h1 {
    font-size: 16px;
    color: var(--golden-yellow);
    margin-bottom: 10px;
    text-shadow: 2px 2px 0px rgba(0,0,0,0.8);
}

.pixel-header p {
    font-size: 10px;
    color: var(--royal-blue-light);
}

/* Boombox UI Layout */
.boombox-ui {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

/* Boombox Container */
.boombox-container {
    position: relative;
    display: inline-block;
    margin-bottom: 20px;
    width: 100%;
    max-width: 800px;
    aspect-ratio: 2000 / 1500; /* Maintain 2000x1500 aspect ratio */
}

.boombox {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: filter 0.2s ease;
}

.boombox.drag-over {
    filter: brightness(1.2) saturate(1.3);
    transform: scale(1.02);
}

/* Album Art Container - hidden for now */
.album-art-container {
    display: none;
}

.album-art {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 2px;
    image-rendering: pixelated;
}

/* Display Overlay - positioned to the right of the magenta box */
.display-overlay {
    position: absolute;
    top: 28%;     /* Moved down ~4px to align with adjusted album art */
    left: 42%;    /* To the right of the album art area */
    width: 45%;   /* Extended width to prevent text cutoff */
    height: 25%;  /* Height for title and time */
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    padding: 0;
    pointer-events: none;
    z-index: 10;
}

.track-name {
    color: #000;  /* Black for title */
    font-size: clamp(12px, 1.8vw, 24px);  /* Scaled from 36px */
    font-weight: bold;
    line-height: 1.1;
    margin-bottom: 0.3em;  /* Scaled from 18px spacing */
}

.track-time {
    color: #000;  /* Black for time */
    font-size: clamp(9px, 1.4vw, 18px);  /* Scaled from 28px */
    line-height: 1.1;
}

.display-overlay .track-name {
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    color: #000;  /* Black text */
    font-size: 14px;  /* Smaller text to fit better */
}

.display-overlay .track-time {
    font-size: 12px;  /* Smaller time text */
    color: #000;  /* Black text */
    margin-top: -5px;  /* Moved up ~6px from 1px to -5px */
}

/* Control Buttons positioned over the boombox */
.control-buttons {
    position: absolute;
    bottom: 23%;  /* Centered in the button area */
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;  /* Adjusted spacing for better centering */
    z-index: 15;
}

.control-btn {
    width: 70px;  /* Slightly smaller */
    height: auto;
    cursor: pointer;
    transition: transform 0.1s ease;
    image-rendering: pixelated;
}

.control-btn:hover {
    transform: scale(1.05);
}

.control-btn:active {
    transform: scale(0.95);
}

.control-btn.pressed {
    filter: brightness(1.2);
}

/* External Controls */
.external-controls {
    display: flex;
    align-items: center;
    gap: 20px;
    margin: 20px 0;
    justify-content: center;
}

/* Volume Control */
.volume-control {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0,0,0,0.8);
    border: 2px solid var(--royal-blue);
    padding: 8px 12px;
    border-radius: 4px;
}

.volume-control label {
    color: var(--golden-yellow);
    font-size: 8px;
    min-width: 50px;
}

.pixel-slider {
    width: 100px;
    height: 6px;
    background: #333;
    outline: none;
    border: 1px solid var(--royal-blue);
    appearance: none;
}

.pixel-slider::-webkit-slider-thumb {
    appearance: none;
    width: 12px;
    height: 12px;
    background: var(--golden-yellow);
    cursor: pointer;
    border: 1px solid #000;
}

.pixel-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: var(--golden-yellow);
    cursor: pointer;
    border: 1px solid #000;
    border-radius: 0;
}

#volume-display {
    color: var(--royal-blue-light);
    font-size: 8px;
    min-width: 30px;
}

/* Remove old now-playing styles since we're using overlay */

/* Cassette Bank Header */
.cassette-bank-header {
    text-align: center;
    margin-top: 30px;
    margin-bottom: 10px;
}

.cassette-bank-header h3 {
    color: var(--golden-yellow);
    font-size: 14px;
    margin: 0 0 5px 0;
    letter-spacing: 1px;
}

.cassette-bank-header p {
    color: var(--royal-blue-light);
    font-size: 10px;
    margin: 0;
    opacity: 0.8;
}

/* Cassette Bank - Responsive Grid with Scroll */
.cassette-bank {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 20px;
    justify-content: center;
    margin: 20px auto;
    max-width: 1200px;
    max-height: 400px;
    overflow-y: auto;
    padding: 20px;
    background: rgba(0, 0, 0, 0.1);
    border: 2px solid var(--royal-blue);
    border-radius: 8px;
    
    /* Custom scrollbar */
    scrollbar-width: thin;
    scrollbar-color: var(--royal-blue) rgba(0, 0, 0, 0.2);
}

.cassette-bank::-webkit-scrollbar {
    width: 8px;
}

.cassette-bank::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.cassette-bank::-webkit-scrollbar-thumb {
    background: var(--royal-blue);
    border-radius: 4px;
}

.cassette-bank::-webkit-scrollbar-thumb:hover {
    background: var(--royal-blue-light);
}

/* Responsive cassette bank for different screen sizes */
@media (max-width: 768px) {
    .cassette-bank {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 15px;
        padding: 15px;
        max-height: 300px;
        max-width: 100%;
        margin: 15px 10px;
    }
    
    .cassette {
        max-width: 120px;
    }
}

@media (max-width: 480px) {
    .cassette-bank {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 12px;
        padding: 12px;
        max-height: 250px;
    }
    
    .cassette {
        max-width: 100px;
    }
}

.cassette {
    width: 100%;
    max-width: 140px;
    height: auto;
    cursor: grab;
    transition: transform 0.2s ease;
    border: 2px solid transparent;
    border-radius: 4px;
    justify-self: center;
}

.cassette:hover {
    transform: scale(1.05);
}

.cassette:active {
    cursor: grabbing;
}

.cassette.dragging {
    opacity: 0.8;
    transform: scale(1.1) rotate(3deg);
    z-index: 1000;
}

/* Cassette Tooltip */
.cassette-tooltip {
    position: fixed;
    background: rgba(0, 0, 0, 0.9);
    color: var(--golden-yellow);
    padding: 8px 12px;
    border-radius: 4px;
    border: 1px solid var(--royal-blue);
    font-size: 10px;
    font-weight: bold;
    white-space: nowrap;
    z-index: 1001;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    transform: translateX(-50%);
}

.cassette-tooltip.show {
    opacity: 1;
}

.cassette-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.9);
}

/* Track List */
.track-list {
    width: 100%;
    max-width: 500px;
    margin-top: 30px;
    background: rgba(200,200,200,0.9);
    border: 2px solid var(--royal-blue);
}

.track-list-header {
    background: var(--royal-blue);
    padding: 8px;
    text-align: center;
    font-size: 8px;
    color: #000;  /* Black text for header */
    border-bottom: 1px solid var(--royal-blue-light);
}

.track-list-content {
    max-height: 200px;
    overflow-y: auto;
}

.track-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 12px;
    border-bottom: 1px solid var(--royal-blue);
    cursor: pointer;
    transition: all 0.1s ease;
    font-size: 8px;
    color: #000;  /* Black text for track items */
}

.track-item:hover {
    background: rgba(100,149,237,0.7);
    color: #000;  /* Black text on hover */
}

.track-item.active {
    background: var(--golden-yellow);
    color: #000;  /* Black text for active track */
}

.track-item.playing {
    background: var(--earth-brown);
    color: #000;  /* Black text for playing track */
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.7; }
}

.track-number {
    min-width: 30px;
}

.track-name {
    flex: 1;
    margin: 0 10px;
}

.track-duration {
    min-width: 40px;
    text-align: right;
}

/* Additional Controls */
.additional-controls {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.pixel-btn {
    background: rgba(0,0,0,0.8);
    color: var(--golden-yellow);
    border: 2px solid var(--golden-yellow);
    padding: 8px 16px;
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    cursor: pointer;
    transition: all 0.1s ease;
}

.pixel-btn:hover {
    background: var(--golden-yellow);
    color: var(--background);
    box-shadow: 0 0 10px var(--golden-yellow);
}

.pixel-btn:active {
    transform: translateY(1px);
}

.pixel-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.pixel-btn:disabled:hover {
    background: rgba(0,0,0,0.8);
    color: var(--golden-yellow);
    box-shadow: none;
}

/* Audio Player (Hidden) */
#audio-player {
    display: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    .pixel-container {
        padding: 10px;
    }
    
    .boombox-ui {
        gap: 20px; /* Reduce gap on mobile */
    }
    
    .boombox-container {
        max-width: 90vw;
    }
    
    .boombox {
        max-width: 100%;
    }
    
    .cassette-bank {
        gap: 15px;
        flex-wrap: wrap;
        justify-content: center;
        margin-top: 10px; /* Reduce top margin to bring cassettes closer */
    }
    
    .cassette {
        width: 120px; /* Slightly smaller to fit better */
    }
    
    .pixel-header h1 {
        font-size: 14px;
    }
    
    .pixel-header p {
        font-size: 9px;
    }
    
    .additional-controls {
        gap: 10px;
        margin-top: 15px;
    }
    
    .external-controls {
        flex-direction: column;
        gap: 15px;
    }
    
    .volume-control {
        flex-direction: column;
        text-align: center;
        gap: 5px;
    }
    
    .control-buttons {
        gap: 10px;
    }
    
    .control-btn {
        width: 55px;
    }
    
    .pixel-btn {
        padding: 6px 12px;
        font-size: 7px;
    }
    
    .display-overlay {
        font-size: clamp(5px, 1vw, 8px);
    }
    
    .track-list {
        margin-top: 15px;
    }
}

@media (max-width: 480px) {
    .boombox-ui {
        gap: 15px; /* Even smaller gap on smaller screens */
    }
    
    .cassette-bank {
        gap: 12px;
        margin-top: 5px; /* Bring cassettes even closer */
        max-width: 100%;
        /* Keep horizontal layout but with tighter spacing */
        flex-wrap: wrap;
        justify-content: space-around;
    }
    
    .cassette {
        width: 90px; /* Much smaller to fit multiple per row */
        min-width: 85px;
    }
    
    .display-overlay {
        font-size: clamp(4px, 0.8vw, 6px);
        padding: 0 4px;
    }
    
    .control-btn {
        width: 45px;
    }
    
    .control-buttons {
        gap: 8px;
    }
    
    .additional-controls {
        margin-top: 10px;
    }
    
    .track-list {
        margin-top: 10px;
    }
    
    /* Make pixel header smaller on very small screens */
    .pixel-header {
        margin-bottom: 20px;
    }
    
    .pixel-header h1 {
        font-size: 12px;
    }
    
    .pixel-header p {
        font-size: 8px;
    }
}

/* For very small screens - stack cassettes in two rows */
@media (max-width: 360px) {
    .cassette-bank {
        gap: 8px;
        margin-top: 8px;
    }
    
    .cassette {
        width: 75px;
        min-width: 70px;
    }
    
    .boombox-ui {
        gap: 12px;
    }
}

/* Scrollbar Styling */
.track-list-content::-webkit-scrollbar {
    width: 8px;
}

.track-list-content::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.8);
}

.track-list-content::-webkit-scrollbar-thumb {
    background: var(--royal-blue);
    border: 1px solid var(--royal-blue-light);
}

.track-list-content::-webkit-scrollbar-thumb:hover {
    background: var(--golden-yellow);
}

/* Footer Styles */
.page-footer {
    text-align: center;
    margin-top: 60px;
    padding: 20px 30px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 10px;
    border: 1px solid hsl(217, 70%, 55%);
}

.page-footer p {
    color: rgba(255, 255, 255, 0.8);
    margin: 0 0 15px 0;
    font-size: 14px;
    opacity: 0.8;
}

.footer-nav {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.footer-nav a {
    color: hsl(45, 86%, 62%);
    text-decoration: none;
    font-weight: 600;
    font-size: 16px;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.footer-nav a:hover {
    color: #fbbf24;
    background: rgba(245, 158, 11, 0.1);
    border-color: hsl(45, 86%, 62%);
    transform: translateY(-1px);
}

@media (max-width: 768px) {
    .footer-nav {
        gap: 15px;
    }
    
    .footer-nav a {
        font-size: 14px;
        padding: 6px 12px;
    }
}