body {
    font-family: 'Arial', sans-serif;
    background-color: #121212;
    color: #f0f0f0;
    margin: 0;
    padding: 0;
    display: flex;
    height: 100vh;
    justify-content: center;
    align-items: center;
}

.container {
    text-align: center;
    background-color: #1e1e1e;
    animation: backgroundShift 12s ease-in-out infinite;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0px 0px 20px rgba(0, 0, 0, 0.6);
    width: 500px;
    height: 90vh;
    overflow: hidden;
}

input {
    width: 80%;
    padding: 10px;
    margin-top: 20px;
    border-radius: 6px;
    border: none;
    outline: none;
}

button {
    margin-top: 20px;
    padding: 10px 20px;
    background-color: #008bff;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
}

button:hover {
    background-color: #0071d0;
}

#results {
    margin-top: 30px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    max-height: 60vh;
    overflow-y: auto;
    padding: 10px;
}

/* Individual cover art item */
.cover-item {
    width: 160px;
    flex: 0 0 auto;
    text-align: center;
}

.cover-item img {
    width: 100%;
    height: 240px; /* fixed height for uniform size */
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
}

.cover-item img:hover {
    transform: scale(1.05);
    transition: transform 0.2s ease;
}

.cover-title {
    margin-top: 5px;
    font-size: 0.8rem;
    color: #ccc;
}

.item-info {
    font-size: 0.7rem;
    color: #999;
}
#loader {
    border: 6px solid #f3f3f3;
    border-top: 6px solid #ff5722;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.hidden {
    display: none;
}

.light-theme {
    background-color: #f0f0f0;
    color: #121212;
}

.light-theme .container {
    background-color: #ffffff;
    color: #121212;
}

.light-theme button {
    background-color: #121212;
    color: #f0f0f0;
}

.light-theme #loader {
    border-top: 6px solid #121212;
}

.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

#recentlyAdded {
    margin-top: 40px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    max-height: 40vh;
    overflow-y: auto;
    padding: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

#recentlyAdded + h2 {
    margin-top: 30px;
    font-size: 1.2rem;
    color: #ff9800;
}

/* Light theme support */
.light-theme #recentlyAdded {
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.light-theme #recentlyAdded + h2 {
    color: #e65100;
}

#background-blur {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-size: cover;
    background-position: center;
    filter: blur(20px);
    z-index: -1;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

@keyframes backgroundShift {
    0% {
        background-color: #1e1e1e; /* dark carbon */
    }
    50% {
        background-color: #0d1b2a; /* dark blue */
    }
    100% {
        background-color: #1e1e1e; /* back to dark carbon */
    }
}

.background-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    filter: blur(20px);
    z-index: -1;
    opacity: 0;
    transition: opacity 2s ease-in-out;
}

.background-layer.visible {
    opacity: 1;
}


#background-title {
    margin-top: 40px;
    padding-top: 20px;
    text-align: center;
    color: #f0f0f0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    opacity: 0;
    transition: opacity 1s ease;
    font-size: 0.9rem;
}

#background-title.visible {
    opacity: 1;
}

#background-movie-title {
    font-size: 1.2rem;
    font-weight: bold;
    color: #ff9800;
    margin-bottom: 5px;
}

#background-movie-year {
    color: #ccc;
    margin-bottom: 8px;
}

#background-movie-summary {
    font-size: 0.85rem;
    color: #bbb;
    padding: 0 10px;
}

@media (max-width: 768px) {
    body {
        flex-direction: column;
        align-items: stretch;
        padding: 10px;
        height: auto;
    }

    .container {
        width: 100%;
        height: auto;
        padding: 20px 10px;
        box-sizing: border-box;
        border-radius: 8px;
        overflow-y: auto;
        margin-top: 20px;
    }

    input, button {
        width: 100%;
        margin-top: 10px;
    }

    #results,
    #recentlyAdded {
        max-height: none;
        flex-direction: column;
        align-items: center;
        padding: 5px;
    }

    .cover-item {
        width: 90%;
        max-width: 300px;
    }

    .cover-item img {
        height: auto;
        max-height: 300px;
    }

    #background-title {
        font-size: 1rem;
        padding: 15px 10px 0;
    }


    #background-movie-summary {
        font-size: 0.9rem;
    }

    #background-blur-1,
    #background-blur-2 {
        background-position: top center;
    }
}

.modal {
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(6px);
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: #1e1e1e;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    max-width: 400px;
    color: white;
    position: relative;
}

.modal-content img {
    max-width: 100%;
    border-radius: 8px;
    margin-bottom: 20px;
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    cursor: pointer;
}

#background-movie-title {
    cursor: pointer;
    text-decoration: underline;
}

.play-btn {
    display: inline-block;
    margin-top: 15px;
    padding: 10px 20px;
    background: #ff9800;
    color: black;
    border-radius: 8px;
    text-decoration: none;
    font-weight: bold;
}

