/* Audio Player - Modern Spotify/YouTube Music inspired design */

.audio-player-wrapper {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 99;
    max-width: 600px;
    width: calc(100% - 40px);
    padding: 0 20px;
}

.audio-player {
    background: var(--paper-card-bg);
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(53, 43, 37, 0.2);
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
}

/* Main control row */
.audio-player-main {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Buttons */
.audio-btn {
    background: none;
    border: none;
    color: var(--paper-text);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    width: 40px;
    height: 40px;
}

.audio-btn:hover:not(:disabled) {
    background: rgba(125, 90, 60, 0.1);
    color: var(--paper-accent);
}

.audio-btn:active:not(:disabled) {
    transform: scale(0.95);
}

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

/* Play/Pause button - larger and more prominent */
.play-pause-btn {
    background: var(--paper-accent);
    color: white;
    font-size: 1.2rem;
    width: 48px;
    height: 48px;
}

.play-pause-btn:hover:not(:disabled) {
    background: #6a4a30;
    color: white;
    transform: scale(1.05);
}

/* Seek bar container */
.seek-bar-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.seek-bar {
    width: 100%;
    height: 6px;
    background: rgba(125, 90, 60, 0.15);
    border-radius: 3px;
    position: relative;
    cursor: pointer;
    transition: height 0.2s;
}

.seek-bar:hover {
    height: 8px;
}

.seek-bar-progress {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: var(--paper-accent);
    border-radius: 3px;
    transition: width 0.1s linear;
}

.seek-bar-thumb {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 14px;
    height: 14px;
    background: var(--paper-accent);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.seek-bar:hover .seek-bar-thumb {
    opacity: 1;
}

/* Time display */
.time-display {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--paper-secondary);
    font-family: 'Courier New', monospace;
}

.time-separator {
    opacity: 0.5;
}

/* Volume controls */
.volume-control {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.volume-slider-container {
    position: absolute;
    right: 0;
    bottom: 100%;
    margin-bottom: 8px;
    background: var(--paper-card-bg);
    border-radius: 8px;
    padding: 12px 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.volume-slider-container.visible {
    opacity: 1;
    pointer-events: auto;
}

.volume-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 80px;
    height: 6px;
    background: rgba(125, 90, 60, 0.15);
    border-radius: 3px;
    outline: none;
    transform: rotate(-90deg);
    transform-origin: center;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: var(--paper-accent);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.volume-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: var(--paper-accent);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.volume-slider::-webkit-slider-thumb:hover {
    background: #6a4a30;
    transform: scale(1.1);
}

.volume-slider::-moz-range-thumb:hover {
    background: #6a4a30;
    transform: scale(1.1);
}

/* Track selector / label */
.audio-player-track-selector {
    display: flex;
    justify-content: center;
    padding-top: 4px;
    border-top: 1px solid rgba(125, 90, 60, 0.1);
}

.track-selector {
    background: rgba(125, 90, 60, 0.08);
    border: 1px solid rgba(125, 90, 60, 0.2);
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 0.85rem;
    color: var(--paper-text);
    cursor: pointer;
    outline: none;
    transition: all 0.2s;
    font-family: 'Lora', Georgia, serif;
}

.track-selector:hover {
    background: rgba(125, 90, 60, 0.15);
    border-color: var(--paper-accent);
}

.track-selector:focus {
    border-color: var(--paper-accent);
    box-shadow: 0 0 0 3px rgba(125, 90, 60, 0.1);
}

.audio-player-track-label {
    text-align: center;
    font-size: 0.85rem;
    color: var(--paper-secondary);
    padding-top: 4px;
    border-top: 1px solid rgba(125, 90, 60, 0.1);
    font-family: 'Lora', Georgia, serif;
}

/* Loading state */
.audio-player-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(250, 246, 241, 0.95);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 0.9rem;
    color: var(--paper-secondary);
}

.audio-player-loading i {
    font-size: 1.2rem;
    color: var(--paper-accent);
}

/* Error state */
.audio-player-error {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(250, 246, 241, 0.95);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 0.9rem;
    color: #c44536;
    padding: 0 20px;
    text-align: center;
}

.audio-player-error i {
    font-size: 1.2rem;
}

/* Hide player in presentation mode */
body.presentation-mode .audio-player-wrapper {
    display: none !important;
}

/* Mobile responsive */
@media screen and (max-width: 768px) {
    .audio-player-wrapper {
        bottom: 70px;
        width: calc(100% - 24px);
        padding: 0 12px;
    }

    .audio-player {
        padding: 12px 16px;
        gap: 10px;
    }

    .audio-player-main {
        gap: 12px;
    }

    .play-pause-btn {
        width: 44px;
        height: 44px;
        font-size: 1.1rem;
    }

    .audio-btn {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    .time-display {
        font-size: 0.8rem;
    }

    /* Mobile: horizontal volume slider, always visible */
    .volume-slider-container {
        position: static;
        opacity: 1;
        pointer-events: auto;
        background: none;
        box-shadow: none;
        padding: 0;
        margin: 0;
    }

    .volume-slider {
        transform: none;
        width: 60px;
        height: 4px;
    }

    .volume-slider::-webkit-slider-thumb {
        width: 12px;
        height: 12px;
    }

    .volume-slider::-moz-range-thumb {
        width: 12px;
        height: 12px;
    }

    .seek-bar {
        height: 8px;
    }

    .seek-bar:hover {
        height: 10px;
    }

    .seek-bar-thumb {
        opacity: 1;
        width: 12px;
        height: 12px;
    }

    .audio-player-track-selector,
    .audio-player-track-label {
        font-size: 0.8rem;
    }
}

/* Tablet adjustments */
@media screen and (min-width: 769px) and (max-width: 1024px) {
    .audio-player-wrapper {
        max-width: 550px;
    }
}

/* Animation for player appearance */
@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.audio-player-wrapper {
    animation: slideUpFade 0.3s ease-out;
}

/* Accessibility improvements */
.audio-btn:focus {
    outline: 2px solid var(--paper-accent);
    outline-offset: 2px;
}

.seek-bar:focus-within {
    outline: 2px solid var(--paper-accent);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .audio-player {
        border: 2px solid var(--paper-text);
    }

    .seek-bar-progress,
    .play-pause-btn {
        outline: 1px solid var(--paper-text);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .audio-player-wrapper {
        animation: none;
    }

    .audio-btn,
    .seek-bar,
    .seek-bar-thumb,
    .volume-slider-container {
        transition: none;
    }
}
