/* ============================================================================
   Content Library Styles
   Extends the existing theme system from styles-new.css
   ============================================================================ */

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Library Container */
.library-container {
    max-width: 100%;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

/* Hero Section - News style masthead */
.library-hero {
    padding: 30px 60px;
    border-bottom: 1px solid var(--border-color);
    background: var(--containerbackground);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 40px;
}

.library-hero-content {
    flex: 1;
}

.library-hero h1 {
    margin: 0 0 8px 0;
    font-size: 2em;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}

.library-hero p {
    margin: 0;
    font-size: 0.95em;
    max-width: 900px;
    color: var(--text-secondary);
}

/* Filter Bar */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-group label {
    font-weight: 600;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-primary);
}

.filter-select, .search-input {
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.95em;
    min-width: 180px;
    background: var(--containerbackground);
    color: var(--text-primary);
}

.search-input {
    min-width: 300px;
    flex: 1;
}

.filter-select:focus, .search-input:focus {
    outline: none;
    border-color: var(--accent-color);
}

/* Content Layout - News Style with Sidebar */
.content-layout {
    max-width: 1800px;
    margin: 0 auto;
    padding: 30px 60px;
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 40px;
    align-items: start;
}

.main-content {
    min-width: 0;
}

/* Featured Carousel */
.featured-section {
    margin-bottom: 40px;
    position: relative;
    overflow: hidden;
}

.featured-carousel {
    position: relative;
    width: 100%;
}

.carousel-container {
    display: flex;
    transition: transform 0.5s ease-in-out;
}

.featured-story {
    background: var(--containerbackground);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    cursor: pointer;
    transition: box-shadow 0.3s;
    border: 1px solid var(--border-color);
    min-width: 100%;
    flex-shrink: 0;
}

.featured-story:hover {
    box-shadow: var(--shadow-lg);
}

.featured-content {
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Carousel Controls */
.carousel-controls {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    pointer-events: none;
    z-index: 10;
}

.carousel-btn {
    background: var(--containerbackground);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    pointer-events: auto;
    transition: all 0.3s;
    font-size: 1.2em;
    margin: 0 10px;
}

.carousel-btn:hover {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

/* Carousel Indicators */
.carousel-indicators {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
}

.carousel-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border-color);
    cursor: pointer;
    transition: all 0.3s;
}

.carousel-indicator.active {
    background: var(--accent-color);
    width: 30px;
    border-radius: 5px;
}

/* Section Headers */
.section-header {
    margin: 60px 0 30px 0;
    padding-bottom: 15px;
    border-bottom: 3px solid var(--accent-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-header h2 {
    margin: 0;
    font-size: 2em;
    font-weight: 700;
    color: var(--text-primary);
}

/* Article List */
.article-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(450px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.article-item {
    background: var(--containerbackground);
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    border-left: 4px solid transparent;
    border: 1px solid var(--border-color);
}

.article-item:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-md);
    border-left-color: var(--accent-color);
}

.article-content {
    padding: 24px;
}

.content-type-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.7em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 10px;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: auto;
    max-width: fit-content;
}

.badge-podcast,
.badge-infographic,
.badge-opinion,
.badge-news {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.article-title {
    margin: 0 0 12px 0;
    font-size: 1.5em;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
}

.article-description {
    color: var(--text-secondary);
    font-size: 1em;
    line-height: 1.6;
    margin-bottom: 16px;
}

.article-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85em;
    color: var(--placeholder-color);
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.meta-left {
    display: flex;
    gap: 16px;
}

.visibility-badge {
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.75em;
    font-weight: 500;
    text-transform: uppercase;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

.visibility-public,
.visibility-members {
    border-color: var(--border-color);
    color: var(--text-secondary);
}

/* Podcast Sidebar */
.podcast-sidebar {
    position: sticky;
    top: 20px;
}

.sidebar-section {
    background: var(--containerbackground);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.sidebar-section h3 {
    margin: 0 0 20px 0;
    font-size: 1.3em;
    font-weight: 700;
    color: var(--text-primary);
    padding-bottom: 12px;
    border-bottom: 2px solid var(--accent-color);
}

.podcast-item {
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.3s ease;
}

.podcast-item:last-child {
    border-bottom: none;
}

.podcast-item.expanded {
    background: var(--bg-secondary);
    margin: 0 -16px;
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--accent-color);
}

.podcast-header {
    transition: all 0.2s;
}

.podcast-item:not(.expanded):hover .podcast-header {
    background: var(--bg-secondary);
    margin: 0 -16px;
    padding: 0 16px;
    border-radius: var(--radius-md);
}

.podcast-icon {
    font-size: 2em;
    margin-bottom: 8px;
    display: block;
}

.podcast-title {
    font-size: 0.95em;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
    margin-bottom: 6px;
}

.podcast-meta {
    font-size: 0.8em;
    color: var(--placeholder-color);
    display: flex;
    gap: 12px;
}

.podcast-details {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.podcast-description {
    font-size: 0.9em;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 12px;
}

.podcast-player audio {
    width: 100%;
    margin: 12px 0;
    border-radius: var(--radius-sm);
}

.podcast-actions {
    display: flex;
    justify-content: flex-start;
    margin-top: 12px;
}

.podcast-download-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    background: var(--accent-color);
    color: #ffffff !important;
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 0.9em;
    font-weight: 600;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: none;
}

.podcast-download-link:hover {
    background: var(--accent-color);
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    color: #ffffff !important;
}

.podcast-download-link:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Loading State */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    margin-top: 20px;
    color: var(--text-secondary);
    font-size: 1.1em;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 4em;
    margin-bottom: 20px;
    opacity: 0.3;
}

.empty-state h2 {
    margin: 0 0 10px 0;
    color: var(--text-primary);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: var(--containerbackground);
    border-radius: var(--radius-xl);
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    border: 1px solid var(--border-color);
}

.modal-header {
    padding: 30px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background: var(--containerbackground);
    z-index: 1;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    font-size: 2em;
    cursor: pointer;
    color: var(--text-secondary);
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 30px;
}

.modal-footer {
    padding: 20px 30px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.content-detail-meta {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    font-size: 0.95em;
    color: var(--text-secondary);
}

.content-detail-body {
    line-height: 1.8;
    font-size: 1.05em;
    color: var(--text-primary);
}

/* Responsive */
@media (max-width: 1400px) {
    .content-layout {
        grid-template-columns: 1fr 300px;
        gap: 30px;
    }
}

@media (max-width: 1200px) {
    .content-layout {
        grid-template-columns: 1fr;
        padding: 30px 40px;
    }

    .podcast-sidebar {
        position: relative;
        top: 0;
    }

    .article-list {
        grid-template-columns: 1fr;
    }

    .filter-bar {
        padding: 20px 40px;
    }

    .carousel-btn {
        width: 35px;
        height: 35px;
        font-size: 1em;
    }
}

@media (max-width: 768px) {
    .library-hero {
        padding: 30px 20px;
        flex-direction: column;
        align-items: stretch;
        gap: 20px;
    }

    .library-hero h1 {
        font-size: 2em;
    }

    .library-hero p {
        font-size: 1em;
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .filter-group {
        flex-direction: column;
        align-items: stretch;
    }

    .search-input, .filter-select {
        min-width: 100%;
    }

    .content-layout {
        padding: 20px;
    }

    .featured-content {
        padding: 24px;
    }

    .carousel-btn {
        width: 30px;
        height: 30px;
        font-size: 0.9em;
        margin: 0 5px;
    }

    .carousel-indicators {
        margin-top: 15px;
    }

    .article-title {
        font-size: 1.3em;
    }

    .section-header h2 {
        font-size: 1.6em;
    }

    .modal-content {
        max-height: 95vh;
    }
}
