.audiobook-container {
    max-width: 1200px;
}

.library-section,
.player-section {
    width: 100%;
    margin-bottom: 30px;
}

.catalog-tabs {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 16px;
}

.catalog-tab {
    padding: 9px 18px;
    border: 1px solid rgba(184, 134, 11, 0.4);
    border-radius: 999px;
    background: rgba(139, 0, 0, 0.25);
    color: #d4af37;
    cursor: pointer;
    font-weight: 600;
}

.catalog-tab.active {
    background: linear-gradient(135deg, #DC143C 0%, #8B0000 100%);
    color: white;
    border-color: rgba(220, 20, 60, 0.7);
}

.library-search {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.library-search input {
    flex: 1;
    min-width: 220px;
    max-width: 500px;
    padding: 12px 15px;
    border: 2px solid #4B0000;
    border-radius: 8px;
    font-size: 16px;
    background: #1a0000;
    color: #f5f5f5;
}

.library-search input:focus {
    outline: none;
    border-color: #DC143C;
    box-shadow: 0 0 10px rgba(220, 20, 60, 0.3);
}

.library-search button {
    padding: 12px 20px;
    background: linear-gradient(135deg, #DC143C 0%, #8B0000 100%);
    color: white;
    border: 1px solid rgba(184, 134, 11, 0.3);
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.library-search button:hover {
    background: linear-gradient(135deg, #FF1744 0%, #B71C1C 100%);
    transform: translateY(-2px);
}

.library-source {
    text-align: center;
    color: #aaa;
    font-size: 0.9em;
    margin-bottom: 20px;
}

.library-source a {
    color: #d4af37;
}

.audiobooks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.audiobook-card {
    background: rgba(139, 0, 0, 0.2);
    border: 1px solid rgba(184, 134, 11, 0.3);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s;
    cursor: pointer;
}

.audiobook-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(220, 20, 60, 0.3);
    border-color: rgba(220, 20, 60, 0.5);
}

.audiobook-card h3 {
    color: #DC143C;
    margin-bottom: 8px;
    font-size: 1.15em;
    line-height: 1.3;
}

.audiobook-card .book-author {
    color: #d4af37;
    font-size: 0.9em;
    margin-bottom: 8px;
}

.audiobook-card .book-duration {
    color: #aaa;
    font-size: 0.85em;
}

.licensed-card {
    display: flex;
    gap: 16px;
    cursor: default;
}

.licensed-card:hover {
    transform: none;
}

.book-cover {
    width: 92px;
    height: 138px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid rgba(184, 134, 11, 0.3);
}

.licensed-card-content {
    min-width: 0;
    flex: 1;
}

.provider-links {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 14px;
}

.provider-links a {
    padding: 6px 9px;
    border-radius: 6px;
    background: rgba(220, 20, 60, 0.2);
    border: 1px solid rgba(220, 20, 60, 0.35);
    color: #f5f5f5;
    text-decoration: none;
    font-size: 0.82em;
}

.provider-links a:hover {
    background: rgba(220, 20, 60, 0.45);
}

.hp-sync-button {
    padding: 6px 9px;
    border-radius: 6px;
    border: 1px solid rgba(212, 175, 55, 0.35);
    background: rgba(212, 175, 55, 0.18);
    color: #f5f5f5;
    font-size: 0.82em;
    cursor: pointer;
}

.hp-sync-button:hover {
    background: rgba(212, 175, 55, 0.35);
}

.hp-book-nav {
    margin-top: 12px;
}

.hp-book-nav-label {
    color: #d4af37;
    font-size: 0.85em;
    margin-bottom: 8px;
}

.hp-book-nav-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.hp-book-nav-button {
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(212, 175, 55, 0.3);
    background: rgba(139, 0, 0, 0.25);
    color: #f5f5f5;
    cursor: pointer;
}

.hp-book-nav-button.active {
    background: linear-gradient(135deg, #DC143C 0%, #8B0000 100%);
    border-color: rgba(220, 20, 60, 0.7);
}

.library-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 20px;
}

.library-pagination button {
    padding: 8px 16px;
    background: rgba(139, 0, 0, 0.4);
    color: #f5f5f5;
    border: 1px solid rgba(184, 134, 11, 0.3);
    border-radius: 6px;
    cursor: pointer;
}

.library-pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.book-detail {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(184, 134, 11, 0.3);
}

.back-to-library {
    background: transparent;
    border: none;
    color: #d4af37;
    cursor: pointer;
    font-size: 0.95em;
    margin-bottom: 10px;
    padding: 0;
}

.back-to-library:hover {
    color: #DC143C;
}

.book-detail h2 {
    color: #DC143C;
    margin-bottom: 8px;
}

.book-authors {
    color: #d4af37;
    margin-bottom: 6px;
}

.book-meta {
    color: #aaa;
    font-size: 0.9em;
}

.chapters-panel {
    margin-bottom: 24px;
}

.chapters-panel h3 {
    color: #d4af37;
    margin-bottom: 12px;
}

.chapters-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 280px;
    overflow-y: auto;
    padding-right: 8px;
}

.chapter-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: rgba(139, 0, 0, 0.2);
    border: 1px solid rgba(184, 134, 11, 0.2);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    min-width: 0;
}

.chapter-item:hover {
    background: rgba(220, 20, 60, 0.2);
    border-color: rgba(220, 20, 60, 0.4);
}

.chapter-item.active {
    background: rgba(220, 20, 60, 0.35);
    border-color: #DC143C;
}

.chapter-item .chapter-title {
    flex: 1;
    min-width: 0;
    color: #f5f5f5;
    font-size: 0.95em;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.chapter-item .chapter-time {
    color: #aaa;
    font-size: 0.85em;
    white-space: nowrap;
    flex-shrink: 0;
}

.audio-player-panel {
    padding: 20px;
    background: rgba(139, 0, 0, 0.15);
    border-radius: 12px;
    border: 1px solid rgba(184, 134, 11, 0.3);
}

.now-playing {
    color: #d4af37;
    margin-bottom: 12px;
    font-weight: 600;
}

#audioPlayer {
    width: 100%;
    margin-bottom: 12px;
}

.empty-message {
    grid-column: 1 / -1;
    text-align: center;
    color: #d4af37;
    font-size: 1.1em;
    padding: 40px;
    background: rgba(139, 0, 0, 0.1);
    border-radius: 12px;
    border: 2px dashed rgba(184, 134, 11, 0.3);
}

.loading-message {
    grid-column: 1 / -1;
    text-align: center;
    color: #d4af37;
    font-style: italic;
    padding: 30px;
}

@media (max-width: 768px) {
    .library-search {
        flex-direction: column;
    }

    .library-search input {
        max-width: none;
    }

    .audiobooks-grid {
        grid-template-columns: 1fr;
    }
}
