/* ============================================
   Audiobook v2 Player — Bottom Bar
   ============================================ */

.audiobook-player {
    position: sticky;
    bottom: 0;
    z-index: 20;
    background: hsl(var(--background));
    border-top: 1px solid hsl(var(--border));
    padding: 0;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

/* ------ Top Bar (always visible) ------ */
.abp-topbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.25rem;
    padding: 0.25rem 1rem 0;
    max-width: 56rem;
    margin: 0 auto;
}

/* ------ Mini Player ------ */
.audiobook-player-mini .abp-mini {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 1rem 0.5rem;
    max-width: 56rem;
    margin: 0 auto;
}



.abp-play-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid hsl(var(--border));
    background: hsl(var(--background));
    color: hsl(var(--foreground));
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
}

.abp-play-btn:hover {
    background: hsl(var(--muted));
}

.abp-chapter-title {
    flex-shrink: 0;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
    color: hsl(var(--foreground));
}

.abp-progress-bar-mini {
    flex: 1;
    height: 4px;
    background: hsl(var(--muted));
    border-radius: 2px;
    cursor: pointer;
    position: relative;
    min-width: 60px;
}

.abp-progress-bar-mini .abp-progress-fill {
    height: 100%;
    background: hsl(var(--primary));
    border-radius: 2px;
    width: 0%;
    transition: width 0.3s linear;
}

.abp-time {
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
    white-space: nowrap;
    flex-shrink: 0;
}

/* ------ Expanded Player ------ */
.audiobook-player-expanded .abp-mini {
    display: none;
}

.abp-expanded {
    padding: 1rem;
    max-width: 56rem;
    margin: 0 auto;
}

.abp-chapter-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.abp-nav-btn {
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
    background: none;
    border: 1px solid hsl(var(--border));
    border-radius: 0.375rem;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
}

.abp-nav-btn:hover {
    background: hsl(var(--muted));
    color: hsl(var(--foreground));
}

.abp-chapter-title-expanded {
    font-weight: 600;
    font-size: 0.875rem;
    color: hsl(var(--foreground));
}

.abp-progress-bar {
    width: 100%;
    height: 6px;
    background: hsl(var(--muted));
    border-radius: 3px;
    cursor: pointer;
    position: relative;
    margin-bottom: 0.25rem;
}

.abp-progress-bar .abp-progress-fill {
    height: 100%;
    background: hsl(var(--primary));
    border-radius: 3px;
    width: 0%;
    transition: width 0.3s linear;
}

.abp-progress-bar:hover .abp-progress-fill {
    background: hsl(var(--primary) / 0.8);
}

.abp-time-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: hsl(var(--muted-foreground));
    margin-bottom: 0.75rem;
}

.abp-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.abp-control-btn {
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
    background: none;
    border: 1px solid hsl(var(--border));
    border-radius: 0.375rem;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
}

.abp-control-btn:hover {
    background: hsl(var(--muted));
    color: hsl(var(--foreground));
}

.abp-play-btn-lg {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid hsl(var(--primary));
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    cursor: pointer;
    padding: 0;
}

.abp-play-btn-lg:hover {
    opacity: 0.9;
}

.abp-options-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.abp-speed-group {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.abp-label {
    font-size: 0.7rem;
    color: hsl(var(--muted-foreground));
    margin-right: 0.25rem;
}

.abp-speed-opt {
    font-size: 0.7rem;
    color: hsl(var(--muted-foreground));
    background: none;
    border: 1px solid hsl(var(--border));
    border-radius: 0.25rem;
    padding: 0.125rem 0.375rem;
    cursor: pointer;
}

.abp-speed-opt:hover {
    background: hsl(var(--muted));
    color: hsl(var(--foreground));
}

.abp-speed-opt.active {
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    border-color: hsl(var(--primary));
}

.abp-voice-group {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.abp-voice-select {
    font-size: 0.7rem;
    color: hsl(var(--foreground));
    background: hsl(var(--background));
    border: 1px solid hsl(var(--border));
    border-radius: 0.25rem;
    padding: 0.125rem 0.375rem;
    cursor: pointer;
    max-width: 180px;
}

.abp-voice-select:hover {
    border-color: hsl(var(--primary));
}

.abp-expand-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    color: hsl(var(--muted-foreground));
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.125rem;
    flex-shrink: 0;
}

.abp-expand-btn:hover {
    color: hsl(var(--foreground));
}

.abp-close-btn-mini {
    display: flex;
    align-items: center;
    justify-content: center;
    color: hsl(var(--muted-foreground));
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.125rem;
    flex-shrink: 0;
}

.abp-close-btn-mini:hover {
    color: hsl(var(--destructive));
}

/* Headphone button in chat header */
.abp-headphone-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    cursor: pointer;
    opacity: 0.7;
    color: hsl(var(--muted-foreground));
    margin-left: 0.25rem;
    vertical-align: middle;
}

.abp-headphone-btn:hover {
    opacity: 1;
    color: hsl(var(--primary));
}
