.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    inset: 0;
    background: rgba(0, 0, 0, 0.96);
    backdrop-filter: blur(30px);
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.5s ease;
    overflow: hidden;
}

.show-modal {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: linear-gradient(145deg, #121212, #1d1d1d);
    color: #e5e5ff;
    padding: 30px;
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.9);
    animation: fadeIn 0.6s ease-in-out;
}

/* Modal Header */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin-bottom: 15px;
}

/* Close Button */
.close-button {
    position: absolute;
    left: 15px;
    top: 0;
    font-size: 1.5rem;
    color: #e5e5ff;
    cursor: pointer;
    transition: color 0.3s;
}

.close-button:hover {
    color: #ff8abf;
}

/* Centered Title with Neon Glow */
.media-title {
    font-size: 1.8rem;
    font-weight: bold;
    color: #b095ff;
    margin: 0;
    text-align: center;
    text-shadow: 0 0 10px rgba(128, 0, 128, 0.7), 0 0 15px rgba(0, 0, 0, 0.6);
    animation: textGlow 1.5s infinite alternate;
}

/* Scrollbar Styling for Modal Content (Desktop only) */
.modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track {
    background: rgba(30, 30, 40, 0.8);
    border-radius: 8px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: rgba(90, 90, 120, 0.6);
    border-radius: 8px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: rgba(110, 110, 140, 0.8);
}

/* Media Information Section */
.media-info {
    margin-top: 10px;
    font-size: 0.95rem;
    color: #b0b0df;
    line-height: 1.6;
}

.media-info div {
    margin-bottom: 8px;
}

.media-overview {
    font-size: 1rem;
    margin-top: 15px;
    color: #cccccc;
    line-height: 1.6;
}

/* Cast Section */
.media-cast {
    margin-top: 20px;
}

.media-cast h3 {
    font-size: 1.2rem;
    margin-bottom: 10px;
    color: #ffcccc;
    text-align: center;
}

.cast-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.cast-member {
    width: 100px;
    text-align: center;
    color: #ffffff;
}

.cast-photo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 5px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6);
}

.cast-name {
    font-size: 0.85rem;
    font-weight: bold;
}

.cast-character {
    font-size: 0.75rem;
    color: #cccccc;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes textGlow {
    from {
        text-shadow: 0 0 15px rgba(128, 0, 128, 0.5);
    }
    to {
        text-shadow: 0 0 25px rgba(128, 0, 128, 0.9);
    }
}

/* Responsive Design */
@media screen and (max-width: 768px) {
    .modal-content {
        padding: 20px;
        width: 95%;
        max-width: 500px;
    }

    .cast-list {
        gap: 8px;
    }

    .cast-member {
        width: 80px;
    }

    .cast-photo {
        width: 60px;
        height: 60px;
    }

    .media-title {
        font-size: 1.5rem;
    }
}

/* Hide scrollbar on smaller screens */
@media screen and (max-width: 480px) {
    .modal-content {
        overflow-y: hidden; /* Disables vertical scrolling */
        padding: 10px;
        width: 100%;
        max-width: 500px;
    }

    .media-title {
        font-size: 1.4rem;
    }

    .cast-photo {
        width: 50px;
        height: 50px;
    }

    .cast-name {
        font-size: 0.8rem;
    }
}
