/* Content Library Styles */
#backFromContentBtn {
    margin-left: 70px;
    max-width:100px;
    padding: 8px 16px;
    border: none;
    background: #88887b;
    color: white;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s ease;
}

.content-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;

    flex-wrap: wrap;
    justify-content: center;
}

.filter-btn {
    padding: 8px 16px;
    border: 1px solid #ddd;
    border-radius: 20px;
    background: white;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    color: #333; /* dark text for light theme */
}

.filter-btn.active {
    background: #88887b;
    color: white; /* White text for active button in light theme */
    border-color: #88887b;
}

.filter-btn:hover:not(.active) {
    background: #f5f5f5;
}

body.dark-theme .filter-btn {
    background: #444;
    border-color: #555;
    color: white;
}

body.dark-theme .filter-btn:hover:not(.active) {
    background: #555;
}

.content-search {
    margin-bottom: 25px;
}

#contentSearch {
    width: 100%;
    padding: 12px 20px;
    border-radius: 25px;
    border: 1px solid #ddd;
    font-size: 16px;
}

.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    padding: 10px;
}

.content-card {
    background: rgba(255, 255, 255, 0.8);
    border-radius: 15px;
    padding: 20px;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid #eee;
    overflow: hidden;
}

body.dark-theme .content-card {
    background: rgba(50, 50, 50, 0.8);
    border-color: #444;
}

.content-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.content-card-thumbnail,
.content-detail-thumbnail {
    position: relative;
    overflow: hidden;
    background: #222;
}

.content-card-thumbnail {
    aspect-ratio: 16 / 9;
    margin: -20px -20px 16px;
}

.content-card-thumbnail img,
.content-detail-thumbnail img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.content-card-thumbnail-book {
    /* Keeps tall book covers visible in the same media slot used by videos. */
    padding: 12px;
    background: #f4f1e8;
    box-sizing: border-box;
}

.content-card-thumbnail-book img {
    object-fit: contain;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.22));
}

.content-detail-thumbnail {
    aspect-ratio: 16 / 9;
    border-radius: 8px;
    margin-bottom: 20px;
    max-height: min(36vh, 320px);
}

.content-detail-thumbnail-book {
    /* Shrinks book covers so they sit comfortably above the detail text. */
    width: min(240px, 62vw);
    max-height: 36vh;
    aspect-ratio: auto;
    margin: 0 auto 20px;
    background: transparent;
}

.content-detail-thumbnail-book img {
    width: 100%;
    height: auto;
    max-height: 36vh;
    object-fit: contain;
    border-radius: 8px;
    filter: drop-shadow(0 5px 14px rgba(0, 0, 0, 0.24));
}

.content-play-link {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
}

.content-play-icon {
    width: 0;
    height: 0;
    border-top: 17px solid transparent;
    border-bottom: 17px solid transparent;
    border-left: 26px solid rgba(255, 255, 255, 0.92);
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.55));
    transform: translateX(12%);
}

.content-play-link:hover .content-play-icon,
.content-play-link:focus-visible .content-play-icon {
    border-left-color: white;
}

.content-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 10px;
}

.badge-article { background: #2196F3; color: white; }
.badge-podcast { background: #9C27B0; color: white; }
.badge-book { background: #FF9800; color: white; }
.badge-video { background: #F44336; color: white; }
.badge-recipe { background: #4CAF50; color: white; }

.content-card h3 {
    margin: 0 0 10px 0;
    font-size: 18px;
}

.content-description {
    color: #666;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/*book cover*/
.responsive-cover {
    max-width: min(240px, 100%);
    max-height: 36vh;
    height: auto;
    object-fit: contain;
    display: block;
    margin: 0 auto 1rem;
    border-radius: 8px; /* Optional: adds nice rounded corners */
}

body.dark-theme .content-description {
    color: #aaa;
}

.content-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #888;
    margin-top: 15px;
}

.content-tags {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.tag {
    background: #f0f0f0;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
}

body.dark-theme .tag {
    background: #333;
}

/* Content Detail Modal */
#contentDetailModal .modal-content {
    width: min(92vw, 860px);
    max-width: 860px;
}

.content-detail-header {
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
}

body.dark-theme .content-detail-header {
    border-bottom-color: #444;
}

#contentDetailBody {
    line-height: 1.6;
    margin-bottom: 20px;
    max-height: none;
    overflow: visible;
    padding-right: 0;
}

.content-detail-copy {
    overflow-wrap: anywhere;
}

.content-detail-footer {
    border-top: 1px solid #eee;
    padding-top: 15px;
    margin-top: 20px;
}

body.dark-theme .content-detail-footer {
    border-top-color: #444;
}

.content-detail-meta {
    display: flex;
    justify-content: space-between;
    color: #666;
    font-size: 14px;
    margin-top: 10px;
}

body.dark-theme .content-detail-meta {
    color: #aaa;
}

/* Loading State */
.content-loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.content-empty {
    text-align: center;
    padding: 60px 20px;
    color: #666;
    grid-column: 1 / -1;
}

/* Responsive */
@media (max-width: 768px) {
    .content-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
    
    .content-filters {
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 10px;
    }
}

@media (max-width: 480px) {
    #contentDetailModal .modal-content {
        width: 100%;
        max-width: 100%;
        min-height: 100vh;
        border-radius: 0;
    }

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