/* ============================================
   Cyberpunk Music Player - Base Styles
   Dark futuristic theme with Matrix-inspired effects
   ============================================ */

/* Ensure full viewport coverage */
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    overflow-x: hidden;
}

/* ============================================
   CSS Variables - Matrix Theme
   ============================================ */
:root {
    /* Matrix Green Colors */
    --matrix-green-bright: #00ff41;
    --matrix-green-medium: #00cc33;
    --matrix-green-dark: #008f11;
    --matrix-green-dim: #003b00;
    
    /* Dark Background Colors */
    --bg-dark-primary: #000000;
    --bg-dark-secondary: #0a0a0a;
    --bg-dark-tertiary: #0d0d0d;
    
    /* Matrix Glow Effects */
    --glow-bright: 0 0 10px rgba(0, 255, 65, 0.5), 0 0 20px rgba(0, 255, 65, 0.3);
    --glow-medium: 0 0 10px rgba(0, 204, 51, 0.5), 0 0 20px rgba(0, 204, 51, 0.3);
    --glow-dark: 0 0 10px rgba(0, 143, 17, 0.5), 0 0 20px rgba(0, 143, 17, 0.3);
    --glow-dim: 0 0 10px rgba(0, 59, 0, 0.5), 0 0 20px rgba(0, 59, 0, 0.3);
    
    /* Typography */
    --font-mono: 'Courier New', 'Consolas', 'Monaco', monospace;
    --font-tech: 'Share Tech Mono', 'Orbitron', monospace;
}

/* ============================================
   Matrix Rain Canvas Background
   ============================================ */
#matrix-rain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -2;
    background: var(--bg-dark-primary);
    display: block;
}

/* ============================================
   CRT Effect Overlay
   ============================================ */
.crt-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.1) 0px,
        rgba(0, 0, 0, 0.1) 1px,
        transparent 1px,
        transparent 2px
    );
    animation: crt-flicker 0.15s infinite;
}

@keyframes crt-flicker {
    0% { opacity: 0.95; }
    50% { opacity: 1; }
    100% { opacity: 0.95; }
}

/* ============================================
   Hero Section - Matrix Style
   ============================================ */
/* Menu and Header - 20% transparent (80% opaque) */
/* Keep site menu fully visible */
#top-menu .top-nav {
    opacity: 1;
}

/* Keep footer fully visible */
#footer {
    opacity: 1;
}

.hero-music {
    background: linear-gradient(135deg, var(--bg-dark-secondary) 0%, var(--bg-dark-tertiary) 100%);
    border-bottom: 2px solid var(--matrix-green-bright);
    box-shadow: 0 4px 15px rgba(0, 255, 65, 0.3);
    opacity: 0.8;
}

.hero-music h1 {
    font-family: var(--font-tech);
    color: var(--matrix-green-bright);
    text-shadow: var(--glow-bright);
    letter-spacing: 2px;
}

.hero-music p {
    font-family: var(--font-mono);
    color: var(--matrix-green-medium);
    text-shadow: var(--glow-medium);
}

/* ============================================
   Main Music Player Container
   ============================================ */
.music-player-container {
    background: var(--bg-dark-secondary);
    border: 2px solid var(--matrix-green-bright);
    border-radius: 8px;
    padding: 2rem;
    margin: 2rem auto;
    max-width: 900px;
    box-shadow: 
        0 0 20px rgba(0, 255, 65, 0.3),
        inset 0 0 30px rgba(0, 255, 65, 0.05);
    font-family: var(--font-mono);
    opacity: 0.8;
}

/* ============================================
   Album Art Section
   ============================================ */
.album-art-section {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.album-art-wrapper {
    position: relative;
    width: 100%;
    max-width: 400px;
    aspect-ratio: 1;
    border: 2px solid var(--matrix-green-medium);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--glow-medium);
    background: var(--bg-dark-tertiary);
}

.album-art {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

.album-art.loaded {
    display: block;
}

.album-art-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 6rem;
    color: var(--matrix-green-bright);
    text-shadow: var(--glow-bright);
}

.album-art.loaded + .album-art-placeholder {
    display: none;
}

/* ============================================
   Track Information Section
   ============================================ */
.track-info-section {
    text-align: center;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--bg-dark-tertiary);
    border: 1px solid var(--matrix-green-medium);
    border-radius: 4px;
    box-shadow: var(--glow-medium);
}

.track-title-wrapper {
    overflow: hidden;
    position: relative;
    height: 2.5rem;
    margin-bottom: 0.5rem;
}

.track-title {
    font-family: var(--font-tech);
    font-size: 1.5rem;
    color: var(--matrix-green-bright);
    text-shadow: var(--glow-bright);
    margin: 0;
    white-space: nowrap;
}

.track-title.scrolling {
    animation: scroll-text 10s linear infinite;
}

@keyframes scroll-text {
    0% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}

.track-artist {
    font-size: 1.1rem;
    color: var(--matrix-green-medium);
    text-shadow: var(--glow-medium);
    margin: 0.5rem 0;
}

.track-time {
    font-family: var(--font-mono);
    font-size: 1rem;
    color: var(--matrix-green-dark);
    text-shadow: var(--glow-dark);
    margin-top: 0.5rem;
}

.time-separator {
    margin: 0 0.5rem;
}

/* ============================================
   Progress Bar Section
   ============================================ */
.progress-section {
    margin-bottom: 1.5rem;
}

.progress-bar {
    position: relative;
    width: 100%;
    height: 8px;
    background: var(--bg-dark-tertiary);
    border: 1px solid var(--matrix-green-bright);
    border-radius: 4px;
    cursor: pointer;
    overflow: hidden;
    touch-action: none;
}

.progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--matrix-green-bright) 0%, var(--matrix-green-medium) 100%);
    box-shadow: 0 0 10px rgba(0, 255, 65, 0.8);
    transition: width 0.1s linear;
}

.progress-fill.pulsing {
    animation: pulse-glow 1s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 10px rgba(0, 255, 65, 0.8); }
    50% { box-shadow: 0 0 20px rgba(0, 255, 65, 1); }
}

.progress-handle {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    background: var(--matrix-green-bright);
    border: 2px solid var(--bg-dark-primary);
    border-radius: 50%;
    box-shadow: var(--glow-bright);
    transition: left 0.1s linear;
    pointer-events: none;
}

/* ============================================
   Playback Controls Section
   ============================================ */
.controls-section {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.control-btn {
    width: 50px;
    height: 50px;
    background: var(--bg-dark-tertiary);
    border: 2px solid var(--matrix-green-bright);
    border-radius: 50%;
    color: var(--matrix-green-bright);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--glow-bright);
}

.control-btn:hover {
    background: var(--matrix-green-bright);
    color: var(--bg-dark-primary);
    box-shadow: 0 0 15px rgba(0, 255, 65, 0.8);
    transform: scale(1.1);
}

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

.control-btn:focus {
    outline: 2px solid var(--matrix-green-medium);
    outline-offset: 3px;
}

.control-btn-main {
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
    border-color: var(--matrix-green-medium);
    color: var(--matrix-green-medium);
    box-shadow: var(--glow-medium);
}

.control-btn-main:hover {
    background: var(--matrix-green-medium);
}

.control-btn.active {
    background: var(--matrix-green-bright);
    color: var(--bg-dark-primary);
    border-color: var(--matrix-green-bright);
    box-shadow: 0 0 15px rgba(0, 255, 65, 0.8);
}

/* ============================================
   Volume Control Section
   ============================================ */
.volume-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--bg-dark-tertiary);
    border: 1px solid var(--matrix-green-dark);
    border-radius: 4px;
    box-shadow: var(--glow-dark);
}

.volume-icon {
    color: var(--matrix-green-dark);
    font-size: 1.2rem;
    text-shadow: var(--glow-dark);
}

.volume-slider {
    flex: 1;
    max-width: 300px;
    height: 6px;
    background: var(--bg-dark-primary);
    border: 1px solid var(--matrix-green-dark);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    touch-action: none;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--matrix-green-dark);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--glow-dark);
}

.volume-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--matrix-green-dark);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--glow-dark);
}

.volume-slider:focus {
    outline: 2px solid var(--matrix-green-bright);
    outline-offset: 2px;
}

.volume-display {
    font-family: var(--font-mono);
    color: var(--matrix-green-dark);
    text-shadow: var(--glow-dark);
    min-width: 3rem;
    text-align: right;
}

/* ============================================
   Visual Equalizer Section
   ============================================ */
.equalizer-section {
    margin-bottom: 1.5rem;
}

.equalizer-container {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 8px;
    height: 80px;
    padding: 1rem;
    background: var(--bg-dark-tertiary);
    border: 1px solid var(--matrix-green-medium);
    border-radius: 4px;
    box-shadow: var(--glow-medium);
}

.equalizer-bar {
    width: 12px;
    height: 10%;
    background: linear-gradient(to top, var(--matrix-green-bright), var(--matrix-green-dark));
    border-radius: 2px;
    box-shadow: 0 0 8px rgba(0, 255, 65, 0.6);
    transition: height 0.1s ease;
}

.equalizer-bar.animating {
    animation: equalizer-bounce 0.5s ease-in-out infinite;
}

@keyframes equalizer-bounce {
    0%, 100% { height: 10%; }
    50% { height: 80%; }
}

/* ============================================
   Playlist Section
   ============================================ */
.playlist-section {
    margin-top: 2rem;
}

.playlist-title {
    font-family: var(--font-tech);
    color: var(--matrix-green-bright);
    text-shadow: var(--glow-bright);
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.playlist-container {
    max-height: 400px;
    overflow-y: auto;
    background: var(--bg-dark-tertiary);
    border: 1px solid var(--matrix-green-bright);
    border-radius: 4px;
    padding: 0.5rem;
}

.playlist-container::-webkit-scrollbar {
    width: 8px;
}

.playlist-container::-webkit-scrollbar-track {
    background: var(--bg-dark-primary);
    border-radius: 4px;
}

.playlist-container::-webkit-scrollbar-thumb {
    background: var(--matrix-green-bright);
    border-radius: 4px;
    box-shadow: var(--glow-bright);
}

.playlist-item {
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    background: var(--bg-dark-secondary);
    border: 1px solid var(--matrix-green-medium);
    border-radius: 4px;
    color: var(--matrix-green-medium);
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: var(--font-mono);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.playlist-item .track-number {
    color: var(--matrix-green-bright);
    font-weight: bold;
    min-width: 2rem;
}

.playlist-item .track-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.playlist-item .track-cache-status {
    flex-shrink: 0;
    width: 1.2rem;
    text-align: center;
    font-size: 0.75rem;
    color: var(--matrix-green-dim);
    transition: color 0.3s ease, opacity 0.3s ease;
    opacity: 0;
}

.playlist-item .track-cache-status.loading {
    opacity: 0.7;
    color: var(--matrix-green-medium);
}

.playlist-item .track-cache-status.cached {
    opacity: 0.5;
    color: var(--matrix-green-dark);
}

.playlist-item:hover .track-cache-status.cached {
    opacity: 0.8;
}

.playlist-item.active .track-cache-status.cached {
    color: var(--bg-dark-primary);
    opacity: 0.6;
}

.playlist-item:hover {
    background: var(--bg-dark-tertiary);
    border-color: var(--matrix-green-bright);
    color: var(--matrix-green-bright);
    box-shadow: var(--glow-bright);
    transform: translateX(5px);
}

.playlist-item.active {
    background: var(--matrix-green-bright);
    color: var(--bg-dark-primary);
    border-color: var(--matrix-green-bright);
    box-shadow: 0 0 15px rgba(0, 255, 65, 0.8);
    font-weight: bold;
}

.playlist-item.active .track-number {
    color: var(--bg-dark-primary);
}

.playlist-loading {
    text-align: center;
    padding: 2rem;
    color: var(--matrix-green-dark);
    text-shadow: var(--glow-dark);
    font-size: 1.1rem;
}

/* ============================================
   Status Messages
   ============================================ */
.status-message {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    background: var(--bg-dark-secondary);
    border: 2px solid var(--matrix-green-medium);
    border-radius: 4px;
    color: var(--matrix-green-medium);
    text-shadow: var(--glow-medium);
    box-shadow: var(--glow-medium);
    font-family: var(--font-mono);
    z-index: 1000;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    pointer-events: none;
}

.status-message.show {
    opacity: 1;
    transform: translateY(0);
}

.status-message.error {
    border-color: #ff0000;
    color: #ff0000;
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.5), 0 0 20px rgba(255, 0, 0, 0.3);
}

/* ============================================
   Responsive Design - Mobile (<768px)
   ============================================ */
@media (max-width: 767px) {
    .music-player-container {
        padding: 1rem;
        margin: 1rem;
    }
    
    .album-art-wrapper {
        max-width: 200px;
    }
    
    .track-title {
        font-size: 1.2rem;
    }
    
    .track-artist {
        font-size: 1rem;
    }
    
    .controls-section {
        gap: 0.5rem;
    }
    
    .control-btn {
        width: 44px;
        height: 44px;
        font-size: 1rem;
    }
    
    .control-btn-main {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
    
    .volume-section {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .volume-slider {
        max-width: 100%;
    }
    
    .equalizer-container {
        height: 60px;
        gap: 4px;
    }
    
    .equalizer-bar {
        width: 8px;
    }
    
    .playlist-container {
        max-height: 300px;
    }
    
    .status-message {
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
        font-size: 0.9rem;
    }
}

/* ============================================
   Responsive Design - Tablet (768px-1024px)
   ============================================ */
@media (min-width: 768px) and (max-width: 1024px) {
    .album-art-wrapper {
        max-width: 300px;
    }
    
    .music-player-container {
        max-width: 700px;
    }
    
    .playlist-container {
        max-height: 350px;
    }
}

/* ============================================
   Responsive Design - Desktop (>1024px)
   ============================================ */
@media (min-width: 1025px) {
    .album-art-wrapper {
        max-width: 400px;
    }
    
    .music-player-container {
        max-width: 900px;
    }
    
    .crt-overlay {
        animation: crt-flicker 0.15s infinite, crt-scan 8s linear infinite;
    }
    
    @keyframes crt-scan {
        0% { background-position: 0 0; }
        100% { background-position: 0 100%; }
    }
}

/* ============================================
   Accessibility - Focus States
   ============================================ */
.control-btn:focus-visible,
.volume-slider:focus-visible,
.playlist-item:focus-visible {
    outline: 3px solid var(--matrix-green-bright);
    outline-offset: 3px;
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
    #matrix-rain,
    .crt-overlay,
    .controls-section,
    .volume-section,
    .equalizer-section {
        display: none;
    }
}

/* ============================================
   Playlist Selector Section
   ============================================ */
.playlist-selector-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--matrix-green-dim);
}

.playlist-selector-title {
    font-family: var(--font-tech);
    color: var(--matrix-green-bright);
    text-shadow: var(--glow-bright);
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.playlist-selector {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
}

.playlist-card {
    position: relative;
    background: var(--bg-dark-tertiary);
    border: 2px solid var(--matrix-green-dim);
    border-radius: 6px;
    padding: 0;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
    font-family: var(--font-mono);
}

.playlist-card:hover {
    border-color: var(--matrix-green-bright);
    box-shadow: var(--glow-bright);
    transform: translateY(-3px);
}

.playlist-card:focus-visible {
    outline: 3px solid var(--matrix-green-bright);
    outline-offset: 3px;
}

.playlist-card.active {
    border-color: var(--matrix-green-bright);
    box-shadow: 0 0 15px rgba(0, 255, 65, 0.6);
}

.playlist-card-art {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
    background: var(--bg-dark-primary);
}

.playlist-card-art-placeholder {
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-dark-primary);
    color: var(--matrix-green-dim);
    font-size: 3rem;
}

.playlist-card-info {
    padding: 0.6rem 0.75rem;
}

.playlist-card-name {
    color: var(--matrix-green-bright);
    text-shadow: var(--glow-bright);
    font-size: 0.9rem;
    font-weight: bold;
    margin: 0 0 0.25rem 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.playlist-card-desc {
    color: var(--matrix-green-dark);
    font-size: 0.7rem;
    margin: 0 0 0.25rem 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.playlist-card-count {
    color: var(--matrix-green-dim);
    font-size: 0.7rem;
    margin: 0;
}

/* Responsive: smaller cards on mobile */
@media (max-width: 767px) {
    .playlist-selector {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 0.75rem;
    }

    .playlist-card-art-placeholder {
        font-size: 2rem;
    }

    .playlist-card-name {
        font-size: 0.8rem;
    }
}


/* ============================================
   Share Button
   ============================================ */
.share-btn {
    width: 40px;
    height: 40px;
    background: var(--bg-dark-tertiary);
    border: 2px solid var(--matrix-green-dark);
    border-radius: 50%;
    color: var(--matrix-green-dark);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--glow-dark);
    margin-left: 0.5rem;
}

.share-btn:hover {
    background: var(--matrix-green-dark);
    color: var(--bg-dark-primary);
    box-shadow: 0 0 15px rgba(0, 143, 17, 0.8);
    transform: scale(1.1);
}

.share-btn:focus-visible {
    outline: 3px solid var(--matrix-green-bright);
    outline-offset: 3px;
}

.share-btn.copied {
    border-color: var(--matrix-green-bright);
    color: var(--matrix-green-bright);
    box-shadow: var(--glow-bright);
}

/* ============================================
   Keyboard Shortcut Hint
   ============================================ */
.keyboard-hint {
    text-align: center;
    margin-top: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--matrix-green-dim);
    cursor: pointer;
    transition: color 0.2s ease;
}

.keyboard-hint:hover {
    color: var(--matrix-green-bright);
    text-shadow: var(--glow-bright);
}

.keyboard-hint:focus-visible {
    outline: 2px solid var(--matrix-green-bright);
    outline-offset: 3px;
    border-radius: 3px;
}

.keyboard-hint i {
    margin-right: 0.3rem;
}

/* ============================================
   Keyboard Help Overlay
   ============================================ */
.keyboard-help-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.keyboard-help-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.keyboard-help-panel {
    background: var(--bg-dark-secondary);
    border: 2px solid var(--matrix-green-bright);
    border-radius: 8px;
    box-shadow: 0 0 30px rgba(0, 255, 65, 0.4);
    width: 90%;
    max-width: 400px;
    font-family: var(--font-mono);
    overflow: hidden;
}

.keyboard-help-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--matrix-green-dim);
}

.keyboard-help-header h3 {
    margin: 0;
    font-family: var(--font-tech);
    color: var(--matrix-green-bright);
    text-shadow: var(--glow-bright);
    font-size: 1.1rem;
}

.keyboard-help-close {
    background: none;
    border: none;
    color: var(--matrix-green-medium);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 0.25rem;
}

.keyboard-help-close:hover {
    color: var(--matrix-green-bright);
    text-shadow: var(--glow-bright);
}

.keyboard-help-body {
    padding: 1rem 1.25rem;
}

.shortcut-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0;
    color: var(--matrix-green-medium);
    font-size: 0.85rem;
}

.shortcut-row kbd {
    display: inline-block;
    min-width: 2.5rem;
    text-align: center;
    padding: 0.2rem 0.6rem;
    border: 1px solid var(--matrix-green-medium);
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    background: var(--bg-dark-tertiary);
    color: var(--matrix-green-bright);
    text-shadow: var(--glow-bright);
}

/* Hide keyboard hint on mobile */
@media (max-width: 767px) {
    .keyboard-hint {
        display: none;
    }
}
