/* Speech1C Light Theme Audio Player Styles */
.speech1c-audio-player {
    background: linear-gradient(135deg, #ffffff 0%, #f5f5f5 100%);
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    margin: 12px 0;
    position: relative;
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}

.speech1c-audio-player:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

/* Glass morphism overlay for light theme */
.speech1c-audio-player::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0.2) 100%);
    pointer-events: none;
}

/* Navigation Container */
.speech1c-nav-container {
    position: absolute;
    top: 4px;
    right: 12px;
    display: flex;
    gap: 6px;
    z-index: 10;
}

.speech1c-nav-button {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.08);
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.speech1c-nav-button:hover:not(:disabled) {
    background: rgba(0, 0, 0, 0.1);
    transform: scale(1.1);
}

.speech1c-nav-button:active:not(:disabled) {
    transform: scale(0.95);
}

.speech1c-nav-button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.speech1c-nav-button svg {
    width: 14px;
    height: 14px;
}

/* Title */
.speech1c-title {
    color: #333;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 0;
    display: block;
    text-decoration: none;
    position: relative;
    z-index: 5;
    line-height: 1.3;
    transition: color 0.3s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 170px;
}

.speech1c-title:hover {
    color: #667eea;
}

/* Main Controls */
.speech1c-controls {
    display: flex;
    align-items: stretch;
    gap: 12px;
    position: relative;
    z-index: 5;
}

/* Play/Pause Button */
.speech1c-play-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.3);
    flex-shrink: 0;
}

.speech1c-play-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 14px rgba(102, 126, 234, 0.4);
}

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

.speech1c-play-btn svg {
    width: 24px;
    height: 24px;
    color: white;
}

/* Right Container - holds title, progress, and bottom controls */
.speech1c-right-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    justify-content: center;
    min-width: 0;
    overflow: hidden;
}

/* Progress Container */
.speech1c-progress-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Progress info row - contains time and controls */
.speech1c-progress-info {
    display: flex;
    align-items: center;
    width: 100%;
}

/* Progress Bar Container */
.speech1c-progress-wrapper {
    position: relative;
    width: 100%;
    height: 6px;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 3px;
    overflow: visible;
    transition: height 0.2s ease;
}


.speech1c-progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 2px;
    width: 0%;
}

/* Custom Progress Bar Input */
.speech1c-progress {
    position: absolute;
    top: -5px;
    left: 0;
    width: 100%;
    height: 16px;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    outline: none;
    cursor: pointer;
    margin: 0;
    z-index: 2;
}

.speech1c-progress::-webkit-slider-track {
    width: 100%;
    height: 16px;
    background: transparent;
    cursor: pointer;
}

.speech1c-progress::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    margin-top: 0;
    opacity: 1;
}


.speech1c-progress::-moz-range-track {
    width: 100%;
    height: 16px;
    background: transparent;
    cursor: pointer;
}

.speech1c-progress::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: #667eea;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
    opacity: 1;
}

/* Buffer indicator */
.speech1c-progress-buffer {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 2px;
    width: 0%;
    transition: width 0.3s ease;
}

/* Time Display */
.speech1c-time {
    color: #666;
    font-size: 13px;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
    letter-spacing: 0.5px;
    flex-shrink: 0;
    min-width: 80px;
    display: flex;
    align-items: center;
}

/* Bottom Controls */
.speech1c-bottom-controls {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: nowrap;
    gap: 8px;
    margin-top: 0;
    position: relative;
    z-index: 5;
    width: 100%;
}

/* Controls group - time, volume, speed */
.speech1c-controls-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

@media (max-width: 480px) {
    .speech1c-bottom-controls {
        flex-wrap: wrap;
    }
}

/* Volume Container */
.speech1c-volume-container {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.05);
    padding: 4px 8px;
    border-radius: 20px;
    transition: background 0.3s ease;
    flex-shrink: 0;
}

.speech1c-volume-container:hover {
    background: rgba(0, 0, 0, 0.08);
}

.speech1c-volume-icon {
    color: #666;
    display: flex;
    align-items: center;
}

.speech1c-volume-icon svg {
    width: 16px;
    height: 16px;
}

/* Volume Slider */
.speech1c-volume-slider {
    width: 60px;
    height: 3px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.speech1c-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 10px;
    height: 10px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.speech1c-volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.speech1c-volume-slider::-moz-range-thumb {
    width: 10px;
    height: 10px;
    background: #667eea;
    border: none;
    border-radius: 50%;
    cursor: pointer;
}

/* Speed Control */
.speech1c-speed-container {
    position: relative;
    flex-shrink: 0;
}

.speech1c-speed-inline-container {
    display: inline-flex;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 20px;
    overflow: hidden;
    transition: background 0.3s ease;
    cursor: pointer;
    user-select: none;
    position: relative;
}

.speech1c-speed-inline-container:hover {
    background: rgba(0, 0, 0, 0.08);
}

.speech1c-speed-inline-option {
    padding: 4px 8px;
    color: #666;
    font-size: 11px;
    font-weight: 500;
    transition: color 0.3s ease, opacity 0.3s ease;
    white-space: nowrap;
    position: relative;
    background: transparent;
    border-radius: inherit;
    cursor: pointer;
}

.speech1c-speed-inline-option:hover {
    color: #666;
    background: rgba(0, 0, 0, 0.05);
}

.speech1c-speed-inline-option.active {
    color: #666;
    font-weight: 600;
}

.speech1c-speed-inline-container.expanded .speech1c-speed-inline-option.active {
    background: rgba(0, 0, 0, 0.1);
}

/* When collapsed, only show active option */
.speech1c-speed-inline-option[style*="display: none"] {
    display: none !important;
}

/* Attribution */
.speech1c-attribution {
    font-size: 10px;
    margin-left: auto;
    flex-shrink: 0;
}

.speech1c-attribution a {
    color: #666;
    text-decoration: none;
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 20px;
    display: inline-block;
    transition: all 0.3s ease;
    font-weight: 400;
}

.speech1c-attribution a:hover {
    background: rgba(0, 0, 0, 0.08);
    color: #666;
}

/* Loading State */
.speech1c-loading {
    color: #666;
    text-align: center;
    padding: 40px;
    font-size: 16px;
    position: relative;
    z-index: 5;
}

.speech1c-loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-left: 10px;
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: speech1c-spin 0.8s linear infinite;
}

@keyframes speech1c-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Yellow Theme Styles */
.speech1c-yellow-theme .speech1c-play-btn {
    background: #FAC81E;
}

.speech1c-yellow-theme .speech1c-play-btn:hover {
    background: #E6B91A;
}

.speech1c-yellow-theme .speech1c-play-btn:active {
    background: #D1A617;
}

.speech1c-yellow-theme .speech1c-progress-fill {
    background: #FAC81E;
}

.speech1c-yellow-theme .speech1c-progress::-webkit-slider-thumb {
    background: #FAC81E;
}

.speech1c-yellow-theme .speech1c-progress::-webkit-slider-thumb:hover {
    background: #E6B91A;
}

.speech1c-yellow-theme .speech1c-progress::-moz-range-thumb {
    background: #FAC81E;
}

.speech1c-yellow-theme .speech1c-progress-buffer {
    background: rgba(250, 200, 30, 0.1);
}

.speech1c-yellow-theme .speech1c-volume-slider::-webkit-slider-thumb {
    background: #FAC81E;
}

.speech1c-yellow-theme .speech1c-volume-slider::-webkit-slider-thumb:hover {
    background: #E6B91A;
}

.speech1c-yellow-theme .speech1c-volume-slider::-moz-range-thumb {
    background: #FAC81E;
}

.speech1c-yellow-theme .speech1c-nav-button:hover:not(:disabled) {
    border-color: #FAC81E;
    color: #E6B91A;
}

.speech1c-yellow-theme .speech1c-title:hover {
    color: #E6B91A;
}

.speech1c-yellow-theme .speech1c-volume-icon:hover {
    color: #666;
}

.speech1c-yellow-theme .speech1c-speed-inline-option:hover {
    color: #666;
}

.speech1c-yellow-theme .speech1c-speed-inline-option.active {
    color: #666;
}

.speech1c-yellow-theme .speech1c-speed-inline-container.expanded .speech1c-speed-inline-option.active {
    background: rgba(0, 0, 0, 0.1);
}

.speech1c-yellow-theme .speech1c-speed-inline-container:hover {
    border-color: #FAC81E;
}

.speech1c-yellow-theme .speech1c-volume-container:hover {
    border-color: #FAC81E;
}

/* Yellow Player Theme Styles (for .yellow_player wrapper) */
.yellow_player .speech1c-play-btn {
    background: linear-gradient(135deg, #fcf336 0%, #f4a533 100%);
    box-shadow: 0 3px 10px rgba(252, 243, 54, 0.3);
}

.yellow_player .speech1c-play-btn:hover {
    background: linear-gradient(135deg, #e6dc2f 0%, #de972e 100%);
    box-shadow: 0 4px 14px rgba(252, 243, 54, 0.4);
    transform: scale(1.1);
}

.yellow_player .speech1c-play-btn:active {
    background: linear-gradient(135deg, #d1c629 0%, #c9892a 100%);
    transform: scale(0.95);
}

.yellow_player .speech1c-play-btn svg {
    color: white;
}

.yellow_player .speech1c-progress-fill {
    background: #d63d26;
}

.yellow_player .speech1c-progress::-webkit-slider-thumb {
    background: #d63d26;
}

.yellow_player .speech1c-progress::-webkit-slider-thumb:hover {
    background: #bf3522;
    box-shadow: 0 2px 6px rgba(214, 61, 38, 0.4);
}

.yellow_player .speech1c-progress::-moz-range-thumb {
    background: #d63d26;
}

.yellow_player .speech1c-progress-buffer {
    background: rgba(214, 61, 38, 0.1);
}

.yellow_player .speech1c-volume-slider::-webkit-slider-thumb {
    background: #d63d26;
}

.yellow_player .speech1c-volume-slider::-webkit-slider-thumb:hover {
    background: #bf3522;
}

.yellow_player .speech1c-volume-slider::-moz-range-thumb {
    background: #d63d26;
}

.yellow_player .speech1c-nav-button:hover:not(:disabled) {
    border-color: #fcf336;
    color: #d63d26;
}

.yellow_player .speech1c-title:hover {
    color: #d63d26;
}

.yellow_player .speech1c-volume-icon:hover {
    color: #666;
}

.yellow_player .speech1c-speed-inline-option:hover {
    color: #666;
}

.yellow_player .speech1c-speed-inline-option.active {
    color: #666;
}

.yellow_player .speech1c-speed-inline-container.expanded .speech1c-speed-inline-option.active {
    background: rgba(0, 0, 0, 0.1);
}

.yellow_player .speech1c-speed-inline-container:hover {
    border-color: #fcf336;
}

.yellow_player .speech1c-volume-container:hover {
    border-color: #fcf336;
}

.yellow_player .speech1c-play-btn:focus-visible,
.yellow_player .speech1c-nav-button:focus-visible,
.yellow_player .speech1c-progress:focus-visible,
.yellow_player .speech1c-volume-slider:focus-visible {
    outline: 2px solid #fcf336;
    outline-offset: 2px;
}

/* Keyboard Focus Styles */
.speech1c-play-btn:focus-visible,
.speech1c-nav-button:focus-visible,
.speech1c-progress:focus-visible,
.speech1c-volume-slider:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.speech1c-yellow-theme .speech1c-play-btn:focus-visible,
.speech1c-yellow-theme .speech1c-nav-button:focus-visible,
.speech1c-yellow-theme .speech1c-progress:focus-visible,
.speech1c-yellow-theme .speech1c-volume-slider:focus-visible {
    outline: 2px solid #FAC81E;
    outline-offset: 2px;
}

/* Playlist Badge */
.speech1c-playlist-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #667eea;
    color: white;
    font-size: 9px;
    font-weight: 600;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    pointer-events: none;
}

.speech1c-yellow-theme .speech1c-playlist-badge {
    background: #FAC81E;
    color: #333;
}

.yellow_player .speech1c-playlist-badge {
    background: #d63d26;
    color: white;
}

/* Playlist Panel */
.speech1c-playlist-panel {
    background: rgba(255, 255, 255, 0.98);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    margin-top: 12px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 5;
}

.speech1c-playlist-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.03);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.speech1c-playlist-title {
    font-size: 12px;
    font-weight: 600;
    color: #333;
}

.speech1c-playlist-clear {
    font-size: 11px;
    color: #666;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.speech1c-playlist-clear:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #333;
}

.speech1c-playlist-items {
    max-height: 250px;
    overflow-y: auto;
}

.speech1c-playlist-empty {
    padding: 30px 12px;
    text-align: center;
    color: #999;
    font-size: 12px;
}

.speech1c-playlist-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    transition: background 0.2s ease;
    cursor: pointer;
}

.speech1c-playlist-item:hover {
    background: rgba(0, 0, 0, 0.03);
}

.speech1c-playlist-item.active {
    background: rgba(102, 126, 234, 0.1);
}

.speech1c-yellow-theme .speech1c-playlist-item.active {
    background: rgba(250, 200, 30, 0.15);
}

.yellow_player .speech1c-playlist-item.active {
    background: rgba(214, 61, 38, 0.1);
}

.speech1c-playlist-item-title {
    flex: 1;
    font-size: 12px;
    color: #333;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.speech1c-playlist-item.auto-added {
    opacity: 0.6;
}

.speech1c-playlist-item.auto-added .speech1c-playlist-item-title {
    font-style: italic;
    color: #666;
}

.speech1c-playlist-item-remove {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: #666;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    margin-left: 8px;
}

.speech1c-playlist-item-remove:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #333;
}

/* Responsive Design */
@media (max-width: 640px) {
    .speech1c-audio-player {
        padding: 10px;
        border-radius: 10px;
    }

    .speech1c-nav-container {
        top: 8px;
        right: 8px;
    }

    .speech1c-nav-button {
        width: 24px;
        height: 24px;
    }

    .speech1c-nav-button svg {
        width: 12px;
        height: 12px;
    }

    .speech1c-title {
        font-size: 13px;
        line-height: 1.2;
        padding-right: 140px;
    }

    .speech1c-controls {
        gap: 8px;
    }

    .speech1c-play-btn {
        width: 48px;
        height: 48px;
    }

    .speech1c-play-btn svg {
        width: 20px;
        height: 20px;
    }

    .speech1c-right-container {
        gap: 8px;
    }

    .speech1c-progress-container {
        gap: 8px;
    }

    .speech1c-bottom-controls {
        gap: 6px;
        flex-wrap: wrap;
    }

    .speech1c-time {
        font-size: 12px;
        min-width: 70px;
    }

    .speech1c-volume-container {
        padding: 3px 6px;
    }

    .speech1c-volume-slider {
        width: 50px;
    }

    .speech1c-volume-icon svg {
        width: 14px;
        height: 14px;
    }

    .speech1c-speed-inline-option {
        padding: 3px 6px;
        font-size: 10px;
    }

    .speech1c-attribution {
        font-size: 9px;
    }

    .speech1c-attribution a {
        padding: 3px 6px;
    }
}

/* Extra small screens - handle very long titles */
@media (max-width: 480px) {
    .speech1c-title {
        font-size: 12px;
        line-height: 1.2;
        padding-right: 120px;
    }

    .speech1c-nav-container {
        top: 6px;
        right: 6px;
    }

    .speech1c-nav-button {
        width: 22px;
        height: 22px;
    }

    .speech1c-nav-button svg {
        width: 11px;
        height: 11px;
    }

    .speech1c-play-btn {
        width: 44px;
        height: 44px;
    }

    .speech1c-play-btn svg {
        width: 18px;
        height: 18px;
    }
}

/* Tooltip for keyboard shortcuts */
.speech1c-tooltip {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 100;
}

.speech1c-play-btn:hover .speech1c-tooltip {
    opacity: 1;
}