/**
 * Novel to Voice - Player CSS
 * Floating draggable audio player
 *
 * @package NovelToVoice
 * @license GPL-2.0-or-later
 * @since   1.0.0
 */

/* ============================================
   Novel to Voice - Player Styles
   ============================================ */

/* Google Font */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ---- Wrapper ---- */
.ntv-wrapper {
    position: fixed;
    z-index: 999999;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    user-select: none;
    -webkit-user-select: none;
    transition: all 0.3s ease;
}

.ntv-pos-bottom-center { bottom: 20px; left: 50%; transform: translateX(-50%); }
.ntv-pos-bottom-left   { bottom: 20px; left: 20px; }
.ntv-pos-bottom-right  { bottom: 20px; right: 20px; }

/* ---- Player Container ---- */
.ntv-player {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    min-width: 340px;
    max-width: 500px;
    background: linear-gradient(135deg, rgba(15,15,30,0.92) 0%, rgba(30,30,60,0.95) 100%);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    box-shadow:
        0 8px 32px rgba(0,0,0,0.4),
        0 0 0 1px rgba(255,255,255,0.05),
        inset 0 1px 0 rgba(255,255,255,0.06);
    color: #e0e0e0;
    cursor: move;
    overflow: visible;
}

/* ---- Loading Overlay ---- */
.ntv-loading-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: rgba(10,10,25,0.95);
    border-radius: 16px;
    z-index: 10;
    padding: 0 16px;
}

.ntv-loading-spinner {
    width: 22px; height: 22px;
    border: 3px solid rgba(160,120,255,0.25);
    border-top-color: #a078ff;
    border-radius: 50%;
    animation: ntv-spin 0.8s linear infinite;
    flex-shrink: 0;
}

@keyframes ntv-spin {
    to { transform: rotate(360deg); }
}

.ntv-loading-text {
    font-size: 12.5px;
    color: #c4b5fd;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---- Cover Icon ---- */
.ntv-cover-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(124,58,237,0.4);
}

/* ---- Play Button ---- */
.ntv-play-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px; height: 40px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    box-shadow: 0 2px 12px rgba(124,58,237,0.5);
}

.ntv-play-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 20px rgba(124,58,237,0.65);
}

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

.ntv-play-btn .ntv-btn-loading {
    width: 20px; height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: ntv-spin 0.8s linear infinite;
}

/* ---- Divider ---- */
.ntv-divider {
    width: 1px;
    height: 28px;
    background: rgba(255,255,255,0.1);
    flex-shrink: 0;
}

/* ---- Player Body ---- */
.ntv-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ntv-title {
    font-size: 12px;
    font-weight: 600;
    color: #d4bfff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.ntv-progress-wrap {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.ntv-progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
    overflow: hidden;
    cursor: pointer;
    transition: height 0.15s ease;
}

.ntv-progress-bar:hover {
    height: 8px;
}

.ntv-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #7c3aed, #a855f7, #c084fc);
    border-radius: 2px;
    transition: width 0.2s ease;
}

.ntv-time {
    font-size: 10px;
    color: rgba(255,255,255,0.45);
    font-variant-numeric: tabular-nums;
}

/* ---- Settings Button ---- */
.ntv-settings-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px; height: 32px;
    border: none;
    border-radius: 8px;
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.6);
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.ntv-settings-btn:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
}

/* ---- Settings Panel ---- */
.ntv-settings-panel {
    display: none;
    position: absolute;
    bottom: calc(100% + 10px);
    right: 0;
    width: 300px;
    max-height: 420px;
    overflow-y: auto;
    background: linear-gradient(135deg, rgba(18,18,38,0.98) 0%, rgba(28,28,55,0.98) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.5);
    padding: 14px;
    z-index: 20;
}

.ntv-settings-panel.ntv-open { display: block; }

.ntv-settings-panel::-webkit-scrollbar { width: 5px; }
.ntv-settings-panel::-webkit-scrollbar-track { background: transparent; }
.ntv-settings-panel::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }

/* Panel Header */
.ntv-panel-header {
    font-size: 13px;
    font-weight: 700;
    color: #c4b5fd;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    margin-bottom: 10px;
}

/* Group */
.ntv-group {
    margin-bottom: 12px;
}

.ntv-group-title {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255,255,255,0.5);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

/* Control Row (Speed / Volume) */
.ntv-ctrl-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.ntv-ctrl-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px; height: 28px;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    background: rgba(255,255,255,0.06);
    color: #e0e0e0;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.ntv-ctrl-btn:hover {
    background: rgba(124,58,237,0.3);
    border-color: rgba(124,58,237,0.5);
}

.ntv-ctrl-value {
    font-size: 13px;
    font-weight: 600;
    color: #c4b5fd;
    min-width: 40px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* Voice Item */
.ntv-voice-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    margin-bottom: 3px;
}

.ntv-voice-item:hover {
    background: rgba(124,58,237,0.15);
}

.ntv-voice-item.ntv-active {
    background: rgba(124,58,237,0.25);
    border: 1px solid rgba(124,58,237,0.4);
}

.ntv-voice-item:not(.ntv-active) {
    border: 1px solid transparent;
}

.ntv-voice-name {
    flex: 1;
    font-size: 13px;
    color: #e0e0e0;
}

.ntv-voice-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(124,58,237,0.3);
    color: #c4b5fd;
}

.ntv-voice-check {
    font-size: 14px;
    color: #a855f7;
    opacity: 0;
    transition: opacity 0.15s;
}

.ntv-active .ntv-voice-check { opacity: 1; }

/* ============================================
   Player Style Variants
   ============================================ */

/* --- 1. Pill (Default) --- */
.ntv-player.ntv-style-pill {
    background: #ffffff;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
    border: 1px solid #f1f5f9;
    color: #1e293b;
}
.ntv-player.ntv-style-pill .ntv-title { color: #1e293b; }
.ntv-player.ntv-style-pill .ntv-cover-icon { display: none; }
.ntv-player.ntv-style-pill .ntv-divider { display: none; }
.ntv-player.ntv-style-pill .ntv-play-btn {
    background: #0073a8;
    box-shadow: none;
    width: 42px; height: 42px;
}
.ntv-player.ntv-style-pill .ntv-progress-bar { background: #e2e8f0; border-radius: 3px; height: 6px; }
.ntv-player.ntv-style-pill .ntv-progress-fill { background: #0073a8; }
.ntv-player.ntv-style-pill .ntv-time { color: #64748b; font-size: 13px; font-weight: 500; }
.ntv-player.ntv-style-pill .ntv-settings-btn { color: #64748b; background: transparent; }

/* --- 2. Dark Mode Hiện Đại --- */
.ntv-player.ntv-style-dark {
    background: #111827;
    border-radius: 50px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    border: 1px solid #374151;
    color: #f9fafb;
}
.ntv-player.ntv-style-dark .ntv-title { color: #f9fafb; }
.ntv-player.ntv-style-dark .ntv-cover-icon { display: none; }
.ntv-player.ntv-style-dark .ntv-divider { display: none; }
.ntv-player.ntv-style-dark .ntv-play-btn {
    background: #10b981;
    color: #111827;
    width: 44px; height: 44px;
    box-shadow: none;
}
.ntv-player.ntv-style-dark .ntv-progress-bar { background: #374151; border-radius: 3px; height: 5px; }
.ntv-player.ntv-style-dark .ntv-progress-fill { background: #10b981; }
.ntv-player.ntv-style-dark .ntv-time { color: #9ca3af; font-size: 13px; font-weight: 500; }
.ntv-player.ntv-style-dark .ntv-settings-btn { color: #9ca3af; background: transparent; }

/* --- 3. Mini Card (Podcast) --- */
.ntv-player.ntv-style-mini {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.08);
    border: 1px solid #f1f5f9;
    padding: 14px;
    gap: 14px;
    min-width: 280px; max-width: 320px;
}
.ntv-player.ntv-style-mini .ntv-cover-icon {
    background: #eff6ff;
    color: #3b82f6;
    border-radius: 12px;
    width: 48px; height: 48px;
    box-shadow: none;
}
.ntv-player.ntv-style-mini .ntv-cover-icon svg { width: 24px; height: 24px; }
.ntv-player.ntv-style-mini .ntv-divider { display: none; }
.ntv-player.ntv-style-mini .ntv-body {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 6px;
}
.ntv-player.ntv-style-mini .ntv-title { color: #0f172a; font-size: 14px; max-width: 100%; }
.ntv-player.ntv-style-mini .ntv-progress-wrap { flex-direction: row; align-items: center; width: 100%; gap: 8px; }
.ntv-player.ntv-style-mini .ntv-progress-bar { background: #f1f5f9; height: 4px; }
.ntv-player.ntv-style-mini .ntv-progress-fill { background: #4f46e5; }
.ntv-player.ntv-style-mini .ntv-time { color: #64748b; font-size: 11px; }
.ntv-player.ntv-style-mini .ntv-settings-btn { order: 4; color: #94a3b8; background: transparent; }
.ntv-player.ntv-style-mini .ntv-play-btn {
    order: 5;
    background: #f8fafc;
    color: #4f46e5;
    width: 42px; height: 42px;
    box-shadow: none;
}
.ntv-player.ntv-style-mini .ntv-play-btn:hover { background: #eff6ff; }

/* --- 4. Flat (Phẳng tối giản) --- */
.ntv-player.ntv-style-flat {
    background: transparent;
    border: none; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none;
    padding: 8px 0;
    gap: 16px;
}
.ntv-player.ntv-style-flat .ntv-cover-icon { display: none; }
.ntv-player.ntv-style-flat .ntv-divider { display: none; }
.ntv-player.ntv-style-flat .ntv-title { display: none; }
.ntv-player.ntv-style-flat .ntv-play-btn {
    background: transparent;
    color: #1e293b;
    width: 32px; height: 32px;
    box-shadow: none;
}
.ntv-player.ntv-style-flat .ntv-progress-wrap { flex-direction: row; align-items: center; width: 100%; gap: 12px; }
.ntv-player.ntv-style-flat .ntv-progress-bar { background: #e2e8f0; height: 4px; border-radius: 2px; }
.ntv-player.ntv-style-flat .ntv-progress-fill { background: #1e293b; }
.ntv-player.ntv-style-flat .ntv-time { color: #64748b; font-size: 13px; font-variant-numeric: tabular-nums; }
.ntv-player.ntv-style-flat .ntv-settings-btn { color: #94a3b8; background: transparent; }

/* --- 5. Minimal (Chỉ Play & Settings) --- */
.ntv-player.ntv-style-minimal {
    background: #ffffff;
    border-radius: 50px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
    border: 1px solid #f1f5f9;
    padding: 6px;
    width: max-content;
    min-width: 0;
    margin: 0 auto;
    justify-content: center;
    gap: 8px;
}
.ntv-player.ntv-style-minimal .ntv-cover-icon { display: none !important; }
.ntv-player.ntv-style-minimal .ntv-body { display: none !important; }
.ntv-player.ntv-style-minimal .ntv-divider { display: block !important; width: 1px; height: 24px; background: #e2e8f0; margin: 0 4px; }
.ntv-player.ntv-style-minimal .ntv-play-btn {
    background: #ef4444;
    box-shadow: none;
    width: 44px; height: 44px;
}
.ntv-player.ntv-style-minimal .ntv-settings-btn { color: #64748b; background: transparent; }

/* ---- Inline mode (shortcode display) ---- */
.ntv-wrapper.ntv-display-inline {
    position: relative !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    transform: none !important;
    margin: 16px 0;
    z-index: auto;
}

/* ---- Responsive ---- */
@media (max-width: 520px) {
    .ntv-player {
        min-width: 280px;
        max-width: calc(100vw - 32px);
        padding: 8px 12px;
        gap: 8px;
    }
    .ntv-title { max-width: 120px; font-size: 11px; }
    .ntv-settings-panel { width: calc(100vw - 40px); right: -10px; }
}
