

/* Modularer HTML5 Audio Player - CSS für mehrere Instanzen */

/* CSS Variablen für Farbpalette */
:root {
    --primary-gray: #696969;
    --brown-accent: #8B4513;
    --white: #FFFFFF;
    --hover-gray: #5a5a5a;
    --active-brown: #7a3d11;
    --light-gray: #f8f8f8;
    --border-gray: #e0e0e0;
    --dark-button-bg: #444444;
    --dark-button-hover: #555555;
}

/* Reset und Basis-Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Seiten-Layout */
.page-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: Arial, sans-serif;
    background-color: #f5f5f5;
    min-height: 100vh;
}

header {
    text-align: center;
    margin-bottom: 40px;
    color: var(--primary-gray);
}

header h1 {
    color: var(--brown-accent);
    margin-bottom: 10px;
}

main {
    display: grid;
    gap: 30px;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
}

.player-section {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.player-section h2 {
    margin-bottom: 15px;
    color: var(--brown-accent);
    text-align: center;
    font-size: 1.2em;
}

footer {
    text-align: center;
    margin-top: 40px;
    color: var(--primary-gray);
    font-size: 0.9em;
}

/* Hauptcontainer des Audio Players */
.audio-player {
    font-family: Arial, sans-serif;
    max-width: 100%;
    background-color: var(--primary-gray);
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    color: var(--white);
    margin: 0 auto;
}

/* Haupt-Player-Bereich */
.player-main {
    display: flex;
    align-items: center;
    padding: 15px;
    min-height: 90px;
    background-color: var(--primary-gray);
    position: relative;
    flex-wrap: wrap;
    gap: 10px;
}

/* Player Controls */
.player-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
}

.control-btn {
    background-color: var(--brown-accent);
    border: none;
    color: var(--white);
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.3s ease;
}

.control-btn:hover {
    background-color: var(--active-brown);
    transform: scale(1.05);
}

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

.control-btn:focus {
    outline: 2px solid var(--white);
    outline-offset: 2px;
}

/* Lautstärkeregelung */
.volume-control {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-left: 10px;
}

.volume-slider {
    width: 60px;
    height: 4px;
    background-color: var(--white);
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--brown-accent);
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.volume-slider::-webkit-slider-thumb:hover {
    background-color: var(--active-brown);
}

.volume-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--brown-accent);
    cursor: pointer;
    border: none;
    transition: background-color 0.3s ease;
}

.volume-slider::-moz-range-thumb:hover {
    background-color: var(--active-brown);
}

.volume-display {
    font-size: 10px;
    color: var(--white);
    min-width: 30px;
    text-align: center;
}

/* Aktueller Titel */
.current-track {
    flex: 1;
    text-align: center;
    font-weight: bold;
    font-size: 14px;
    color: var(--white);
    padding: 0 10px;
    min-width: 120px;
}

/* Playlist Toggle Button */
.playlist-toggle {
    background-color: var(--brown-accent);
    border: none;
    color: var(--white);
    width: 30px;
    height: 30px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
    flex: 0 0 auto;
}

.playlist-toggle:hover {
    background-color: var(--active-brown);
}

.playlist-toggle:focus {
    outline: 2px solid var(--white);
    outline-offset: 2px;
}

/* Playlist-Sektion */
.playlist-section {
    background-color: var(--white);
    color: var(--primary-gray);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.playlist-section.expanded {
    max-height: 300px;
    border-top: 1px solid var(--primary-gray);
}

.playlist-title {
    padding: 10px 15px 5px;
    font-size: 14px;
    font-weight: bold;
    color: var(--brown-accent);
    text-align: center;
}

/* Playlist */
.playlist {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 180px;
    overflow-y: auto;
}

.playlist-item {
    padding: 8px 15px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-gray);
    transition: all 0.2s ease;
    background-color: var(--white);
    color: var(--primary-gray);
    font-size: 13px;
    position: relative;
}

.playlist-item:hover {
    background-color: #f0f0f0;
    color: var(--brown-accent);
}

.playlist-item:focus {
    outline: 2px solid var(--brown-accent);
    outline-offset: -2px;
    background-color: #f0f0f0;
}

.playlist-item.active {
    background-color: var(--brown-accent);
    color: var(--white);
    font-weight: bold;
}

.playlist-item.active::before {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 6px solid currentColor;
    border-top: 3px solid transparent;
    border-bottom: 3px solid transparent;
    margin-right: 8px;
    vertical-align: middle;
}

.playlist-item:last-child {
    border-bottom: none;
}

/* Playlist-Steuerungsbuttons - VERBESSERTE VERSION */
.playlist-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    padding: 15px;
    background-color: var(--light-gray);
    border-top: 1px solid var(--border-gray);
}

.playlist-btn {
    background-color: var(--dark-button-bg);
    border: none;
    color: var(--white);
    width: 35px;
    height: 35px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.playlist-btn:hover {
    background-color: var(--dark-button-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.playlist-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.playlist-btn:focus {
    outline: 2px solid var(--brown-accent);
    outline-offset: 2px;
}

.playlist-btn.active {
    background-color: var(--brown-accent);
    box-shadow: 0 4px 8px rgba(139, 69, 19, 0.3);
}

.playlist-btn.active:hover {
    background-color: var(--active-brown);
}

/* SVG Icons in Buttons */
.playlist-btn svg {
    width: 18px;
    height: 18px;
    pointer-events: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    .page-container {
        padding: 10px;
    }
    
    main {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .player-section {
        padding: 15px;
    }
    
    .player-main {
        flex-direction: column;
        height: auto;
        gap: 15px;
        padding: 15px;
        text-align: center;
    }
    
    .player-controls {
        order: 2;
        justify-content: center;
    }
    
    .current-track {
        order: 1;
        text-align: center;
        min-width: auto;
    }
    
    .playlist-toggle {
        order: 3;
        align-self: center;
    }
    
    .volume-control {
        margin-left: 0;
    }
    
    .playlist-section.expanded {
        max-height: 250px;
    }
    
    .playlist-controls {
        gap: 12px;
        padding: 12px;
    }
    
    .playlist-btn {
        width: 32px;
        height: 32px;
    }
    
    .playlist-btn svg {
        width: 16px;
        height: 16px;
    }
}

@media (max-width: 480px) {
    .volume-slider {
        width: 50px;
    }
    
    .control-btn {
        width: 32px;
        height: 32px;
    }
    
    .player-controls {
        gap: 8px;
    }
    
    .current-track {
        font-size: 13px;
    }
    
    .playlist-btn {
        width: 30px;
        height: 30px;
    }
    
    .playlist-btn svg {
        width: 14px;
        height: 14px;
    }
}

/* Scrollbar Styling für Playlist */
.playlist::-webkit-scrollbar {
    width: 6px;
}

.playlist::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.playlist::-webkit-scrollbar-thumb {
    background: var(--primary-gray);
    border-radius: 3px;
}

.playlist::-webkit-scrollbar-thumb:hover {
    background: var(--brown-accent);
}

/* Animation für Playlist Toggle */
.toggle-icon {
    transition: transform 0.3s ease;
}

.playlist-section.expanded + .player-main .toggle-icon {
    transform: rotate(180deg);
}

/* Ladeanzeige für Tracks */
.loading {
    opacity: 0.6;
    pointer-events: none;
    animation: pulse 1.5s ease-in-out infinite alternate;
}

@keyframes pulse {
    from { opacity: 0.6; }
    to { opacity: 0.3; }
}

/* CSS-based Icons - Cross-browser Compatible */

/* Play Icon - Right-pointing triangle */
.icon-play {
    width: 0;
    height: 0;
    border-left: 8px solid currentColor;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    margin-left: 2px; /* Center triangle in button */
}

/* Pause Icon - Two vertical bars */
.icon-pause {
    position: relative;
    width: 8px;
    height: 10px;
}

.icon-pause::before,
.icon-pause::after {
    content: '';
    position: absolute;
    width: 3px;
    height: 10px;
    background-color: currentColor;
    border-radius: 1px;
}

.icon-pause::before {
    left: 0;
}

.icon-pause::after {
    right: 0;
}

/* Next Icon - Triangle with vertical line */
.icon-next {
    position: relative;
    display: flex;
    align-items: center;
    width: 12px;
    height: 10px;
}

.icon-next::before {
    content: '';
    width: 0;
    height: 0;
    border-left: 6px solid currentColor;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
}

.icon-next::after {
    content: '';
    width: 2px;
    height: 10px;
    background-color: currentColor;
    border-radius: 1px;
    margin-left: 1px;
}

/* Playlist Icon - Three horizontal lines */
.icon-playlist {
    position: relative;
    width: 10px;
    height: 8px;
}

.icon-playlist::before,
.icon-playlist::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 2px;
    background-color: currentColor;
    border-radius: 1px;
}

.icon-playlist::before {
    top: 0;
}

.icon-playlist::after {
    bottom: 0;
}

.icon-playlist {
    background: linear-gradient(to right, currentColor 0%, currentColor 100%);
    background-size: 100% 2px;
    background-position: center;
    background-repeat: no-repeat;
}

/* Dark Mode Support (optional) */
@media (prefers-color-scheme: dark) {
    .page-container {
        background-color: #1a1a1a;
        color: var(--white);
    }
    
    .player-section {
        background-color: #2a2a2a;
    }
    
    .playlist-section {
        background-color: #2a2a2a;
        color: var(--white);
    }
    
    .playlist-item {
        background-color: #2a2a2a;
        color: var(--white);
        border-bottom-color: #444;
    }
    
    .playlist-item:hover {
        background-color: #3a3a3a;
    }
    
    .playlist-controls {
        background-color: #333;
        border-top-color: #444;
    }
    
    header h1,
    .player-section h2 {
        color: var(--brown-accent);
    }
}

/* Hover-Effekte für bessere UX */
@media (hover: hover) {
    .control-btn:hover,
    .playlist-toggle:hover,
    .playlist-btn:hover {
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    }
}

/* Print-Styles (verstecke Player beim Drucken) */
@media print {
    .audio-player {
        display: none;
    }
}

