/* ==========================================================================
   Blog Voice Narrator Widget Styles - Premium Glassmorphism Player UI
   ========================================================================== */

.blog-narrator-player {
    --player-bg: rgba(15, 23, 42, 0.95);
    --player-text: #f8fafc;
    --player-border: rgba(255, 255, 255, 0.08);
    --player-accent: #6366f1;
    --player-accent-glow: rgba(99, 102, 241, 0.35);
    --player-muted: #94a3b8;
    
    font-family: 'Inter', sans-serif;
    background: var(--player-bg);
    border: 1px solid var(--player-border);
    border-radius: 16px;
    padding: 1rem 1.25rem;
    color: var(--player-text);
    margin: 1.5rem 0 2.5rem 0;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: all 0.3s ease;
}

/* Row 1: Player Information & Visualizer */
.narrator-row-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.narrator-title-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.narrator-logo-icon {
    font-size: 1.2rem;
    color: var(--player-accent);
    filter: drop-shadow(0 0 4px var(--player-accent-glow));
    animation: floatingIcon 3s ease-in-out infinite;
}

.narrator-title {
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: -0.2px;
}

.narrator-time-remaining {
    font-size: 0.8rem;
    color: var(--player-muted);
    font-weight: 500;
}

/* Audio Wave Visualizer */
.narrator-wave-visualizer {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 20px;
    width: 40px;
}

.wave-bar {
    width: 3px;
    height: 4px;
    background-color: var(--player-accent);
    border-radius: 9px;
    transition: height 0.15s ease-in-out;
}

.narrator-wave-visualizer.playing .wave-bar {
    animation: waveBounce 1.2s infinite ease-in-out alternate;
}

.narrator-wave-visualizer.playing .wave-bar:nth-child(1) { animation-delay: 0.1s; }
.narrator-wave-visualizer.playing .wave-bar:nth-child(2) { animation-delay: 0.3s; }
.narrator-wave-visualizer.playing .wave-bar:nth-child(3) { animation-delay: 0.5s; }
.narrator-wave-visualizer.playing .wave-bar:nth-child(4) { animation-delay: 0.2s; }
.narrator-wave-visualizer.playing .wave-bar:nth-child(5) { animation-delay: 0.4s; }

/* Row 2: Controls & Progress */
.narrator-row-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.narrator-playback-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.narrator-label-text {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--player-text);
    white-space: nowrap;
    opacity: 0.9;
}

/* Buttons */
.narrator-btn {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--player-text);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    transition: all 0.2s ease;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.narrator-btn:hover {
    background-color: rgba(255, 255, 255, 0.12);
    transform: translateY(-1px);
}

.narrator-btn:active {
    transform: translateY(0);
}

.narrator-btn.btn-play-pause {
    background-color: var(--player-accent);
    box-shadow: 0 4px 10px var(--player-accent-glow);
    border: none;
    width: 40px;
    height: 40px;
}

.narrator-btn.btn-play-pause:hover {
    background-color: #4f46e5;
    box-shadow: 0 4px 14px var(--player-accent-glow);
}

/* Settings Dropdowns */
.narrator-settings-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.narrator-select-wrapper {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    background-color: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 0.4rem 0.6rem;
    border-radius: 8px;
    font-size: 0.78rem;
    color: var(--player-muted);
}

.narrator-select {
    background: none;
    border: none;
    color: var(--player-text);
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    max-width: 140px;
}

.narrator-select option {
    background-color: #0f172a;
    color: #f8fafc;
}

/* Progress Bar container */
.narrator-progress-container {
    flex-grow: 1;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 180px;
}

.narrator-progress-bar-bg {
    flex-grow: 1;
    height: 6px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    position: relative;
    cursor: pointer;
}

.narrator-progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--player-accent) 0%, #a5b4fc 100%);
    border-radius: 10px;
    transition: width 0.1s linear;
}

/* Animations */
@keyframes waveBounce {
    0%, 100% {
        height: 4px;
    }
    50% {
        height: 20px;
    }
}

@keyframes floatingIcon {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-2px);
    }
}

/* Highlight style for paragraph reading */
.tts-highlight {
    background-color: rgba(99, 102, 241, 0.08);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.05);
    border-left: 3px solid var(--player-accent);
    padding-left: 10px;
    transition: all 0.3s ease;
}

/* Image Highlight adjustment */
img.tts-highlight {
    outline: 3px solid var(--player-accent);
    box-shadow: 0 0 20px var(--player-accent-glow);
    padding-left: 0 !important;
    border-left: none !important;
}

/* Table Highlight adjustment */
table.tts-highlight {
    outline: 3px solid var(--player-accent);
    box-shadow: 0 0 20px var(--player-accent-glow);
    background-color: rgba(99, 102, 241, 0.02) !important;
}

/* Code Block Highlight adjustment */
pre.tts-highlight, code.tts-highlight {
    outline: 3px solid var(--player-accent);
    box-shadow: 0 0 20px var(--player-accent-glow);
    padding-left: inherit !important;
    border-left: none !important;
}

/* Compact Single Row Player layout adjustments */
.blog-narrator-player.single-row-player {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    margin: 1.25rem 0 0 0;
    gap: 1rem;
}

.narrator-right-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Settings Dropdowns specific spacing inside single row */
.blog-narrator-player.single-row-player .narrator-settings-group {
    gap: 0.5rem;
}

/* On screens smaller than 768px, layout becomes mobile-friendly and wraps cleanly */
@media (max-width: 768px) {
    .blog-narrator-player.single-row-player {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        padding: 0.85rem 1rem;
    }
    
    .blog-narrator-player.single-row-player .narrator-playback-group {
        width: 100%;
        justify-content: flex-start;
    }
    
    .blog-narrator-player.single-row-player .narrator-progress-container {
        width: 100%;
        min-width: 100%;
        margin: 0.15rem 0;
    }
    
    .blog-narrator-player.single-row-player .narrator-right-group {
        width: 100%;
        display: grid;
        grid-template-columns: auto 1fr;
        gap: 0.75rem;
        align-items: center;
    }
    
    .blog-narrator-player.single-row-player .narrator-time-remaining {
        white-space: nowrap;
    }
    
    .blog-narrator-player.single-row-player .narrator-settings-group {
        grid-column: span 2;
        display: flex;
        width: 100%;
        gap: 0.5rem;
    }
    
    .blog-narrator-player.single-row-player .narrator-select-wrapper {
        flex: 1;
        min-width: 0;
    }
    
    .blog-narrator-player.single-row-player .narrator-select {
        width: 100%;
        max-width: 100%;
        text-overflow: ellipsis;
    }
}
