/**
 * My Dentist Hub - Interactive Voice Narrator & Audio Player Styles
 * Designed for dental healthcare readers: accessible, modern, clean & animated.
 */

/* -------------------------------------------------------------
 * 1. Main Player Card Container
 * ------------------------------------------------------------- */
.mdh-audio-player-card {
    position: relative;
    margin: 24px 0 32px 0;
    padding: 18px 22px;
    background: linear-gradient(145deg, #f0fdfa 0%, #f8fafc 100%);
    border: 1px solid #ccfbf1;
    border-radius: 12px;
    box-shadow: 0 4px 16px -2px rgba(13, 148, 136, 0.08), 0 2px 6px -1px rgba(0, 0, 0, 0.04);
    font-family: inherit;
    color: #1e293b;
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
    box-sizing: border-box;
}

.mdh-audio-player-card:hover {
    border-color: #99f6e4;
    box-shadow: 0 6px 20px -2px rgba(13, 148, 136, 0.12), 0 3px 8px -1px rgba(0, 0, 0, 0.05);
}

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

/* -------------------------------------------------------------
 * 2. Top Header Bar
 * ------------------------------------------------------------- */
.mdh-player-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
}

.mdh-player-meta {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mdh-audio-icon-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: #0d9488;
    color: #ffffff;
    flex-shrink: 0;
}

.mdh-player-titles {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.mdh-player-action-title {
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
}

.mdh-player-duration-badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 600;
    color: #0f766e;
    background: #ccfbf1;
    border-radius: 9999px;
    line-height: 1.4;
}

.mdh-player-badges {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mdh-badge-human-voice {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 600;
    color: #047857;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    padding: 3px 9px;
    border-radius: 9999px;
    white-space: nowrap;
}

.mdh-sparkle-svg {
    color: #10b981;
}

/* -------------------------------------------------------------
 * 3. Primary Controls Row (Play button, Equalizer, Speed, Voice)
 * ------------------------------------------------------------- */
.mdh-player-primary-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

/* Play Button */
.mdh-btn-play {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 18px;
    background: linear-gradient(135deg, #0d9488 0%, #059669 100%);
    color: #ffffff !important;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(13, 148, 136, 0.28);
    transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
    user-select: none;
    flex-shrink: 0;
    height: 40px;
}

.mdh-btn-play:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 14px rgba(13, 148, 136, 0.4);
    background: linear-gradient(135deg, #0f766e 0%, #047857 100%);
}

.mdh-btn-play:active {
    transform: translateY(1px);
    box-shadow: 0 2px 6px rgba(13, 148, 136, 0.3);
}

.mdh-btn-play svg {
    flex-shrink: 0;
}

/* -------------------------------------------------------------
 * 4. Animated Equalizer Waveform
 * ------------------------------------------------------------- */
.mdh-audio-equalizer {
    display: inline-flex;
    align-items: flex-end;
    gap: 3px;
    height: 24px;
    padding: 0 4px;
    flex-shrink: 0;
}

.mdh-audio-equalizer .mdh-bar {
    width: 3.5px;
    height: 5px;
    background: #14b8a6;
    border-radius: 2px;
    transition: height 0.2s ease, background 0.2s ease;
}

/* Initial static heights */
.mdh-audio-equalizer .bar-1 { height: 6px; }
.mdh-audio-equalizer .bar-2 { height: 10px; }
.mdh-audio-equalizer .bar-3 { height: 15px; }
.mdh-audio-equalizer .bar-4 { height: 8px; }
.mdh-audio-equalizer .bar-5 { height: 14px; }
.mdh-audio-equalizer .bar-6 { height: 9px; }
.mdh-audio-equalizer .bar-7 { height: 5px; }

/* Active Playing Animation */
.mdh-audio-player-card.is-playing .mdh-audio-equalizer .mdh-bar {
    background: #0d9488;
    animation: mdhWaveAnimation 1.1s ease-in-out infinite alternate;
}

.mdh-audio-player-card.is-playing .mdh-audio-equalizer .bar-1 { animation-delay: 0.1s; animation-duration: 0.75s; }
.mdh-audio-player-card.is-playing .mdh-audio-equalizer .bar-2 { animation-delay: 0.25s; animation-duration: 1.05s; }
.mdh-audio-player-card.is-playing .mdh-audio-equalizer .bar-3 { animation-delay: 0.05s; animation-duration: 0.9s; }
.mdh-audio-player-card.is-playing .mdh-audio-equalizer .bar-4 { animation-delay: 0.35s; animation-duration: 1.2s; }
.mdh-audio-player-card.is-playing .mdh-audio-equalizer .bar-5 { animation-delay: 0.15s; animation-duration: 0.85s; }
.mdh-audio-player-card.is-playing .mdh-audio-equalizer .bar-6 { animation-delay: 0.3s; animation-duration: 1.15s; }
.mdh-audio-player-card.is-playing .mdh-audio-equalizer .bar-7 { animation-delay: 0.2s; animation-duration: 0.8s; }

@keyframes mdhWaveAnimation {
    0% { height: 4px; }
    50% { height: 22px; }
    100% { height: 7px; }
}

/* -------------------------------------------------------------
 * 5. Skip Buttons (-10s / +10s)
 * ------------------------------------------------------------- */
.mdh-player-skip-group {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.mdh-btn-skip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 6px 9px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s ease;
    height: 36px;
}

.mdh-btn-skip:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
    color: #0f172a;
}

.mdh-btn-skip:active {
    background: #e2e8f0;
}

/* -------------------------------------------------------------
 * 6. Speed Control Pill
 * ------------------------------------------------------------- */
.mdh-speed-control {
    flex-shrink: 0;
}

.mdh-btn-speed {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    color: #0f766e;
    cursor: pointer;
    transition: all 0.15s ease;
    height: 36px;
    min-width: 46px;
}

.mdh-btn-speed:hover {
    background: #ccfbf1;
    border-color: #99f6e4;
}

/* -------------------------------------------------------------
 * 7. Voice Selector Dropdown
 * ------------------------------------------------------------- */
.mdh-voice-selector-wrap {
    flex-shrink: 0;
    max-width: 190px;
}

.mdh-voice-select {
    width: 100%;
    padding: 6px 10px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    color: #334155;
    cursor: pointer;
    height: 36px;
    transition: border-color 0.2s ease;
    outline: none;
}

.mdh-voice-select:hover,
.mdh-voice-select:focus {
    border-color: #0d9488;
}

/* -------------------------------------------------------------
 * 8. Follow Text (Read-Along Toggle)
 * ------------------------------------------------------------- */
.mdh-btn-follow-text {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 10px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: all 0.15s ease;
    height: 36px;
    flex-shrink: 0;
}

.mdh-btn-follow-text:hover {
    background: #f8fafc;
    color: #334155;
}

.mdh-btn-follow-text.is-active {
    background: #f0fdf4;
    border-color: #86efac;
    color: #15803d;
}

/* -------------------------------------------------------------
 * 9. Timeline & Scrubber Row
 * ------------------------------------------------------------- */
.mdh-player-timeline-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.mdh-time-label {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    font-variant-numeric: tabular-nums;
    min-width: 32px;
    flex-shrink: 0;
}

.mdh-progress-bar-container {
    position: relative;
    flex: 1;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    cursor: pointer;
    overflow: hidden;
}

.mdh-progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, #0d9488 0%, #14b8a6 100%);
    border-radius: 4px;
    pointer-events: none;
    transition: width 0.1s linear;
}

.mdh-scrubber {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    margin: 0;
    cursor: pointer;
    z-index: 2;
}

/* -------------------------------------------------------------
 * 10. Status Line
 * ------------------------------------------------------------- */
.mdh-player-status-line {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    color: #64748b;
}

.mdh-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #94a3b8;
    flex-shrink: 0;
    transition: background 0.2s ease;
}

.mdh-audio-player-card.is-playing .mdh-status-dot {
    background: #10b981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25);
    animation: mdhPulseDot 1.6s infinite;
}

@keyframes mdhPulseDot {
    0% { transform: scale(0.95); opacity: 0.8; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(0.95); opacity: 0.8; }
}

.mdh-audio-player-card.is-paused .mdh-status-dot {
    background: #f59e0b;
}

/* -------------------------------------------------------------
 * 11. Read-Along Highlight on Post Body Elements
 * ------------------------------------------------------------- */
.entry-content .mdh-reading-active,
.entry-header .mdh-reading-active,
.mdh-reading-active,
.page-main-content .mdh-reading-active {
    background-color: rgba(13, 148, 136, 0.08) !important;
    border-left: 4px solid #0d9488 !important;
    padding-left: 12px !important;
    border-radius: 4px !important;
    transition: background-color 0.25s ease, border-color 0.25s ease, padding 0.25s ease !important;
}

/* -------------------------------------------------------------
 * 12. Floating Bottom Mini Player (Sticky on Scroll)
 * ------------------------------------------------------------- */
.mdh-mini-dock {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(0);
    z-index: 2147483645;
    width: calc(100% - 32px);
    max-width: 620px;
    background: rgba(15, 23, 42, 0.94);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 9999px;
    box-shadow: 0 12px 30px -4px rgba(0, 0, 0, 0.35), 0 4px 10px rgba(0, 0, 0, 0.2);
    padding: 8px 16px;
    color: #ffffff;
    box-sizing: border-box;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
    animation: mdhSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes mdhSlideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.mdh-mini-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Mini Play Button */
.mdh-mini-play-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #0d9488;
    color: #ffffff;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s ease, transform 0.15s ease;
}

.mdh-mini-play-btn:hover {
    background: #0f766e;
    transform: scale(1.05);
}

/* Mini Equalizer */
.mdh-mini-equalizer {
    display: inline-flex;
    align-items: flex-end;
    gap: 2px;
    height: 18px;
    flex-shrink: 0;
}

.mdh-mini-equalizer .mini-bar {
    width: 2.5px;
    height: 4px;
    background: #2dd4bf;
    border-radius: 1px;
}

.mdh-mini-dock.is-playing .mdh-mini-equalizer .mini-bar {
    animation: mdhWaveAnimation 0.9s ease-in-out infinite alternate;
}

.mdh-mini-dock.is-playing .mb-1 { animation-delay: 0.1s; }
.mdh-mini-dock.is-playing .mb-2 { animation-delay: 0.25s; }
.mdh-mini-dock.is-playing .mb-3 { animation-delay: 0.05s; }
.mdh-mini-dock.is-playing .mb-4 { animation-delay: 0.35s; }

.mdh-mini-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex: 1;
    min-width: 0;
}

.mdh-mini-title {
    font-size: 13px;
    font-weight: 600;
    color: #f8fafc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.mdh-mini-progress-pct {
    font-size: 11px;
    color: #94a3b8;
    font-variant-numeric: tabular-nums;
}

.mdh-mini-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.mdh-mini-speed-btn,
.mdh-mini-scroll-btn,
.mdh-mini-close-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 30px;
    background: rgba(255, 255, 255, 0.12);
    color: #f1f5f9;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    padding: 0 8px;
    transition: background 0.15s ease;
}

.mdh-mini-scroll-btn,
.mdh-mini-close-btn {
    width: 30px;
    padding: 0;
}

.mdh-mini-speed-btn:hover,
.mdh-mini-scroll-btn:hover {
    background: rgba(255, 255, 255, 0.22);
}

.mdh-mini-close-btn:hover {
    background: rgba(239, 68, 68, 0.4);
    color: #fca5a5;
}

/* -------------------------------------------------------------
 * 13. Mobile Responsiveness (Tablets & Phones)
 * ------------------------------------------------------------- */
@media (max-width: 768px) {
    .mdh-audio-player-card {
        padding: 14px 16px;
        margin: 18px 0 24px 0;
    }

    .mdh-player-topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .mdh-player-badges {
        width: 100%;
        justify-content: flex-start;
    }

    .mdh-player-primary-row {
        gap: 8px;
    }

    .mdh-voice-selector-wrap {
        max-width: 160px;
    }

    .mdh-mini-dock {
        bottom: 85px;
        width: calc(100% - 20px);
        padding: 8px 12px;
        border-radius: 14px;
        z-index: 2147483645 !important;
    }
}

@media (max-width: 480px) {
    .mdh-player-action-title {
        font-size: 14px;
    }

    .mdh-btn-play {
        padding: 6px 14px;
        font-size: 13px;
        height: 38px;
    }

    .mdh-audio-equalizer {
        display: flex;
        align-items: center;
        gap: 2px;
        height: 18px;
    }

    .mdh-audio-equalizer .bar-5,
    .mdh-audio-equalizer .bar-6,
    .mdh-audio-equalizer .bar-7 {
        display: none; /* Show 4 active bars to conserve horizontal space */
    }

    .mdh-voice-selector-wrap {
        order: 5;
        width: 100%;
        max-width: 100%;
        margin-top: 4px;
    }

    .mdh-btn-follow-text {
        padding: 6px 8px;
        font-size: 11px;
        height: 38px;
    }

    .mdh-btn-follow-text .mdh-follow-text-label {
        display: inline !important;
        font-size: 11px;
    }

    .mdh-mini-title {
        max-width: 130px;
    }
}
