/**
 * Audiobook Carousel Styles
 * Modern audiobook catalog design with card-based layout
 */

/* Main Container */
.audiobook-catalog {
    width: 100%;
    margin: 0 auto;
    padding: 20px 0;
}

/* Grid Layout */
.audiobook-grid-wrapper {
    display: grid;
    grid-template-columns: repeat(var(--columns, 3), 1fr);
    gap: 24px;
    margin-bottom: 20px;
}

/* Carousel Layout */
.audiobook-carousel-wrapper {
    display: flex;
    gap: 24px;
    overflow: hidden;
    margin-bottom: 20px;
    position: relative;
}

.layout-carousel .audiobook-card.hidden-post {
    display: none;
}

/* Audiobook Card - Scoped to carousel only */
.audiobook-catalog .audiobook-card {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: all 0.3s ease;
    position: relative;
    min-height: 450px;
    display: flex;
    flex-direction: column;
}

.audiobook-catalog .audiobook-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.audiobook-catalog .audiobook-card.featured {
    border: 2px solid #FF5C17;
}

/* Cover Image - Scoped to carousel only */
.audiobook-catalog .audiobook-cover {
    position: relative;
    height: 200px;
    overflow: hidden;
    background: linear-gradient(45deg, #f0f0f0, #e0e0e0);
}

.audiobook-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.audiobook-catalog .audiobook-card:hover .audiobook-cover img {
    transform: scale(1.05);
}

.audiobook-catalog .placeholder-cover {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 48px;
}

/* Featured Badge - Scoped to carousel only */
.audiobook-catalog .featured-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #FF5C17;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    z-index: 2;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 92, 23, 0.7); }
    70% { box-shadow: 0 0 0 8px rgba(255, 92, 23, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 92, 23, 0); }
}

/* Play Button Overlay - Scoped to carousel only */
.audiobook-catalog .play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.audiobook-catalog .audiobook-card:hover .play-overlay {
    opacity: 1;
}

.play-btn {
    background: #FF5C17;
    border: none;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    color: white;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.audiobook-catalog .play-btn:hover {
    background: #e04a14;
    transform: scale(1.1);
}

/* Content Area - Scoped to carousel only */
.audiobook-catalog .audiobook-content {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.audiobook-catalog .audiobook-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 12px 0;
    line-height: 1.3;
    color: #5c4d41!important;
}

.audiobook-catalog .audiobook-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.3s ease;
}

.audiobook-catalog .audiobook-title a:hover {
    color: #FF5C17;
}

/* Meta Information - Scoped to carousel only */
.audiobook-catalog .audiobook-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 12px;
    font-size: 14px;
    color: #555555;
}

.audiobook-catalog .audiobook-meta > div {
    display: flex;
    align-items: center;
    gap: 6px;
}

.audiobook-catalog .audiobook-meta .duration {
    color: #FF5C17;
    font-weight: 600;
}

.audiobook-catalog .audiobook-meta i {
    font-size: 12px;
}

/* Description - Scoped to carousel only */
.audiobook-catalog .audiobook-description {
    color: #5c4d3f!important;
    line-height: 1.6;
    margin-bottom: 16px;
    flex: 1;
    font-size: 14px;
}

/* Mini Player - Scoped to carousel only */
.audiobook-catalog .mini-player {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 16px;
    border: 1px solid #e9ecef;
}

.audiobook-catalog .mini-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.audiobook-catalog .mini-play-btn {
    background: #FF5C17;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: background 0.3s ease;
}

.audiobook-catalog .mini-play-btn:hover {
    background: #e04a14;
}

.audiobook-catalog .mini-progress {
    flex: 1;
    height: 4px;
    background: #e9ecef;
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.audiobook-catalog .mini-progress-fill {
    height: 100%;
    background: #FF5C17;
    width: 0%;
    transition: width 0.1s ease;
}

.mini-time {
    font-size: 12px;
    color: #555555;
    min-width: 40px;
    text-align: right;
    font-weight: 500;
}

/* Mini player error state */
.audiobook-catalog .mini-player.error {
    background: #ffebee;
    border-color: #f44336;
}

.audiobook-catalog .mini-player.error .mini-play-btn {
    background: #f44336;
    cursor: not-allowed;
}

.audiobook-catalog .mini-player.error .mini-time {
    color: #f44336;
}

.audiobook-catalog .mini-play-btn:focus {
    background-color: #e04a14!important;
}

/* Action Buttons - Scoped to carousel only */
.audiobook-catalog .audiobook-actions {
    display: flex;
    gap: 12px;
    margin-top: auto;
}

.audiobook-catalog .read-more-btn,
.audiobook-catalog .listen-btn {
    flex: 1;
    padding: 10px 16px;
    border-radius: 6px;
    text-decoration: none;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.audiobook-catalog .read-more-btn {
    background: transparent;
    color: #FF5C17;
    border: 2px solid #FF5C17;
}

.audiobook-catalog .read-more-btn:hover {
    background: #FF5C17;
    color: white;
}

.audiobook-catalog .listen-btn {
    background: #FF5C17;
    color: white;
    border: 2px solid #FF5C17;
}

.audiobook-catalog .listen-btn:hover {
    background: #e04a14;
    border-color: #e04a14;
}

/* Carousel Navigation - Scoped to carousel only */
.audiobook-catalog .carousel-navigation {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin: 20px 0;
}

.audiobook-catalog .carousel-btn {
    background: #FF5C17;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.audiobook-catalog .carousel-btn:hover {
    background: #e04a14;
    transform: scale(1.1);
}

.audiobook-catalog .carousel-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* Expand Button - Scoped to carousel only */
.audiobook-catalog .read-more-container {
    text-align: center;
    margin-top: 20px;
}

.audiobook-catalog .expand-posts-button {
    background: transparent;
    border: 2px solid #FF5C17;
    color: #FF5C17;
    padding: 12px 24px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    font-size: 14px;
}

.audiobook-catalog .expand-posts-button:hover {
    background: #FF5C17;
    color: white;
    transform: translateY(-2px);
}

/* Notice Styles - Already scoped */
.audiobook-catalog-notice {
    text-align: center;
    padding: 40px;
    color: #666666;
    font-style: italic;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px dashed #dee2e6;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .audiobook-catalog .audiobook-grid-wrapper {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .audiobook-catalog.layout-carousel .audiobook-card.hidden-mobile {
        display: none;
    }
}

@media (max-width: 768px) {
    .audiobook-catalog {
        padding: 16px 0;
    }
    
    .audiobook-catalog .audiobook-grid-wrapper {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .audiobook-catalog .audiobook-carousel-wrapper {
        gap: 16px;
    }
    
    .audiobook-catalog .audiobook-card {
        min-height: 400px;
    }
    
    .audiobook-catalog .audiobook-cover {
        height: 180px;
    }
    
    .audiobook-catalog .audiobook-content {
        padding: 16px;
    }
    
    .audiobook-catalog .audiobook-title {
        font-size: 16px;
    }
    
    .audiobook-catalog .audiobook-meta {
        font-size: 13px;
        gap: 12px;
    }
    
    .audiobook-catalog .audiobook-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .audiobook-catalog .carousel-btn {
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 480px) {
    .audiobook-catalog {
        padding: 12px 0;
    }
    
    .audiobook-catalog .audiobook-card {
        min-height: 360px;
    }
    
    .audiobook-catalog .audiobook-cover {
        height: 160px;
    }
    
    .audiobook-catalog .audiobook-content {
        padding: 12px;
    }
    
    .audiobook-catalog .audiobook-title {
        font-size: 15px;
    }
    
    .audiobook-catalog .play-btn {
        width: 50px;
        height: 50px;
        font-size: 18px;
    }
}

/* Dark mode support, for the future dark mode web adaptation */
/*@media (prefers-color-scheme: dark) {
    .audiobook-catalog .audiobook-card {
        background: #2c3e50;
        color: #ecf0f1;
    }
    
    .audiobook-catalog .audiobook-title {
        color: #ecf0f1;
    }
    
    .audiobook-description {
        color: #bdc3c7;
    }
    
    .mini-player {
        background: #34495e;
        border-color: #4a5f7a;
    }
    
    .audiobook-catalog-notice {
        background: #34495e;
        color: #bdc3c7;
        border-color: #4a5f7a;
    }
}*/

/* Animation for loading states */
@keyframes shimmer {
    0% { background-position: -200px 0; }
    100% { background-position: calc(200px + 100%) 0; }
}

.audiobook-card.loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200px 100%;
    animation: shimmer 1.5s infinite;
}
