/**
 * CM Audio Reader - Stylesheet
 * Minimalistisches, literarisches Design für Septembernebel
 */

/* Wrapper */
.cm-audio-reader-wrapper {
    margin: 2rem 0;
    padding: 1.5rem;
    background: #f9f9f9;
    border-left: 3px solid #333;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Controls Container */
.cm-audio-reader-controls {
    display: flex;
    align-items: flex-start;
    gap: 2rem;
    margin-bottom: 1rem;
}

/* Linke Seite: Buttons + Voice */
.cm-audio-controls-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    flex: 1 1 50%;
    max-width: 50%;
}

/* Rechte Seite: Slider */
.cm-audio-controls-right {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex: 1 1 50%;
    max-width: 50%;
}

/* Buttons - Basis-Styling */
.cm-audio-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    color: #333;
    transition: all 0.2s ease;
    outline: none;
}

.cm-audio-btn:hover:not(:disabled) {
    background: #333;
    color: #fff;
    border-color: #333;
}

.cm-audio-btn:active:not(:disabled) {
    transform: translateY(1px);
}

.cm-audio-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f5f5f5;
}

/* Button Icons */
.cm-audio-icon {
    font-size: 1rem;
    line-height: 1;
}

/* Spezifische Button-Styles */
.cm-audio-play {
    background: #333;
    color: #fff;
    border-color: #333;
}

.cm-audio-play:hover:not(:disabled) {
    background: #000;
    border-color: #000;
}

.cm-audio-play:disabled {
    background: #333;
    color: #fff;
    border-color: #333;
    opacity: 1;
}

.cm-audio-pause:not(:disabled) {
    background: #fff;
    color: #333;
}

.cm-audio-stop:not(:disabled) {
    background: #fff;
    color: #333;
}

/* Voice Control */
.cm-audio-voice-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1 1 auto;
    min-width: 200px;
    max-width: 400px;
}

.cm-audio-voice-control label {
    font-size: 0.9rem;
    color: #666;
    font-weight: 500;
    white-space: nowrap;
}

.cm-audio-voice-select {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    color: #333;
    font-size: 0.9rem;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s ease;
    flex: 1;
    max-width: 70%;
}

.cm-audio-voice-select:hover {
    border-color: #333;
}

.cm-audio-voice-select:focus {
    border-color: #333;
}

/* Individual Slider Control */
.cm-audio-slider-control {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    width: 100%;
}

.cm-audio-slider-control label {
    font-size: 0.85rem;
    color: #666;
    font-weight: 500;
}

/* Range Slider Styling */
.cm-audio-slider {
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

/* Slider Track - WebKit (Chrome, Safari, Edge) */
.cm-audio-slider::-webkit-slider-track {
    width: 100%;
    height: 4px;
    background: #ddd;
    border-radius: 2px;
}

/* Slider Thumb - WebKit */
.cm-audio-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #333;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cm-audio-slider:hover::-webkit-slider-thumb {
    background: #000;
    transform: scale(1.1);
}

.cm-audio-slider:disabled::-webkit-slider-thumb {
    background: #aaa;
    cursor: not-allowed;
    transform: none;
}

/* Slider Track - Firefox */
.cm-audio-slider::-moz-range-track {
    width: 100%;
    height: 4px;
    background: #ddd;
    border-radius: 2px;
}

/* Slider Thumb - Firefox */
.cm-audio-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border: none;
    border-radius: 50%;
    background: #333;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cm-audio-slider:hover::-moz-range-thumb {
    background: #000;
    transform: scale(1.1);
}

.cm-audio-slider:disabled::-moz-range-thumb {
    background: #aaa;
    cursor: not-allowed;
    transform: none;
}

/* Disabled State */
.cm-audio-slider:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Status */
.cm-audio-status {
    padding: 0.5rem 0;
}

.cm-audio-status-text {
    font-size: 0.9rem;
    color: #666;
    font-style: italic;
}

/* Status-Klassen für Wrapper */
.cm-audio-reader-wrapper.is-playing .cm-audio-status-text {
    color: #2ecc71;
    font-weight: 500;
}

.cm-audio-reader-wrapper.is-paused .cm-audio-status-text {
    color: #f39c12;
    font-weight: 500;
}

/* Fehlermeldung */
.cm-audio-error {
    padding: 1rem;
    background: #fee;
    border: 1px solid #fcc;
    border-radius: 4px;
    color: #c33;
}

.cm-audio-error p {
    margin: 0;
    font-size: 0.95rem;
}

/* Plugin-Fehler (allgemein) */
.cm-audio-reader-error {
    padding: 1rem;
    background: #fee;
    border: 1px solid #fcc;
    border-radius: 4px;
    color: #c33;
    font-size: 0.95rem;
}

/* Responsive Design - unter 600px alles untereinander */
@media (max-width: 600px) {
    .cm-audio-reader-wrapper {
        padding: 1rem;
        margin: 1.5rem 0;
    }

    .cm-audio-reader-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .cm-audio-controls-left {
        flex-direction: column;
        gap: 0.5rem;
        max-width: 100%;
        flex: 1 1 100%;
    }

    .cm-audio-btn {
        width: 100%;
        justify-content: center;
    }

    .cm-audio-voice-control {
        width: 100%;
        max-width: 100%;
    }

    .cm-audio-voice-select {
        flex: 1;
        min-width: auto;
        max-width: 80%;
    }

    .cm-audio-controls-right {
        width: 100%;
        min-width: auto;
        max-width: 100%;
        flex: 1 1 100%;
    }

    .cm-audio-slider-control {
        width: 100%;
    }
}

/* Accessibility */
.cm-audio-btn:focus {
    outline: 2px solid #333;
    outline-offset: 2px;
}

/* Print-Styles */
@media print {
    .cm-audio-reader-wrapper {
        display: none;
    }
}

/* Dark Mode Support (optional) */
@media (prefers-color-scheme: dark) {
    .cm-audio-reader-wrapper {
        background: #1a1a1a;
        border-left-color: #ddd;
    }

    .cm-audio-btn {
        background: #2a2a2a;
        border-color: #444;
        color: #ddd;
    }

    .cm-audio-btn:hover:not(:disabled) {
        background: #fff;
        color: #333;
        border-color: #fff;
    }

    .cm-audio-btn:disabled {
        background: #1a1a1a;
        opacity: 0.4;
    }

    .cm-audio-play {
        background: #ddd;
        color: #333;
        border-color: #ddd;
    }

    .cm-audio-play:hover:not(:disabled) {
        background: #fff;
        border-color: #fff;
    }

    .cm-audio-voice-select {
        background: #2a2a2a;
        border-color: #444;
        color: #ddd;
    }

    .cm-audio-voice-control label {
        color: #aaa;
    }

    .cm-audio-speed-select {
        background: #2a2a2a;
        border-color: #444;
        color: #ddd;
    }

    .cm-audio-slider-control label {
        color: #aaa;
    }

    .cm-audio-slider {
        background: #444;
    }

    .cm-audio-slider::-webkit-slider-track {
        background: #444;
    }

    .cm-audio-slider::-webkit-slider-thumb {
        background: #ddd;
    }

    .cm-audio-slider:hover::-webkit-slider-thumb {
        background: #fff;
    }

    .cm-audio-slider::-moz-range-track {
        background: #444;
    }

    .cm-audio-slider::-moz-range-thumb {
        background: #ddd;
    }

    .cm-audio-slider:hover::-moz-range-thumb {
        background: #fff;
    }

    .cm-audio-status-text {
        color: #aaa;
    }

    .cm-audio-reader-wrapper.is-playing .cm-audio-status-text {
        color: #2ecc71;
    }

    .cm-audio-reader-wrapper.is-paused .cm-audio-status-text {
        color: #f39c12;
    }
}

/* ========================================
   SIMPLE AUDIO READER
   ======================================== */

/* Simple Wrapper */
.cm-audio-reader-simple-wrapper {
    margin: 1.5rem 0;
    display: inline-block;
}

/* Simple Play/Pause Button */
.cm-audio-simple-play-pause {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.5rem;
    background: #333;
    border: 1px solid #333;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    color: #fff;
    transition: all 0.2s ease;
    outline: none;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.cm-audio-simple-play-pause:hover:not(:disabled) {
    background: #000;
    border-color: #000;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.cm-audio-simple-play-pause:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: none;
}

.cm-audio-simple-play-pause:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #666;
    border-color: #666;
}

/* Simple Button Icon */
.cm-audio-simple-icon {
    font-size: 1rem;
    line-height: 1;
}

/* Simple Button Label */
.cm-audio-simple-label {
    font-size: 0.95rem;
}

/* Playing State */
.cm-audio-simple-play-pause.is-playing {
    background: #2ecc71;
    border-color: #2ecc71;
}

.cm-audio-simple-play-pause.is-playing:hover:not(:disabled) {
    background: #27ae60;
    border-color: #27ae60;
}

/* Accessibility */
.cm-audio-simple-play-pause:focus {
    outline: 2px solid #333;
    outline-offset: 2px;
}

/* Print-Styles */
@media print {
    .cm-audio-reader-simple-wrapper {
        display: none;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .cm-audio-simple-play-pause {
        background: #ddd;
        color: #333;
        border-color: #ddd;
    }

    .cm-audio-simple-play-pause:hover:not(:disabled) {
        background: #fff;
        border-color: #fff;
    }

    .cm-audio-simple-play-pause:disabled {
        background: #444;
        border-color: #444;
        color: #888;
    }

    .cm-audio-simple-play-pause.is-playing {
        background: #2ecc71;
        border-color: #2ecc71;
        color: #fff;
    }

    .cm-audio-simple-play-pause.is-playing:hover:not(:disabled) {
        background: #27ae60;
        border-color: #27ae60;
    }

    .cm-audio-simple-play-pause:focus {
        outline-color: #ddd;
    }
}
