/* Chiptune Challenge 2026 - Audio Player Styles */

/*
 * THEME CUSTOMIZATION - Player Handle Icons
 *
 * The handle icon is set via the `handle_icon` template variable from
 * THEME_HANDLE_ICONS in chiptune_views.py. Each monthly theme has its
 * own icon character.
 *
 * CSS Variables (set in theme :root):
 *   --chiptune-handle-size: 20px              Handle width/height
 *   --chiptune-handle-bg: #ff6b9d             Background color or gradient
 *   --chiptune-handle-radius: 50%             Border radius (50% = circle)
 *   --chiptune-handle-icon-size: 12px         Icon font size
 *   --chiptune-handle-icon-color: #fff        Icon color
 *   --chiptune-handle-icon-shadow: none       Icon text-shadow
 *   --chiptune-handle-glow: rgba(...)         Box-shadow glow color
 *
 *   (Same properties with 'volume-handle' prefix for volume slider)
 *
 * Icons by theme (defined in chiptune_views.py THEME_HANDLE_ICONS):
 *   January:   ★ (star)      July:      ★ (star)
 *   February:  ♥ (heart)     August:    ~ (wave)
 *   March:     ⚔ (swords)    September: ◆ (diamond)
 *   April:     ♪ (note)      October:   ☠ (skull)
 *   May:       ● (coin)      November:  ⚔ (swords)
 *   June:      ▶ (arrow)     December:  ★ (star)
 */

.chiptune-player {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--chiptune-player-bg, rgba(0, 0, 0, 0.95));
    border-top: 1px solid var(--chiptune-border, rgba(255, 255, 255, 0.1));
    backdrop-filter: blur(20px);
    z-index: 1000;
}

.player-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.75rem 2rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

/* Song Info */
.player-song-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 200px;
}

.player-cover {
    width: 48px;
    height: 48px;
    border-radius: 4px;
    object-fit: cover;
}

.player-details {
    display: flex;
    flex-direction: column;
}

.player-title {
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.player-date {
    font-size: 0.75rem;
    color: var(--chiptune-text-secondary, rgba(255, 255, 255, 0.6));
}

/* Controls */
.player-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.player-btn {
    background: transparent;
    border: none;
    color: var(--chiptune-text, #fff);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.player-btn:hover:not(:disabled) {
    background: var(--chiptune-surface, rgba(255, 255, 255, 0.1));
    color: var(--chiptune-primary, #ff6b9d);
}

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

.player-btn.play-pause {
    background: var(--chiptune-primary, #ff6b9d);
    width: 40px;
    height: 40px;
}

.player-btn.play-pause:hover {
    background: var(--chiptune-primary-hover, #ff4785);
    transform: scale(1.05);
}

.player-btn svg {
    fill: currentColor;
}

/* Progress */
.player-progress {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.player-time {
    font-size: 0.75rem;
    color: var(--chiptune-text-secondary, rgba(255, 255, 255, 0.6));
    min-width: 40px;
}

.player-time.current {
    text-align: right;
}

.player-progress-bar {
    flex: 1;
    height: 6px;
    background: var(--chiptune-surface, rgba(255, 255, 255, 0.1));
    border-radius: 3px;
    cursor: pointer;
    position: relative;
    /* Expand clickable area */
    padding: 8px 0;
    margin: -8px 0;
    background-clip: content-box;
}

.player-progress-fill {
    height: 6px;
    background: var(--chiptune-primary, #ff6b9d);
    border-radius: 3px;
    pointer-events: none;
    position: absolute;
    top: 8px;
    left: 0;
}

.player-progress-handle {
    position: absolute;
    top: 11px;  /* Center of visible track: 8px padding + 3px (half of 6px track) */
    transform: translate(-50%, -50%);
    width: var(--chiptune-handle-size, 14px);
    height: var(--chiptune-handle-size, 14px);
    background: var(--chiptune-handle-bg, var(--chiptune-primary, #ff6b9d));
    border-radius: var(--chiptune-handle-radius, 50%);
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: none;
    box-shadow: 0 0 8px var(--chiptune-handle-glow, var(--chiptune-primary, #ff6b9d));
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Icon element inside handle - icon set via template variable */
.player-progress-handle .handle-icon {
    font-size: var(--chiptune-handle-icon-size, 10px);
    line-height: 1;
    color: var(--chiptune-handle-icon-color, #fff);
    text-shadow: var(--chiptune-handle-icon-shadow, none);
}

.player-progress-bar:hover .player-progress-handle,
.player-progress-handle.dragging {
    opacity: 1;
}

.player-progress-handle.dragging {
    transform: translate(-50%, -50%) scale(1.2);
}

/* Volume */
.player-volume {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 120px;
}

.player-volume-slider {
    width: 80px;
    height: 6px;
    background: var(--chiptune-surface, rgba(255, 255, 255, 0.1));
    border-radius: 3px;
    cursor: pointer;
    position: relative;
    /* Expand clickable area */
    padding: 6px 0;
    margin: -6px 0;
    background-clip: content-box;
}

.player-volume-fill {
    height: 6px;
    background: var(--chiptune-primary, #ff6b9d);
    border-radius: 3px;
    pointer-events: none;
    position: absolute;
    top: 6px;
    left: 0;
}

.player-volume-handle {
    position: absolute;
    top: 9px;  /* Center of visible track: 6px padding + 3px (half of 6px track) */
    transform: translate(-50%, -50%);
    width: var(--chiptune-volume-handle-size, 12px);
    height: var(--chiptune-volume-handle-size, 12px);
    background: var(--chiptune-volume-handle-bg, var(--chiptune-primary, #ff6b9d));
    border-radius: var(--chiptune-volume-handle-radius, 50%);
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: none;
    box-shadow: 0 0 6px var(--chiptune-volume-handle-glow, var(--chiptune-primary, #ff6b9d));
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Icon element inside handle - icon set via template variable */
.player-volume-handle .handle-icon {
    font-size: var(--chiptune-volume-handle-icon-size, 8px);
    line-height: 1;
    color: var(--chiptune-volume-handle-icon-color, #fff);
    text-shadow: var(--chiptune-volume-handle-icon-shadow, none);
}

.player-volume-slider:hover .player-volume-handle,
.player-volume-handle.dragging {
    opacity: 1;
}

.player-volume-handle.dragging {
    transform: translate(-50%, -50%) scale(1.2);
}

/* Responsive */
@media (max-width: 768px) {
    .player-content {
        padding: 0.5rem 1rem;
        gap: 1rem;
    }

    .player-song-info {
        min-width: 120px;
    }

    .player-cover {
        width: 40px;
        height: 40px;
    }

    .player-title {
        max-width: 80px;
        font-size: 0.75rem;
    }

    .player-date {
        display: none;
    }

    .player-volume {
        display: none;
    }

    .player-time {
        display: none;
    }

    .player-btn.prev,
    .player-btn.next {
        display: none;
    }
}

@media (max-width: 480px) {
    .player-content {
        padding: 0.5rem;
    }

    .player-song-info {
        min-width: auto;
        flex: 1;
    }

    .player-progress-bar {
        display: none;
    }
}
