/* ========================================
   Audio Player Styles - Free Audiobooks
   ======================================== */

/* Sticky Player Bar */
.player-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(18, 24, 31, 0.98);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-color);
    padding: 16px 0;
    z-index: 1000;
    transform: translateY(100%);
    transition: transform var(--transition-normal);
}

.player-bar.active {
    transform: translateY(0);
}

.player-inner {
    display: flex;
    align-items: center;
    gap: 20px;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 20px;
}

/* Book Info in Player */
.player-info {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 200px;
    max-width: 280px;
}

.player-cover {
    width: 48px;
    height: 64px;
    background: var(--bg-card);
    border-radius: 4px;
    flex-shrink: 0;
    overflow: hidden;
}

.player-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.player-meta {
    min-width: 0;
}

.player-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-chapter {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Main Controls */
.player-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.player-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    transition: all var(--transition-fast);
    padding: 8px;
}

.player-btn:hover {
    color: var(--primary);
}

.player-btn svg {
    width: 24px;
    height: 24px;
}

.player-btn.btn-skip svg {
    width: 20px;
    height: 20px;
}

.player-btn.btn-play {
    width: 48px;
    height: 48px;
    background: var(--primary);
    border-radius: 50%;
    color: var(--bg-dark);
}

.player-btn.btn-play:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-glow);
}

.player-btn.btn-play svg {
    width: 24px;
    height: 24px;
}

/* Progress Section */
.player-progress-section {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
}

.player-time {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
    min-width: 45px;
}

.player-time.current {
    text-align: right;
}

.player-progress {
    flex: 1;
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    cursor: pointer;
    position: relative;
}

.player-progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
    position: relative;
    transition: width 0.1s linear;
}

.player-progress-fill::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background: var(--primary);
    border-radius: 50%;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.player-progress:hover .player-progress-fill::after {
    opacity: 1;
}

/* Extra Controls */
.player-extras {
    display: flex;
    align-items: center;
    gap: 8px;
}

.player-speed {
    padding: 6px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-light);
    font-size: 0.8rem;
    font-family: var(--font-mono);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.player-speed:hover {
    border-color: var(--primary);
    color: var(--primary);
}

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

.player-volume input[type="range"] {
    width: 80px;
    height: 4px;
    -webkit-appearance: none;
    background: var(--border-color);
    border-radius: 2px;
    cursor: pointer;
}

.player-volume input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
}

/* Book Page Player (Large) */
.book-player {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 32px;
}

.book-player-header {
    display: flex;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 24px;
}

.book-player-cover {
    width: 160px;
    height: 220px;
    background: var(--bg-dark);
    border-radius: 8px;
    flex-shrink: 0;
    overflow: hidden;
}

.book-player-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.book-player-info {
    flex: 1;
}

.book-player-title {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.book-player-author {
    color: var(--text-muted);
    margin-bottom: 16px;
}

.book-player-chapter-title {
    font-size: 1.1rem;
    color: var(--primary);
    margin-bottom: 24px;
}

/* Large Player Controls */
.book-player-controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.book-player-main-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
}

.book-player-main-controls .player-btn.btn-play {
    width: 64px;
    height: 64px;
}

.book-player-main-controls .player-btn.btn-play svg {
    width: 28px;
    height: 28px;
}

/* Chapter List */
.chapter-list {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.chapter-list-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chapter-list-header h3 {
    font-size: 1rem;
}

.chapter-count {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.chapter-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.chapter-item:last-child {
    border-bottom: none;
}

.chapter-item:hover {
    background: var(--bg-dark);
}

.chapter-item.active {
    background: var(--bg-dark);
    border-left: 3px solid var(--primary);
}

.chapter-item.active .chapter-number {
    background: var(--primary);
    color: var(--bg-dark);
}

.chapter-number {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-dark);
    border-radius: 50%;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    flex-shrink: 0;
}

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

.chapter-title {
    font-weight: 500;
    color: var(--text-light);
    margin-bottom: 4px;
}

.chapter-duration {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.chapter-status {
    color: var(--success);
}

.chapter-status svg {
    width: 20px;
    height: 20px;
}

/* Text Display */
.text-display {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 32px;
    margin-top: 24px;
    max-height: 400px;
    overflow-y: auto;
}

.text-display-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.text-display-toggle h4 {
    font-size: 1rem;
}

.text-display-content {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-light);
}

.text-display-content .current-sentence {
    background: var(--primary-glow);
    padding: 2px 4px;
    border-radius: 4px;
}

/* Download Section */
.download-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    margin-top: 24px;
}

.download-section h4 {
    margin-bottom: 16px;
}

.download-options {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* Responsive */
@media (max-width: 992px) {
    .player-info {
        min-width: 150px;
        max-width: 200px;
    }

    .player-volume {
        display: none;
    }
}

@media (max-width: 768px) {
    .player-inner {
        flex-wrap: wrap;
        gap: 12px;
    }

    .player-info {
        order: 1;
        flex: 1;
    }

    .player-controls {
        order: 3;
        width: 100%;
        justify-content: center;
    }

    .player-progress-section {
        order: 2;
        width: 100%;
    }

    .player-extras {
        order: 4;
        width: 100%;
        justify-content: center;
    }

    .book-player-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
}
