/**
 * Movie Modal CSS
 * Styles for the movie trailer modal
 */

/* Modal Container */
.movie-modal,
#movie-trailer-modal {
    display: none;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background-color: rgba(0, 0, 0, 0.8) !important;
    z-index: 2147483647 !important; /* Maximum possible z-index value */
    overflow: hidden !important;
}

/* Modal Content */
.movie-modal-content {
    position: relative !important;
    width: 90% !important;
    max-width: 900px !important;
    margin: 0 !important;
    background-color: #fff !important;
    border-radius: 8px !important;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5) !important;
    overflow: hidden !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    z-index: 2147483646 !important; /* One less than the container */
    display: flex !important;
    flex-direction: column !important;
}

/* Modal Header */
.movie-modal-header {
    background-color: #000;
    border-bottom: 1px solid #333;
    padding: 1em;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

h3#movie-modal-title {
    color: #fff;
    font-family: 'Alegreya Sans SC';
    font-size: 32px;
    padding: 0;
    margin: 0;
}

/* Close Button */
.movie-modal-close {
    color: #000;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    background: transparent;
    border: none;
    padding: 0;
    margin-left: 1rem;
}

.movie-modal-close:hover {
    color: #ff6600;
}

/* Video Container */
.movie-modal-body {
    padding: 0 !important;
    position: relative !important;
    width: 100% !important;
    height: 0 !important;
    padding-bottom: 56.25% !important; /* 16:9 aspect ratio */
    overflow: hidden !important;
}

#movie-trailer-container {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
}

#movie-trailer-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Modal Footer */
.movie-modal-footer {
    background-color: #000;
    border-top: 1px solid #333;
    text-align: justify;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.movie-modal-btn {
    display: inline-block;
    font-weight: 400;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    user-select: none;
    border: 1px solid transparent;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: 0.25rem;
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    cursor: pointer;
    text-decoration: none;
}

.movie-modal-button.movie-modal-close-btn {
    border-radius: 1em;
    padding: 1em;
    background: #535353;
    color: #fff;
    border: 0;
    margin: 1em;
    cursor: pointer;
}

a#movie-modal-details-link {
    border-radius: 1em;
    padding: 1em;
    background: #900;
    color: #fff;
    border: 0;
    margin: 1em;
    text-decoration: none;
    display: inline-block;
}

.movie-modal-btn-secondary {
    color: #fff;
    background-color: #6c757d;
    border-color: #6c757d;
}

.movie-modal-btn-secondary:hover {
    color: #fff;
    background-color: #5a6268;
    border-color: #545b62;
}

.movie-modal-btn-primary {
    color: #fff;
    background-color: #ff6600;
    border-color: #ff6600;
}

.movie-modal-btn-primary:hover {
    color: #fff;
    background-color: #e65c00;
    border-color: #d95700;
}

/* Animation */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

.movie-modal.fade-in {
    display: block;
    animation: fadeIn 0.3s ease-in-out forwards;
}

.movie-modal.fade-out {
    animation: fadeOut 0.3s ease-in-out forwards;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .movie-modal-content {
        width: 95%;
        margin: 10% auto;
    }
}

@media (max-width: 576px) {
    .movie-modal-content {
        width: 100%;
        margin: 15% auto;
    }
    
    .movie-modal-close {
        top: -35px;
        right: 5px;
    }
}

/* Prevent body scrolling when modal is open */
body.modal-open {
    overflow: hidden;
}
