/* Mooji Audio Player Styles */

.mooji-audio-player {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border-radius: 20px;
    padding: 30px;
    box-sizing: border-box;
    direction: ltr;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
}

.mooji-audio-player * {
    box-sizing: border-box;
}

/* Audio element hidden via CSS in iOS section */

.mooji-audio-content {
    display: flex;
    align-items: flex-start;
    gap: 40px;
    width: 100%;
}

/* Left Section - Cover */
.mooji-audio-left {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
}

.mooji-audio-cover-wrapper {
    position: relative;
    width: 200px;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Progress border */
.mooji-progress-border {
    position: absolute;
    border-radius: 28px;
    pointer-events: none;
    z-index: 1;
}

.mooji-progress-border svg {
    width: 100%;
    height: 100%;
}

.mooji-progress-border-bg {
    fill: none;
    stroke: #e0e0e0;
    stroke-width: 4;
}

.mooji-progress-border-progress {
    fill: none;
    stroke: #4361ee;
    stroke-width: 4;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.1s linear;
}

.mooji-audio-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 20px;
    position: relative;
    z-index: 2;
}

.mooji-audio-cover-placeholder {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.mooji-audio-cover-placeholder svg {
    width: 50%;
    height: 50%;
}

.mooji-progress-indicator {
    position: absolute;
    width: 12px;
    height: 12px;
    background: #4361ee;
    border-radius: 50%;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    transform: translate(-50%, -50%);
}

.mooji-audio-player.playing .mooji-progress-indicator {
    opacity: 1;
}

.mooji-audio-time {
    margin-top: 20px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.mooji-current-time {
    font-size: 14px;
    font-weight: 500;
    color: #4361ee;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Right Section */
.mooji-audio-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
}

.mooji-audio-info-row {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 15px;
}

.mooji-audio-meta {
    flex: 1;
    min-width: 0;
    text-align: center;
}

.mooji-audio-title {
    font-size: 24px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 8px 0;
    line-height: 1.2;
   
    text-align: center;
}

.mooji-audio-artist-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.mooji-audio-artist {
    font-size: 16px;
    color: #4361ee;
    font-weight: 500;
    
}

/* Waveform with time labels */
.mooji-waveform-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.mooji-time-label {
    font-size: 12px;
    font-weight: 500;
    color: #4361ee;
    min-width: 40px;
    flex-shrink: 0;
}

.mooji-time-label.elapsed {
    text-align: left;
}

.mooji-time-label.duration {
    text-align: right;
}

.mooji-waveform-container {
    flex: 1;
    padding: 10px 0;
    cursor: pointer;
}

.mooji-waveform {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2px;
    height: 50px;
    width: 100%;
}

.mooji-waveform-bar {
    flex: 1;
    background: #c5d5e0;
    border-radius: 2px;
    transition: background-color 0.1s;
    min-height: 4px;
    max-width: 4px;
}

.mooji-waveform-bar.active {
    background: #4361ee;
}

/* Controls */
.mooji-audio-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.mooji-control-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.mooji-control-btn:hover {
    background: #f0f0f0;
}

.mooji-control-btn:active {
    transform: scale(0.95);
}
.mooji-control-btn:focus {
    background-color: #fff0 !important;
}

.mooji-control-btn svg {
    width: 24px;
    height: 24px;
    fill: #1a1a2e;
    color: #1a1a2e;
    transition: fill 0.2s, color 0.2s, opacity 0.2s;
}

/* Faded buttons - all except play/pause */
.mooji-control-btn:not(.mooji-play-btn) svg {
    opacity: 0.4;
}

.mooji-control-btn:not(.mooji-play-btn):hover svg {
    opacity: 1;
    fill: #4361ee;
    color: #4361ee;
}

.mooji-control-btn.active svg {
    opacity: 1;
    fill: #4361ee;
    color: #4361ee;
}

.mooji-play-btn svg {
    width: 32px;
    height: 32px;
    opacity: 1;
}

.mooji-play-btn:hover svg {
    fill: #4361ee;
    color: #4361ee;
}

.mooji-backward-btn svg,
.mooji-forward-btn svg {
    width: 28px;
    height: 28px;
}

/* Volume Control - Horizontal Always Visible */
.mooji-volume-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mooji-volume-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.mooji-volume-btn:hover {
    background: #f0f0f0;
}

.mooji-volume-btn svg {
    width: 22px;
    height: 22px;
    fill: #1a1a2e;
    color: #1a1a2e;
    opacity: 0.4;
    transition: opacity 0.2s, fill 0.2s, color 0.2s;
}

.mooji-volume-btn:hover svg {
    opacity: 1;
    fill: #4361ee;
    color: #4361ee;
}

.mooji-volume-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 80px;
    height: 4px;
    background: #e0e0e0;
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.mooji-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    background: #4361ee;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.1s;
}

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

.mooji-volume-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: #4361ee;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* Playback Speed Button */
.mooji-speed-btn {
    background: rgba(0, 0, 0, 0.06);
    border: none;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: #1a1a2e;
    opacity: 0.4;
    min-width: 42px;
}

.mooji-speed-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    opacity: 1;
    color: #4361ee;
}

.mooji-speed-btn.active {
    opacity: 1;
    color: #4361ee;
    background: rgba(67, 97, 238, 0.1);
}

/* Loading state */
.mooji-audio-player.loading .mooji-play-btn svg {
    animation: mooji-pulse 1s infinite;
}

@keyframes mooji-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Placeholder for editor */
.mooji-audio-player-placeholder {
    padding: 40px;
    background: #f5f5f5;
    border: 2px dashed #ddd;
    text-align: center;
    border-radius: 8px;
}

.mooji-audio-player-placeholder p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .mooji-audio-content {
        flex-direction: column;
        align-items: center;
        gap: 25px;
    }
    
    .mooji-audio-left {
        width: 100%;
        max-width: 250px;
    }
    
    .mooji-audio-cover-wrapper {
        width: 180px;
        height: 180px;
    }
    
    .mooji-audio-right {
        width: 100%;
        align-items: center;
    }
    
    .mooji-audio-info-row {
        width: 100%;
        justify-content: center;
    }
    
    .mooji-audio-meta {
        text-align: center;
    }
    
    .mooji-audio-title {
        text-align: center;
        font-size: 20px;
    }
    
    .mooji-audio-artist-row {
        justify-content: center;
    }
    
    .mooji-waveform {
        height: 40px;
    }
    
    .mooji-audio-controls {
        gap: 12px;
        flex-wrap: wrap;
    }
    
    .mooji-control-btn svg {
        width: 22px;
        height: 22px;
    }
    
    .mooji-play-btn svg {
        width: 28px;
        height: 28px;
    }

    .mooji-volume-slider {
        width: 60px;
    }

    .mooji-speed-btn {
        font-size: 12px;
        padding: 5px 8px;
        min-width: 38px;
    }
}

@media (max-width: 480px) {
    .mooji-audio-player {
        padding: 20px;
    }
    
    .mooji-audio-cover-wrapper {
        width: 150px;
        height: 150px;
    }
    
    .mooji-audio-title {
        font-size: 18px;
    }
    
    .mooji-audio-artist {
        font-size: 14px;
    }
    
    .mooji-audio-controls {
        gap: 8px;
    }

    .mooji-time-label {
        font-size: 11px;
        min-width: 35px;
    }

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

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
    .mooji-control-btn {
        -webkit-appearance: none;
        -webkit-tap-highlight-color: transparent;
    }
    
    .mooji-volume-slider {
        -webkit-appearance: none;
    }
    
    .mooji-audio-element {
        -webkit-transform: translateZ(0);
    }
    
    /* Ensure buttons are properly tappable on iOS */
    .mooji-play-btn {
        min-width: 44px;
        min-height: 44px;
    }
}

/* Loading state improvements */
.mooji-audio-player.loading .mooji-play-btn {
    pointer-events: none;
    opacity: 0.7;
}

.mooji-audio-player.loading .mooji-play-icon,
.mooji-audio-player.loading .mooji-pause-icon {
    animation: mooji-pulse 1s infinite;
}

/* Ensure audio element is properly hidden but accessible */
.mooji-audio-element {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
