/**
 * MS Narrator - Modern Mini Audio Player Styles
 * Version: 2.2.0
 * Author: Pradeep Singh Tomar & Claude (Anthropic)
 */

/* ========================================
   RESET & BASE
   ======================================== */

.mn-player-wrapper,
.mn-player-wrapper *,
.mn-player-wrapper *::before,
.mn-player-wrapper *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.mn-player-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* ========================================
   MINI PLAYER — STICKY FOOTER
   ======================================== */

.mn-mini-player {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #ffffff;
    z-index: 999999;
    box-shadow: 0 -4px 20px rgba(0,0,0,.3);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255,255,255,.1);
}

.mn-player-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    gap: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

/* ========================================
   PLAYER SECTIONS
   ======================================== */

.mn-player-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 0 0 auto;
    min-width: 0;
}

.mn-player-center {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
}

.mn-player-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

/* ========================================
   PLAY BUTTON
   ======================================== */

.mn-play-button {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .3s cubic-bezier(.4,0,.2,1);
    box-shadow: 0 4px 12px rgba(255,107,107,.4);
    flex-shrink: 0;
}

.mn-play-button:hover  { transform: scale(1.05); box-shadow: 0 6px 16px rgba(255,107,107,.5); }
.mn-play-button:active { transform: scale(.95); }
.mn-play-button .mn-icon { width: 24px; height: 24px; color: #fff; }

/* ========================================
   TRACK INFO
   ======================================== */

.mn-track-info { min-width: 0; flex: 1; }

.mn-track-title {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
    line-height: 1.4;
}

.mn-track-status { display: flex; align-items: center; gap: 6px; }

.mn-status-text {
    font-size: 13px;
    color: rgba(255,255,255,.7);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ========================================
   PROGRESS BAR
   ======================================== */

.mn-progress-container {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.mn-progress-bar {
    flex: 1;
    height: 4px;
    background: rgba(255,255,255,.2);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.mn-progress-track { position: absolute; inset: 0; background: rgba(255,255,255,.1); }

.mn-progress-fill {
    position: absolute;
    top: 0; left: 0;
    height: 100%;
    background: linear-gradient(90deg, #ff6b6b 0%, #ee5a6f 100%);
    width: 0%;
    transition: width .3s ease;
    border-radius: 2px;
}

.mn-time-current,
.mn-time-total {
    font-size: 12px;
    color: rgba(255,255,255,.7);
    font-weight: 500;
    min-width: 40px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.mn-progress-mobile { display: none; padding: 0 20px 8px; }
.mn-progress-mobile .mn-progress-bar { height: 3px; }

/* ========================================
   CONTROL BUTTONS
   ======================================== */

.mn-control-btn {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,.1);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .2s;
    color: #fff;
}

.mn-control-btn:hover  { background: rgba(255,255,255,.2); transform: scale(1.05); }
.mn-control-btn:active { transform: scale(.95); }
.mn-control-btn .mn-icon { width: 20px; height: 20px; }

.mn-speed-text { font-size: 13px; font-weight: 600; color: #fff; }

.mn-close-btn { background: rgba(255,255,255,.05); }
.mn-close-btn:hover { background: rgba(255,107,107,.2); }

/* ========================================
   ICONS & UTILITIES
   ======================================== */

.mn-icon { display: block; flex-shrink: 0; }
.mn-hidden { display: none !important; }

/* ========================================
   SETTINGS PANEL
   ======================================== */

.mn-settings-panel {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 380px;
    max-width: calc(100vw - 40px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,.3);
    z-index: 1000000;
    transition: all .3s cubic-bezier(.4,0,.2,1);
    overflow: hidden;
}

.mn-settings-panel.mn-hidden {
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(.95);
}

.mn-settings-content { max-height: 70vh; overflow-y: auto; }

.mn-settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 10;
}

.mn-settings-header h3 { font-size: 18px; font-weight: 700; color: #1f2937; margin: 0; }

.mn-settings-close {
    width: 36px; height: 36px;
    background: transparent; border: none; border-radius: 8px;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    color: #6b7280; transition: all .2s;
}

.mn-settings-close:hover { background: #f3f4f6; color: #1f2937; }
.mn-settings-close .mn-icon { width: 20px; height: 20px; }

.mn-settings-body { padding: 20px; }

/* ========================================
   SETTING GROUPS
   ======================================== */

.mn-setting-group { margin-bottom: 24px; }
.mn-setting-group:last-child { margin-bottom: 0; }

.mn-setting-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 10px;
}

.mn-setting-label .mn-icon { width: 18px; height: 18px; color: #6b7280; }

.mn-select {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
    color: #1f2937;
    cursor: pointer;
    transition: all .2s;
    outline: none;
}

.mn-select:hover { border-color: #d1d5db; }
.mn-select:focus { border-color: #ff6b6b; box-shadow: 0 0 0 3px rgba(255,107,107,.1); }

/* ========================================
   SPEED GRID
   ======================================== */

.mn-speed-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.mn-speed-option {
    padding: 10px;
    font-size: 14px; font-weight: 600;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
    color: #374151;
    cursor: pointer;
    transition: all .2s;
}

.mn-speed-option:hover { border-color: #ff6b6b; background: #fff5f5; }

.mn-speed-option.mn-speed-active {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: #fff;
    border-color: #ff6b6b;
}

/* ========================================
   SLIDERS
   ======================================== */

.mn-slider {
    width: 100%; height: 6px;
    border-radius: 3px; background: #e5e7eb;
    outline: none;
    -webkit-appearance: none; appearance: none;
}

.mn-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px; height: 16px; border-radius: 50%;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,.2);
    transition: transform .2s;
}

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

.mn-slider::-moz-range-thumb {
    width: 16px; height: 16px; border-radius: 50%;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    cursor: pointer; border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,.2);
}

/* ========================================
   TOGGLE SWITCH
   ======================================== */

.mn-setting-toggle { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.mn-setting-toggle input[type="checkbox"] { display: none; }

.mn-toggle-slider {
    width: 44px; height: 24px;
    background: #d1d5db; border-radius: 12px;
    position: relative; transition: all .3s; flex-shrink: 0;
}

.mn-toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px; height: 18px; border-radius: 50%;
    background: #fff; top: 3px; left: 3px;
    transition: all .3s; box-shadow: 0 2px 4px rgba(0,0,0,.2);
}

.mn-setting-toggle input[type="checkbox"]:checked + .mn-toggle-slider {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
}

.mn-setting-toggle input[type="checkbox"]:checked + .mn-toggle-slider::before {
    transform: translateX(20px);
}

.mn-toggle-label {
    display: flex; align-items: center; gap: 8px;
    font-size: 14px; color: #374151; flex: 1;
}

.mn-toggle-label .mn-icon { width: 16px; height: 16px; color: #6b7280; }

/* ========================================
   SPEED QUICK MENU
   ======================================== */

.mn-speed-menu {
    position: fixed;
    bottom: 80px; right: 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,.2);
    overflow: hidden;
    z-index: 1000000;
    min-width: 160px;
    transition: all .2s cubic-bezier(.4,0,.2,1);
}

.mn-speed-menu.mn-hidden {
    opacity: 0; visibility: hidden;
    transform: translateY(10px) scale(.95);
}

.mn-speed-menu-item {
    width: 100%; padding: 12px 16px;
    background: transparent; border: none;
    text-align: left; font-size: 14px; font-weight: 500;
    color: #374151; cursor: pointer;
    transition: all .2s; display: block;
}

.mn-speed-menu-item:hover { background: #f3f4f6; }

.mn-speed-menu-item.mn-speed-active {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: #fff;
}

/* ========================================
   SENTENCE HIGHLIGHT
   ======================================== */

.mn-highlighted-sentence {
    background: linear-gradient(120deg, #fef3c7 0%, #fde68a 100%);
    padding: 4px 8px;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(252,211,77,.3);
    transition: all .3s ease;
    display: inline;
    font-weight: 500;
}

/* ========================================
   SCROLLBAR
   ======================================== */

.mn-settings-content::-webkit-scrollbar       { width: 8px; }
.mn-settings-content::-webkit-scrollbar-track { background: #f3f4f6; }
.mn-settings-content::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }
.mn-settings-content::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .mn-player-content     { padding: 10px 16px; gap: 12px; }
    .mn-player-center      { display: none; }
    .mn-progress-mobile    { display: block; }
    .mn-play-button        { width: 44px; height: 44px; }
    .mn-play-button .mn-icon { width: 22px; height: 22px; }
    .mn-track-title        { font-size: 14px; }
    .mn-control-btn        { width: 36px; height: 36px; }
    .mn-control-btn .mn-icon { width: 18px; height: 18px; }
    .mn-player-right       { gap: 6px; }
    .mn-settings-panel     { bottom: 70px; right: 10px; width: calc(100vw - 20px); }
    .mn-speed-menu         { bottom: 70px; right: 10px; }
}

@media (max-width: 480px) {
    .mn-player-content  { padding: 8px 12px; gap: 10px; }
    .mn-player-left     { gap: 12px; flex: 1; min-width: 0; }
    .mn-player-right    { gap: 4px; }
    .mn-play-button     { width: 40px; height: 40px; }
    .mn-play-button .mn-icon { width: 20px; height: 20px; }
    .mn-track-title     { font-size: 13px; }
    .mn-status-text     { font-size: 11px; }
    .mn-control-btn     { width: 32px; height: 32px; }
    .mn-control-btn .mn-icon { width: 16px; height: 16px; }
    .mn-speed-text      { font-size: 11px; }
    #mnPrevBtn, #mnNextBtn { display: none; }
    .mn-speed-grid      { grid-template-columns: repeat(2, 1fr); }
}

/* ========================================
   PRINT / ANIMATIONS / ACCESSIBILITY
   ======================================== */

@media print { .mn-player-wrapper { display: none !important; } }

@keyframes mn-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: .7; }
}

.mn-status-text.mn-playing { animation: mn-pulse 2s ease-in-out infinite; }

.mn-control-btn:focus,
.mn-play-button:focus,
.mn-settings-close:focus,
.mn-select:focus,
.mn-speed-option:focus,
.mn-speed-menu-item:focus {
    outline: 2px solid #ff6b6b;
    outline-offset: 2px;
}

@media (prefers-contrast: high) {
    .mn-mini-player { border-top: 2px solid #fff; }
    .mn-control-btn { border: 1px solid rgba(255,255,255,.3); }
}

@media (prefers-reduced-motion: reduce) {
    .mn-mini-player, .mn-settings-panel, .mn-speed-menu,
    .mn-play-button, .mn-control-btn, .mn-progress-fill,
    .mn-highlighted-sentence, .mn-toggle-slider::before {
        transition: none !important;
        animation: none !important;
    }
}