/* =====================================================
   MLM Custom Media Player - iOS Glass Design
   Modern glass morphism design for audio/video players
===================================================== */

:root {
    --glass-stroke: rgba(255,255,255,0.22);
    --glass-shadow: 0 12px 36px rgba(0,0,0,0.28), inset 0 1px 0 rgba(255,255,255,0.25);
    --radius: 22px;
    --radius-lg: 26px;
    --fg: #fff;
    --fg-dim: rgba(255,255,255,0.75);
    --track: rgba(255,255,255,0.25);
}

/* Reset MediaElement.js styles */
.mejs-container {
    border-radius: 0 !important;
    box-shadow: none !important;
}

/* ==================== AUDIO PLAYER ==================== */
.mlm-custom-audio-player {
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Hide native audio controls and WordPress wrappers */
.wp-audio-shortcode,
.mejs-audio,
.mejs-container.mejs-audio {
    display: none !important;
}

.mlm-custom-audio-player ~ .wp-audio-shortcode,
.mlm-custom-audio-player ~ .mejs-audio,
.mlm-custom-audio-player ~ .mejs-container {
    display: none !important;
}

.mlm-custom-audio-player audio {
    position: absolute !important;
    opacity: 0 !important;
    pointer-events: none !important;
    width: 0 !important;
    height: 0 !important;
    visibility: hidden !important;
}

.mlm-custom-audio-player audio::-webkit-media-controls {
    display: none !important;
    -webkit-appearance: none !important;
}

.mlm-custom-audio-player audio::-webkit-media-controls-panel {
    display: none !important;
    -webkit-appearance: none !important;
}

.mlm-custom-audio-player audio::-webkit-media-controls-play-button {
    display: none !important;
    -webkit-appearance: none !important;
}

.mlm-custom-audio-player audio::-webkit-media-controls-start-playback-button {
    display: none !important;
    -webkit-appearance: none !important;
}

.mlm-custom-audio-player audio::-webkit-media-controls-enclosure {
    display: none !important;
}

.mlm-custom-audio-player audio::-webkit-media-controls-timeline {
    display: none !important;
}

.mlm-custom-audio-player audio::-webkit-media-controls-current-time-display {
    display: none !important;
}

.mlm-custom-audio-player audio::-webkit-media-controls-time-remaining-display {
    display: none !important;
}

.mlm-custom-audio-player audio::-webkit-media-controls-volume-slider {
    display: none !important;
}

.mlm-custom-audio-player audio::-webkit-media-controls-mute-button {
    display: none !important;
}

.mlm-custom-audio-player audio::-webkit-media-controls-fullscreen-button {
    display: none !important;
}

/* Player Header with Overlapping Circles - Audio Player */
.mlm-player-header {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    border-radius: 16px 16px 0 0;
    position: relative;
    overflow: hidden;
}

.mlm-player-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    animation: pulse 4s ease-in-out infinite;
    pointer-events: none;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

/* Overlapping Circles - Audio Player */
.mlm-player-avatars {
    position: relative;
    width: 110px;
    height: 80px;
    flex-shrink: 0;
}

.mlm-player-product-thumb {
    position: absolute;
    right: 0;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.9);
    object-fit: cover;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 1;
    transition: transform 0.3s ease;
}

.mlm-player-vendor-avatar {
    position: absolute;
    left: 0;
    top: 8px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 4px solid white;
    object-fit: cover;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
    z-index: 2;
    transition: transform 0.3s ease;
}

.mlm-player-header:hover .mlm-player-product-thumb,
.mlm-player-header:hover .mlm-player-vendor-avatar {
    transform: scale(1.05);
}

.mlm-player-info {
    flex: 1;
    color: white;
    min-width: 0;
}

.mlm-player-product-title {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mlm-player-product-title::before {
    content: '🎵';
    margin-left: 6px;
    font-size: 15px;
}

/* Like Button - Audio */
.mlm-player-like-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.mlm-player-like-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

.mlm-player-like-btn.liked {
    background: rgba(255, 71, 87, 0.3);
    border-color: #ff4757;
}

.mlm-player-like-icon {
    font-size: 22px;
    transition: transform 0.3s ease;
}

.mlm-player-like-btn.liked .mlm-player-like-icon {
    animation: heartBeat 0.6s ease;
}

.mlm-player-like-count {
    font-size: 11px;
    font-weight: 700;
    color: white;
}

@keyframes heartBeat {
    0%, 100% { transform: scale(1); }
    25% { transform: scale(1.3); }
    50% { transform: scale(1.1); }
}

/* Audio Visualizer */
.mlm-audio-visualizer {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 3px;
    height: 50px;
    padding: 10px 20px;
    background: rgba(44, 62, 80, 0.1);
    border-top: 1px solid rgba(44, 62, 80, 0.2);
}

.wave-bar {
    width: 4px;
    height: 10px;
    background: linear-gradient(to top, #2c3e50, #3498db);
    border-radius: 2px;
    animation: wave 1.2s ease-in-out infinite;
    transform-origin: bottom;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mlm-audio-visualizer.playing .wave-bar {
    opacity: 1;
}

.wave-bar:nth-child(1) { animation-delay: 0s; height: 15px; }
.wave-bar:nth-child(2) { animation-delay: 0.1s; height: 25px; }
.wave-bar:nth-child(3) { animation-delay: 0.2s; height: 35px; }
.wave-bar:nth-child(4) { animation-delay: 0.3s; height: 30px; }
.wave-bar:nth-child(5) { animation-delay: 0.4s; height: 20px; }
.wave-bar:nth-child(6) { animation-delay: 0.5s; height: 40px; }
.wave-bar:nth-child(7) { animation-delay: 0.6s; height: 25px; }
.wave-bar:nth-child(8) { animation-delay: 0.7s; height: 30px; }
.wave-bar:nth-child(9) { animation-delay: 0.8s; height: 20px; }
.wave-bar:nth-child(10) { animation-delay: 0.9s; height: 35px; }
.wave-bar:nth-child(11) { animation-delay: 1.0s; height: 25px; }
.wave-bar:nth-child(12) { animation-delay: 1.1s; height: 30px; }
.wave-bar:nth-child(13) { animation-delay: 1.2s; height: 20px; }
.wave-bar:nth-child(14) { animation-delay: 1.3s; height: 40px; }
.wave-bar:nth-child(15) { animation-delay: 1.4s; height: 25px; }
.wave-bar:nth-child(16) { animation-delay: 1.5s; height: 30px; }
.wave-bar:nth-child(17) { animation-delay: 1.6s; height: 20px; }
.wave-bar:nth-child(18) { animation-delay: 1.7s; height: 35px; }
.wave-bar:nth-child(19) { animation-delay: 1.8s; height: 25px; }
.wave-bar:nth-child(20) { animation-delay: 1.9s; height: 30px; }

@keyframes wave {
    0%, 100% { transform: scaleY(0.3); }
    50% { transform: scaleY(1); }
}

/* Audio Player Controls - Glass iOS Style */
.mlm-audio-controls {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(44, 62, 80, 0.15);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0 0 16px 16px;
    justify-content: space-between;
}

.mlm-audio-controls-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mlm-audio-controls-right {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
    justify-content: flex-end;
}

/* Audio Control Buttons */
.mlm-audio-btn {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    cursor: pointer;
    background: linear-gradient(145deg, rgba(255,255,255,0.16), rgba(255,255,255,0.06));
    border: 1px solid rgba(255,255,255,0.22);
    transition: transform 0.08s ease, background 0.2s ease;
}

.mlm-audio-btn:hover {
    background: rgba(255,255,255,0.25);
}

.mlm-audio-btn:active {
    transform: scale(0.97);
}

.mlm-audio-btn svg {
    width: 18px;
    height: 18px;
    fill: #fff;
    display: block;
}

/* Audio Progress Bar */
.mlm-audio-progress {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 120px;
    width: 45%;
    max-width: 520px;
}

.mlm-audio-progress-bar {
    position: relative;
    height: 8px;
    flex: 1;
    border-radius: 999px;
    background: var(--track);
    overflow: hidden;
    cursor: pointer;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.3);
}

.mlm-audio-progress-fill {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    transform-origin: left center;
    transform: scaleX(0);
    background: linear-gradient(90deg, #ff8c00, #ff6a00);
}

.mlm-audio-progress-handle {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid rgba(255,255,255,0.6);
    box-shadow: 0 4px 10px rgba(0,0,0,0.35);
    left: 0%;
}

/* Audio Time Display */
.mlm-audio-time {
    font-size: 12px;
    color: var(--fg-dim);
    min-width: 72px;
    text-align: center;
    font-weight: 500;
}

/* ==================== VIDEO PLAYER - iOS GLASS STYLE ==================== */
.mlm-custom-video-player {
    width: 100%;
    position: relative;
    overflow: visible;
    margin: 20px 0;
    font-family: ui-rounded, "Vazirmatn", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
}

/* Video Wrapper - No border, clean */
.mlm-custom-video-player .mlm-video-wrap {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    background: #000;
}

.mlm-custom-video-player video {
    display: block;
    width: 100%;
    height: auto;
    max-height: 64vh;
    background: #000;
}

/* Top Overlay Chip - Glass Style */
.mlm-video-overlay-top {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 1000;
    pointer-events: auto;
}

.mlm-video-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(255,255,255,0.18), rgba(255,255,255,0.08));
    border: 1px solid var(--glass-stroke);
    box-shadow: var(--glass-shadow);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.mlm-video-chip-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    flex: 0 0 34px;
    border: 1px solid rgba(255,255,255,0.35);
}

.mlm-video-chip-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    max-width: min(60vw, 520px);
}

.mlm-video-chip-product {
    font-size: 13px;
    color: var(--fg);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mlm-video-chip-product .hint {
    color: var(--fg-dim);
}

.mlm-video-chip-seller {
    font-size: 11px;
    color: var(--fg-dim);
}

/* Like button in chip */
.mlm-video-chip-like {
    margin-inline-start: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 12px;
    background: linear-gradient(145deg, rgba(255,255,255,0.16), rgba(255,255,255,0.06));
    border: 1px solid rgba(255,255,255,0.22);
    cursor: pointer;
    transition: all 0.2s ease;
}

.mlm-video-chip-like:hover {
    background: rgba(255,255,255,0.25);
    transform: scale(1.05);
}

.mlm-video-chip-like.active {
    background: rgba(255, 107, 129, 0.3);
    border-color: #ff6b81;
}

.mlm-video-chip-like svg {
    width: 18px;
    height: 18px;
    fill: #fff;
    transition: fill 0.2s ease, transform 0.15s;
}

.mlm-video-chip-like.active svg {
    fill: #ff6b81;
    transform: scale(1.07);
}

.mlm-video-chip-like .count {
    font-size: 13px;
    color: #fff;
    min-width: 1.5em;
    text-align: center;
    font-weight: 600;
}

/* Center Play Button - Glass Style */
.mlm-video-center-play {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    pointer-events: none;
    z-index: 100;
    transition: opacity 0.25s ease;
}

.mlm-video-center-play.hidden {
    opacity: 0;
    visibility: hidden;
}

.mlm-video-big-play-btn {
    pointer-events: auto;
    width: 76px;
    height: 76px;
    border-radius: 22px;
    background: linear-gradient(135deg, rgba(255,255,255,0.30), rgba(255,255,255,0.10));
    border: 1px solid var(--glass-stroke);
    box-shadow: var(--glass-shadow);
    display: grid;
    place-items: center;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    cursor: pointer;
    transition: all 0.2s ease;
}

.mlm-video-big-play-btn:hover {
    transform: scale(1.05);
    background: linear-gradient(135deg, rgba(255,255,255,0.35), rgba(255,255,255,0.15));
}

.mlm-video-big-play-btn:active {
    transform: scale(0.97);
}

.mlm-video-big-play-btn svg {
    width: 28px;
    height: 28px;
    fill: #fff;
}

/* Bottom Controls - Glass Style */
.mlm-video-controls {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 16px;
    background: rgba(0,0,0,0.38);
    border: 1px solid rgba(255,255,255,0.18);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    justify-content: space-between;
    z-index: 999;
}

.mlm-video-controls-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mlm-video-controls-right {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
    justify-content: flex-end;
}

/* Control Buttons */
.mlm-video-btn {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    cursor: pointer;
    background: linear-gradient(145deg, rgba(255,255,255,0.16), rgba(255,255,255,0.06));
    border: 1px solid rgba(255,255,255,0.22);
    transition: transform 0.08s ease, background 0.2s ease;
}

.mlm-video-btn:hover {
    background: rgba(255,255,255,0.25);
}

.mlm-video-btn:active {
    transform: scale(0.97);
}

.mlm-video-btn svg {
    width: 18px;
    height: 18px;
    fill: #fff;
    display: block;
}

/* Progress Bar */
.mlm-video-progress {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 120px;
    width: 40%;
    max-width: 520px;
}

.mlm-video-progress-bar {
    position: relative;
    height: 8px;
    flex: 1;
    border-radius: 999px;
    background: var(--track);
    overflow: hidden;
    cursor: pointer;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.3);
}

.mlm-video-progress-fill {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    transform-origin: left center;
    transform: scaleX(0);
    background: linear-gradient(90deg, #ff8c00, #ff6a00);
}

.mlm-video-progress-handle {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid rgba(255,255,255,0.6);
    box-shadow: 0 4px 10px rgba(0,0,0,0.35);
    left: 0%;
}

/* Time Display */
.mlm-video-time {
    font-size: 12px;
    color: var(--fg-dim);
    min-width: 72px;
    text-align: center;
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 768px) {
    .mlm-player-header {
        padding: 15px;
        gap: 15px;
    }
    
    .mlm-player-avatars {
        width: 90px;
        height: 70px;
    }
    
    .mlm-player-product-thumb {
        width: 60px;
        height: 60px;
    }
    
    .mlm-player-vendor-avatar {
        width: 50px;
        height: 50px;
        top: 5px;
    }
    
    .mlm-audio-controls {
        gap: 6px;
        padding: 8px 12px;
    }
    
    .mlm-audio-btn {
        width: 28px;
        height: 28px;
        border-radius: 10px;
    }
    
    .mlm-audio-btn svg {
        width: 14px;
        height: 14px;
    }
    
    .mlm-audio-progress {
        width: 50%;
    }
    
    .mlm-audio-time {
        display: none;
    }
    
    .mlm-video-controls {
        gap: 6px;
        padding: 6px 8px;
    }
    
    .mlm-video-btn {
        width: 28px;
        height: 28px;
        border-radius: 10px;
    }
    
    .mlm-video-btn svg {
        width: 14px;
        height: 14px;
    }
    
    .mlm-video-chip {
        padding: 5px 7px;
        gap: 6px;
    }
    
    .mlm-video-chip-avatar {
        width: 26px;
        height: 26px;
    }
    
    .mlm-video-chip-product {
        font-size: 11px;
    }
    
    .mlm-video-chip-seller {
        font-size: 9px;
    }
    
    .mlm-video-progress {
        width: 50%;
    }
    
    .mlm-video-time {
        display: none;
    }
}

@media (max-width: 480px) {
    .mlm-player-header {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .mlm-player-avatars {
        width: 80px;
        height: 60px;
    }
    
    .mlm-player-product-thumb {
        width: 50px;
        height: 50px;
    }
    
    .mlm-player-vendor-avatar {
        width: 40px;
        height: 40px;
        top: 5px;
    }
    
    .mlm-video-overlay-top {
        top: 10px;
        right: 10px;
    }
    
    .mlm-video-big-play-btn {
        width: 64px;
        height: 64px;
    }
    
    .mlm-video-big-play-btn svg {
        width: 24px;
        height: 24px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .mlm-custom-audio-player {
        background: #1a1a1a;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    }
    
    .mlm-player-header {
        background: linear-gradient(135deg, #1a1a1a 0%, #2c2c2c 100%);
    }
    
    .mlm-audio-visualizer {
        background: rgba(255, 255, 255, 0.05);
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .wave-bar {
        background: linear-gradient(to top, #3498db, #5dade2);
    }
}

/* Accessibility */
.mlm-player-like-btn:focus,
.mlm-video-btn:focus,
.mlm-video-chip-like:focus,
.mlm-video-big-play-btn:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* Loading State */
.mlm-player-loading {
    opacity: 0.6;
    pointer-events: none;
}

.mlm-player-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Disabled state */
.is-disabled,
[aria-disabled="true"] {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}