/* Main Styles */
.ebook-covers-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Covers Grid */
.ebook-covers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 25px;
    margin-top: 30px;
}

@media (max-width: 768px) {
    .ebook-covers-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }
}

/* Cover Card */
.ebook-cover-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    position: relative;
}

.ebook-cover-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.ebook-cover-image {
    position: relative;
    height: 280px;
    overflow: hidden;
}

.ebook-cover-image img.cover-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.ebook-cover-card:hover .cover-img {
    transform: scale(1.05);
}

.ebook-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.ebook-cover-card:hover .ebook-overlay {
    opacity: 1;
}

.read-online-btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: background 0.3s ease;
}

.read-online-btn:hover {
    background: #2980b9;
}

/* Audio Badge */
.audio-badge-corner {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(52, 152, 219, 0.9);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* Cover Info */
.ebook-cover-info {
    padding: 15px;
}

.ebook-cover-info h3 {
    margin: 0 0 8px 0;
    font-size: 16px;
    line-height: 1.4;
    color: #2c3e50;
    font-weight: 600;
}

.audio-info {
    margin-top: 8px;
}

.audio-info small {
    color: #7f8c8d;
    font-size: 12px;
}

/* Empty State */
.ebook-empty-state {
    text-align: center;
    padding: 60px 20px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 2px dashed #dee2e6;
}

.ebook-empty-state h3 {
    color: #2c3e50;
    margin-bottom: 15px;
}

/* Modal Styles */
.epub-reader-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: none;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
}

.modal-content {
    position: relative;
    background: white;
    margin: 30px auto;
    width: 95%;
    max-width: 1400px;
    height: calc(100vh - 60px);
    border-radius: 12px;
    overflow: hidden;
    z-index: 10000;
}

.modal-header {
    padding: 15px 25px;
    background: #2c3e50;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
}

.close-modal {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
}

.close-modal:hover {
    color: #ecf0f1;
}

.modal-body {
    height: calc(100% - 60px);
    display: flex;
    flex-direction: column;
}

#epub-reader-container {
    flex: 1;
    overflow: auto;
    padding: 20px;
    background: #f5f5f5;
}

/* Modal Controls */
.modal-controls {
    padding: 15px 25px;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
}

.reader-navigation {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 15px;
}

.modal-btn {
    padding: 8px 20px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.modal-btn:hover {
    background: #2980b9;
}

#current-page {
    font-size: 14px;
    color: #6c757d;
    min-width: 100px;
    text-align: center;
}

/* Audio Controls */
.modal-audio-controls {
    border-top: 1px solid #dee2e6;
    padding-top: 15px;
}

.modal-audio-controls h4 {
    margin: 0 0 10px 0;
    color: #2c3e50;
    font-size: 16px;
}

.audio-player {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

.modal-audio-btn {
    padding: 8px 16px;
    background: #27ae60;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.modal-audio-btn:hover {
    background: #219653;
}

.audio-progress-bar {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #dee2e6;
    outline: none;
}

.audio-time {
    font-size: 12px;
    color: #6c757d;
    min-width: 100px;
}

.audio-track-info {
    font-size: 12px;
    color: #6c757d;
}

/* List View */
.ebook-list-item {
    background: white;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    gap: 15px;
}

.ebook-list-cover {
    width: 100px;
    flex-shrink: 0;
}

.ebook-list-cover img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    border-radius: 4px;
}

.ebook-list-info {
    flex: 1;
}

.ebook-list-info h3 {
    margin: 0 0 8px 0;
    color: #2c3e50;
}

.ebook-author {
    color: #7f8c8d;
    font-size: 14px;
    margin: 8px 0;
}

.audio-badge {
    background: #e8f4fc;
    color: #3498db;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 12px;
    display: inline-block;
    margin: 8px 0;
}

.read-now-btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    margin-top: 10px;
}

.read-now-btn:hover {
    background: #2980b9;
}

/* Grid View */
.ebook-grid-item {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.ebook-grid-cover {
    height: 180px;
}

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

.ebook-grid-info {
    padding: 15px;
    text-align: center;
}

.ebook-grid-info h4 {
    margin: 0 0 10px 0;
    color: #2c3e50;
}

.read-btn {
    background: #27ae60;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    width: 100%;
}

.read-btn:hover {
    background: #219653;
}

/* Inline Readers */
.ebook-readers-container {
    margin: 40px 0;
}

.ebook-reader-wrapper {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.epub-viewer {
    height: 500px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
    margin: 15px 0;
}

.reader-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.prev-btn, .next-btn {
    padding: 8px 15px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.page-indicator {
    font-size: 14px;
    color: #666;
}

/* Loading State */
.ebook-loading {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 300px;
    text-align: center;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error State */
.epub-error {
    background: #fee;
    border: 2px solid #f99;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    margin: 20px 0;
}

.epub-error h4 {
    color: #c00;
    margin: 0 0 10px 0;
    font-size: 18px;
}

/* Responsive */
@media (max-width: 768px) {
    .modal-content {
        margin: 10px auto;
        width: 98%;
        height: calc(100vh - 20px);
    }
    
    .ebook-list-item {
        flex-direction: column;
    }
    
    .ebook-list-cover {
        width: 100%;
    }
    
    .ebook-list-cover img {
        height: 200px;
    }
}