/* ==========================================================================
   Shawn's Audiobook Library Design System & Stylesheet
   ========================================================================== */

/* --- Custom Properties & Theme Variables --- */
:root {
    /* Color Palette (HSL for harmony) */
    --bg-app: hsl(222, 25%, 8%);
    --bg-panel: hsl(222, 22%, 12%);
    --bg-card: hsl(222, 20%, 15%);
    --bg-input: hsl(222, 20%, 18%);
    --border-color: hsl(222, 18%, 20%);
    --border-glow: hsl(260, 80%, 65%);
    
    --text-primary: hsl(210, 30%, 96%);
    --text-secondary: hsl(215, 20%, 75%);
    --text-muted: hsl(215, 15%, 55%);
    
    --accent-primary: hsl(263, 85%, 65%);
    --accent-primary-hover: hsl(263, 90%, 72%);
    --accent-secondary: hsl(290, 80%, 65%);
    --accent-gradient: linear-gradient(135deg, hsl(263, 85%, 65%) 0%, hsl(290, 80%, 65%) 100%);
    --success: hsl(142, 70%, 50%);
    --warning: hsl(38, 92%, 50%);
    
    /* Fonts */
    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    
    /* Layout Constants */
    --header-height: 72px;
    --player-height: 88px;
    --sidebar-width: 280px;
    
    /* Transitions */
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.6);
    --shadow-accent: 0 0 20px rgba(139, 92, 246, 0.3);
}

/* --- Base & Scrollbar Reset --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: var(--bg-app);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.5;
    overflow: hidden; /* App wraps in scroll containers */
    height: 100vh;
}

button, input, select, textarea {
    font-family: inherit;
    color: inherit;
    border: none;
    background: none;
}

button {
    cursor: pointer;
}

a {
    color: inherit;
    text-decoration: none;
}

/* Custom Scrollbar Styles */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* --- Application Containers --- */
.app-container {
    display: grid;
    grid-template-rows: var(--header-height) 1fr;
    height: 100vh;
    width: 100vw;
    position: relative;
}

/* --- Header Styling --- */
.app-header {
    background-color: rgba(10, 12, 18, 0.6);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    z-index: 10;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 28px;
    height: 28px;
    color: var(--accent-primary);
    filter: drop-shadow(0 0 8px rgba(139, 92, 246, 0.5));
}

.header-logo h1 {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.header-search {
    flex: 1;
    max-width: 500px;
    margin: 0 32px;
}

.search-input-wrapper {
    position: relative;
    width: 100%;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    pointer-events: none;
    transition: var(--transition-fast);
}

#search-input {
    width: 100%;
    height: 42px;
    padding: 0 42px 0 46px;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 14px;
    outline: none;
    transition: var(--transition-normal);
}

#search-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

#search-input:focus + .search-icon {
    color: var(--accent-primary);
}

.clear-btn {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    border-radius: 50%;
    padding: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.clear-btn:hover {
    color: var(--text-primary);
    background-color: var(--border-color);
}

.header-stats {
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: var(--bg-panel);
    border: 1px solid var(--border-color);
    padding: 6px 14px;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.stat-pill i {
    width: 15px;
    height: 15px;
    color: var(--accent-primary);
}

/* --- Main Layout --- */
.app-main {
    display: flex;
    overflow: hidden;
    height: 100%;
    position: relative;
    padding-bottom: var(--player-height);
}

/* --- Sidebar Styling --- */
.app-sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-panel);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 28px;
    flex-shrink: 0;
}

.sidebar-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sidebar-title {
    font-family: var(--font-heading);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
    padding-left: 8px;
}

.sidebar-title i {
    width: 14px;
    height: 14px;
}

.filter-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition-fast);
}

.filter-item:hover {
    background-color: var(--bg-card);
    color: var(--text-primary);
    padding-left: 16px;
}

.filter-item.active {
    background-color: rgba(139, 92, 246, 0.12);
    border-left: 3px solid var(--accent-primary);
    color: var(--text-primary);
    font-weight: 600;
}

.filter-item .count {
    font-size: 11px;
    font-weight: 600;
    background-color: var(--border-color);
    padding: 2px 8px;
    border-radius: 10px;
    color: var(--text-muted);
}

.filter-item.active .count {
    background-color: var(--accent-primary);
    color: white;
}

/* Accordion scrolling lists (categories, authors, series) */
.accordion-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 200px;
    overflow-y: auto;
    padding-right: 4px;
}

.accordion-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.accordion-item span:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
}

.accordion-item:hover {
    background-color: var(--bg-card);
    color: var(--text-primary);
}

.accordion-item.active {
    color: var(--accent-primary);
    font-weight: 600;
}

.accordion-item .sub-count {
    font-size: 11px;
    color: var(--text-muted);
}

/* --- Library Container & Toolbar --- */
.library-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px 32px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.section-title {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title i {
    color: var(--accent-primary);
}

/* --- Continue Listening (Carousel) --- */
.continue-listening-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.carousel-wrapper {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 8px;
}

.carousel-track {
    display: flex;
    gap: 16px;
}

.continue-card {
    flex: 0 0 320px;
    background-color: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px;
    display: flex;
    gap: 14px;
    align-items: center;
    position: relative;
    cursor: pointer;
    transition: var(--transition-normal);
}

.continue-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-sm);
}

.continue-cover-wrapper {
    width: 68px;
    height: 68px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

.continue-cover-wrapper svg {
    width: 100%;
    height: 100%;
}

.continue-details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.continue-title {
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.continue-author {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 8px;
}

.continue-progress {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.continue-progress-bar {
    width: 100%;
    height: 4px;
    background-color: var(--border-color);
    border-radius: 2px;
    overflow: hidden;
}

.continue-progress-bar-fill {
    height: 100%;
    background: var(--accent-gradient);
    width: 0%;
}

.continue-progress-text {
    font-size: 10px;
    color: var(--text-muted);
}

.continue-play-hover {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--accent-gradient);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition-normal);
    box-shadow: 0 4px 10px rgba(139, 92, 246, 0.4);
}

.continue-play-hover i {
    width: 16px;
    height: 16px;
    color: white;
}

.continue-card:hover .continue-play-hover {
    opacity: 1;
    right: 20px;
}

/* --- Library Toolbar & Active Filters --- */
.library-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
    margin-top: 8px;
}

.toolbar-left {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.results-count {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.control-group i {
    width: 14px;
    height: 14px;
}

#sort-select {
    background-color: var(--bg-panel);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 8px;
    outline: none;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition-fast);
}

#sort-select:hover {
    border-color: var(--text-muted);
}

.active-filters-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    background-color: rgba(139, 92, 246, 0.05);
    border: 1px dashed var(--border-color);
    padding: 8px 16px;
    border-radius: 8px;
}

.active-filters-bar .label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.active-filters-list {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 4px 10px;
    border-radius: 14px;
    font-size: 12px;
    color: var(--text-secondary);
}

.filter-badge button {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: var(--transition-fast);
}

.filter-badge button:hover {
    color: var(--text-primary);
}

.filter-badge i {
    width: 12px;
    height: 12px;
}

.clear-all-filters-btn {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-primary);
    transition: var(--transition-fast);
    padding: 4px 8px;
}

.clear-all-filters-btn:hover {
    color: var(--accent-primary-hover);
}

/* --- Books Grid & Cards --- */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 24px;
}

/* Book Card */
.book-card {
    background-color: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    cursor: pointer;
    transition: var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.book-card:hover {
    transform: translateY(-6px);
    border-color: rgba(139, 92, 246, 0.4);
    box-shadow: var(--shadow-md), 0 0 15px rgba(139, 92, 246, 0.1);
}

/* 3D cover effect inside card */
.book-card-cover-wrapper {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    perspective: 1000px;
}

.book-card-cover {
    width: 100%;
    height: 100%;
    transition: var(--transition-normal);
    transform-style: preserve-3d;
}

.book-card:hover .book-card-cover {
    transform: rotateY(-8deg) scale(1.02);
}

.book-card-cover svg {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Card Progress bar */
.card-progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background-color: rgba(255,255,255,0.1);
    z-index: 2;
}

.card-progress-fill {
    height: 100%;
    background: var(--accent-gradient);
    width: 0%;
}

.card-badge-finished {
    position: absolute;
    top: 8px;
    right: 8px;
    background-color: var(--success);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    z-index: 3;
    box-shadow: var(--shadow-sm);
    text-transform: uppercase;
}

/* Card Metadata */
.book-card-meta {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.book-card-title {
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.book-card-author {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.book-card-series {
    font-size: 11px;
    color: var(--text-muted);
    font-style: italic;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.book-card-length {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px solid rgba(255,255,255,0.05);
}

.book-card-length i {
    width: 12px;
    height: 12px;
}

/* Sentinel Spinner */
.loading-sentinel {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 24px 0;
    color: var(--text-muted);
    font-weight: 500;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* --- Slide-out Details Drawer --- */
.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(5, 7, 10, 0.6);
    backdrop-filter: blur(4px);
    z-index: 20;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition-normal);
}

.drawer-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.book-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 480px;
    height: 100vh;
    background-color: rgba(13, 17, 24, 0.9);
    backdrop-filter: blur(20px);
    border-left: 1px solid var(--border-color);
    z-index: 21;
    transform: translateX(100%);
    transition: var(--transition-slow);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

.book-drawer.open {
    transform: translateX(0);
}

.close-drawer-btn {
    position: absolute;
    left: -20px;
    top: 24px;
    width: 40px;
    height: 40px;
    background-color: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    z-index: 5;
    transition: var(--transition-fast);
}

.close-drawer-btn:hover {
    color: var(--accent-primary);
    transform: scale(1.05);
}

.close-drawer-btn i {
    width: 20px;
    height: 20px;
}

.drawer-content {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.drawer-cover-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 16px 0;
}

/* Background blur glow of cover colors */
.drawer-cover-bg {
    position: absolute;
    width: 220px;
    height: 220px;
    filter: blur(40px);
    opacity: 0.35;
    z-index: 1;
    border-radius: 50%;
}

.book-cover-3d {
    width: 180px;
    height: 180px;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    z-index: 2;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5), 0 0 2px rgba(255,255,255,0.2);
    transform: perspective(600px) rotateY(-10deg);
}

.book-cover-3d svg {
    width: 100%;
    height: 100%;
}

.drawer-meta-section {
    display: flex;
    flex-direction: column;
}

.drawer-book-title {
    font-family: var(--font-heading);
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    margin-bottom: 4px;
}

.drawer-book-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
    line-height: 1.4;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 16px;
}

.meta-row {
    display: flex;
    padding: 6px 0;
    font-size: 13px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}

.meta-row:last-child {
    border-bottom: none;
}

.meta-label {
    width: 100px;
    color: var(--text-muted);
    font-weight: 600;
}

.meta-value {
    flex: 1;
    color: var(--text-primary);
}

.section-subheading {
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}

.section-subheading i {
    width: 16px;
    height: 16px;
    color: var(--accent-primary);
}

/* Play/Pause Area */
.drawer-play-action {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.drawer-play-btn {
    background: var(--accent-gradient);
    color: white;
    border-radius: 30px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
    transition: var(--transition-normal);
}

.drawer-play-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.6);
}

.drawer-play-btn i {
    width: 24px;
    height: 24px;
}

.drawer-progress-status {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.progress-bar-container {
    width: 100%;
    height: 6px;
    background-color: var(--border-color);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--accent-gradient);
    width: 0%;
}

.progress-text {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Source Settings tabs */
.source-selector-tabs {
    display: flex;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    padding: 4px;
    border-radius: 8px;
    margin-bottom: 12px;
}

.source-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: var(--transition-fast);
}

.source-tab i {
    width: 14px;
    height: 14px;
}

.source-tab:hover {
    color: var(--text-primary);
}

.source-tab.active {
    background-color: var(--bg-card);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.source-content-container {
    background-color: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
}

.source-panel {
    display: none;
    flex-direction: column;
    gap: 12px;
}

.source-panel.active {
    display: flex;
}

.file-drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 24px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-normal);
}

.file-drop-zone.dragover {
    border-color: var(--accent-primary);
    background-color: rgba(139, 92, 246, 0.04);
}

.file-drop-zone:hover {
    border-color: var(--accent-primary);
}

.drop-icon {
    width: 32px;
    height: 32px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.drop-text {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.drop-or {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
}

.file-select-label {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 6px 16px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
}

.file-select-label:hover {
    border-color: var(--accent-primary);
    background-color: var(--border-color);
}

.linked-file-info {
    display: flex;
    align-items: center;
    gap: 12px;
    background-color: rgba(22, 163, 74, 0.08);
    border: 1px solid rgba(22, 163, 74, 0.2);
    padding: 12px;
    border-radius: 6px;
}

.success-icon {
    color: var(--success);
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.file-details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.file-name {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    font-size: 11px;
    color: var(--text-muted);
}

.unlink-file-btn, .unlink-cloud-btn {
    color: var(--text-muted);
    padding: 6px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.unlink-file-btn:hover, .unlink-cloud-btn:hover {
    color: hsl(0, 84%, 60%);
    background-color: rgba(239, 68, 68, 0.1);
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.input-with-button {
    display: flex;
    gap: 8px;
}

.input-with-button input {
    flex: 1;
    height: 36px;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0 12px;
    font-size: 13px;
}

.input-with-button input:focus {
    border-color: var(--accent-primary);
    outline: none;
}

.save-url-btn {
    background-color: var(--accent-primary);
    color: white;
    border-radius: 6px;
    padding: 0 14px;
    font-size: 12px;
    font-weight: 600;
    transition: var(--transition-fast);
}

.save-url-btn:hover {
    background-color: var(--accent-primary-hover);
}

.linked-cloud-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: rgba(139, 92, 246, 0.08);
    border: 1px solid rgba(139, 92, 246, 0.2);
    padding: 10px 12px;
    border-radius: 6px;
}

.cloud-link-status {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.source-info-text {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
}

.book-description-text {
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--text-secondary);
}

/* Format paragraph tags in the description correctly */
.book-description-text p {
    margin-bottom: 12px;
}
.book-description-text b, .book-description-text strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* --- Bottom Sticky Audio Player --- */
.app-player {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100vw;
    height: var(--player-height);
    background-color: rgba(10, 12, 18, 0.75);
    backdrop-filter: blur(24px);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.4);
    z-index: 15;
    padding: 0 32px;
    display: flex;
    align-items: center;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.player-inner {
    width: 100%;
    display: grid;
    grid-template-columns: 280px 1fr 280px;
    align-items: center;
    gap: 24px;
}

/* Player Left: Mini Cover & Text */
.player-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.player-mini-cover {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}

.player-mini-cover svg {
    width: 100%;
    height: 100%;
}

.player-mini-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.player-mini-title {
    font-family: var(--font-heading);
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.player-mini-author {
    font-size: 11.5px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Player Center: Timeline & Buttons */
.player-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.player-controls {
    display: flex;
    align-items: center;
    gap: 20px;
}

.player-btn {
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    transition: var(--transition-fast);
}

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

.control-secondary {
    position: relative;
}

.skip-badge {
    position: absolute;
    font-size: 8px;
    font-weight: 800;
    top: 52%;
    left: 50%;
    transform: translate(-50%, -40%);
    color: var(--text-secondary);
    pointer-events: none;
}

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

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

.player-btn-play {
    background: var(--accent-gradient);
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(139, 92, 246, 0.3);
    transition: var(--transition-normal);
}

.player-btn-play:hover {
    transform: scale(1.06);
    box-shadow: 0 6px 14px rgba(139, 92, 246, 0.5);
}

.player-btn-play i {
    width: 20px;
    height: 20px;
}

/* Adjust play icon positioning for alignment */
#player-play-icon {
    margin-left: 2px;
}

.player-btn-source-action {
    display: flex;
    align-items: center;
    gap: 6px;
    background-color: rgba(139, 92, 246, 0.12);
    border: 1px solid rgba(139, 92, 246, 0.2);
    color: var(--accent-primary);
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: var(--transition-fast);
}

.player-btn-source-action:hover {
    background-color: var(--accent-primary);
    color: white;
}

.player-btn-source-action i {
    width: 12px;
    height: 12px;
}

.player-file-alert {
    display: flex;
    align-items: center;
    gap: 4px;
    background-color: rgba(249, 115, 22, 0.12);
    border: 1px solid rgba(249, 115, 22, 0.2);
    color: var(--warning);
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 12px;
    cursor: pointer;
    text-transform: uppercase;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 0.8; }
    50% { opacity: 1; box-shadow: 0 0 8px rgba(249, 115, 22, 0.3); }
    100% { opacity: 0.8; }
}

/* Timeline Track */
.player-timeline {
    width: 100%;
    max-width: 580px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.time-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    width: 54px;
    text-align: center;
}

.timeline-slider-wrapper {
    flex: 1;
    position: relative;
    height: 16px;
    display: flex;
    align-items: center;
}

/* Range input styling overrides */
.timeline-slider-wrapper input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 4px;
    background: var(--bg-input);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
    z-index: 2;
}

.timeline-slider-wrapper input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-primary);
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-fast);
}

.timeline-slider-wrapper input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.4);
    background: var(--accent-primary);
}

/* Interactive timeline fill overlay */
.timeline-progress {
    position: absolute;
    left: 0;
    height: 4px;
    background: var(--accent-gradient);
    border-radius: 2px;
    pointer-events: none;
    z-index: 1;
}

/* Player Right: Volume & Speed */
.player-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 18px;
}

/* Speed Dropdown Menu */
.player-speed-control {
    position: relative;
}

.speed-toggle-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    transition: var(--transition-fast);
}

.speed-toggle-btn:hover {
    border-color: var(--text-muted);
    color: var(--text-primary);
}

.speed-toggle-btn i {
    width: 14px;
    height: 14px;
    color: var(--accent-primary);
}

.speed-dropdown {
    position: absolute;
    bottom: calc(100% + 12px);
    right: 0;
    background-color: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 4px;
    display: none;
    flex-direction: column;
    min-width: 80px;
    box-shadow: var(--shadow-md);
    z-index: 10;
}

.speed-dropdown.show {
    display: flex;
}

.speed-dropdown button {
    padding: 6px 12px;
    text-align: left;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: 4px;
    transition: var(--transition-fast);
}

.speed-dropdown button:hover {
    background-color: var(--bg-card);
    color: var(--text-primary);
}

.speed-dropdown button.active {
    color: var(--accent-primary);
    font-weight: 700;
}

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

.volume-slider-wrapper {
    position: relative;
    width: 80px;
    height: 16px;
    display: flex;
    align-items: center;
}

.volume-slider-wrapper input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 4px;
    background: var(--bg-input);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
    z-index: 2;
}

.volume-slider-wrapper input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-secondary);
}

.volume-slider-wrapper input[type="range"]::-webkit-slider-thumb:hover {
    background: var(--text-primary);
}

.volume-progress {
    position: absolute;
    left: 0;
    height: 4px;
    background-color: var(--accent-primary);
    border-radius: 2px;
    pointer-events: none;
    z-index: 1;
}

/* --- Google Drive Streaming Modal --- */
.drive-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(5, 7, 10, 0.7);
    backdrop-filter: blur(8px);
    z-index: 30;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition-normal);
}

.drive-modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.drive-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -45%) scale(0.9);
    width: 720px;
    max-width: 90vw;
    background-color: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    z-index: 31;
    box-shadow: var(--shadow-lg), 0 0 30px rgba(139, 92, 246, 0.1);
    opacity: 0;
    pointer-events: none;
    transition: transform var(--transition-normal), opacity var(--transition-normal);
    overflow: hidden;
}

.drive-modal.open {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    pointer-events: auto;
}

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

.drive-modal-header h3 {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.drive-modal-header h3 i {
    color: var(--accent-primary);
}

.close-modal-btn {
    color: var(--text-muted);
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-modal-btn:hover {
    color: var(--text-primary);
}

.drive-modal-body {
    width: 100%;
    aspect-ratio: 16 / 9;
    background-color: black;
}

.drive-modal-body iframe {
    width: 100%;
    height: 100%;
}

.drive-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

/* --- Responsive Layout Adjustments --- */
@media (max-width: 1024px) {
    .app-sidebar {
        display: none; /* Collapsible sidebar implementation can be handled via toggle if needed */
    }
    
    .player-inner {
        grid-template-columns: 200px 1fr 200px;
        gap: 16px;
    }
    
    .player-mini-cover {
        width: 36px;
        height: 36px;
    }
    
    .volume-slider-wrapper {
        width: 60px;
    }
}

@media (max-width: 768px) {
    .app-header {
        padding: 0 16px;
    }
    
    .header-search {
        margin: 0 16px;
    }
    
    .header-stats {
        display: none;
    }
    
    .player-inner {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto;
        gap: 8px;
    }
    
    .player-left {
        display: none; /* hide mini info on small mobile */
    }
    
    .player-right {
        justify-content: center;
    }
    
    .app-player {
        height: 120px;
    }
    
    .book-drawer {
        width: 100vw;
    }
}

/* --- Cover Image Layout --- */
.book-cover-img-wrapper {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
    background-color: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
}

.book-cover-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: var(--transition-normal);
}

.book-card:hover .book-cover-img {
    transform: scale(1.06);
}
