/* Bookshelf Styles */
.library-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

.bookshelf {
    width: 100%;
    background-color: #5d4037;
    /* Dark wood color */
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    border: 8px solid #3e2723;
}

.shelf {
    background-color: #8d6e63;
    /* Lighter wood for shelf board */
    margin-bottom: 25px;
    border-radius: 5px;
    height: 100px;
    /* Thicker shelf look */
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    cursor: pointer;
    box-shadow: 0 5px 0 #3e2723;
    /* 3D effect for shelf thickness */
    transition: transform 0.2s, background-color 0.2s;
    position: relative;
}

.shelf:last-child {
    margin-bottom: 0;
}

.shelf:hover {
    transform: scale(1.02);
    background-color: #a1887f;
}

.shelf-label {
    font-size: 1.5rem;
    font-weight: bold;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    background: rgba(0, 0, 0, 0.3);
    padding: 8px 15px;
    border-radius: 10px;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 10px;
}

.shelf-icon-img {
    height: 50px;
    filter: drop-shadow(2px 2px 2px rgba(0, 0, 0, 0.5));
}

/* Decorative Books on Shelves */
.books {
    display: flex;
    align-items: flex-end;
    height: 80%;
}

.book {
    width: 25px;
    border-radius: 3px;
    margin-left: 5px;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.2);
}

/* Random heights for books */
.book:nth-child(1) {
    height: 60px;
}

.book:nth-child(2) {
    height: 75px;
}

.book:nth-child(3) {
    height: 55px;
}

/* Book Colors */
.book.red {
    background: #e57373;
    border-left: 3px solid #c62828;
}

.book.blue {
    background: #64b5f6;
    border-left: 3px solid #1565c0;
}

.book.green {
    background: #81c784;
    border-left: 3px solid #2e7d32;
}

.book.purple {
    background: #ba68c8;
    border-left: 3px solid #6a1b9a;
}

.book.yellow {
    background: #fff176;
    border-left: 3px solid #f9a825;
}

.book.orange {
    background: #ffb74d;
    border-left: 3px solid #ef6c00;
}

/* Accordion Video Styles */
.shelf-videos {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease-out;
    background: rgba(255, 255, 255, 0.9);
    width: 95%;
    /* Slightly narrower than shelf */
    margin: 0 auto;
    border-radius: 0 0 10px 10px;
}

.shelf-videos.active {
    max-height: 2000px;
    /* Large enough to fit content */
    padding: 20px;
    margin-bottom: 20px;
    /* Space after open shelf */
    border: 5px solid #3e2723;
    border-top: none;
    /* Connect to shelf above */
}

/* Specific Shelf Active State */
.shelf.active-shelf {
    background-color: #a1887f;
    border-radius: 5px 5px 0 0;
    /* Flatten bottom corners when open */
    margin-bottom: 0;
    /* Remove margin to connect with video area */
    box-shadow: none;
    /* Remove shadow to look seamless */
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    width: 100%;
}

.video-card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s;
    cursor: pointer;
}

.video-card:hover {
    transform: translateY(-5px);
}

.video-thumbnail {
    width: 100%;
    aspect-ratio: 16/9;
    background-size: cover;
    background-position: center;
    position: relative;
    border-bottom: 4px solid var(--primary-color);
}

.play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    color: white;
    opacity: 0.8;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    transition: transform 0.2s;
}

.video-card:hover .play-icon {
    transform: translate(-50%, -50%) scale(1.2);
}

.video-title {
    padding: 15px;
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
}

.back-button {
    display: inline-block;
    background: white;
    padding: 10px 20px;
    border-radius: 20px;
    text-decoration: none;
    color: var(--primary-color);
    font-weight: bold;
    margin-top: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
}

.back-button:hover {
    transform: scale(1.05);
}

@media (max-width: 600px) {
    .shelf {
        flex-direction: column;
        justify-content: center;
        gap: 10px;
        height: auto;
        padding: 15px;
    }

    .books {
        display: none;
        /* Hide decorative books on small screens for cleaner look */
    }
}