/* Modal styling */
.mori-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    align-items: center;
    justify-content: center;
}

.mori-modal.active {
    display: flex;
}

.mori-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    cursor: pointer;
}

.mori-modal-content {
    position: relative;
    width: 90%;
    max-width: 1200px;
    max-height: 90vh;
    background: #000000;
    border-radius: 8px;
    overflow: hidden;
    z-index: 1;
}

.mori-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
    transition: background 0.3s ease;
}

.mori-modal-close:hover {
    background: rgba(0, 0, 0, 0.9);
}

.mori-modal-body {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio for video */
    height: 0;
    overflow: hidden;
}

/* PDF modal - different aspect ratio */
#mori-pdf-modal .mori-modal-body {
    padding-bottom: 75%; /* 4:3 aspect ratio for PDF */
}

/* Image modal - flexible height */
.mori-image-modal .mori-modal-body {
    padding-bottom: 0;
    height: auto;
    max-height: 85vh;
    overflow-y: auto;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    background: #f5f5f5;
    padding: 20px;
}

.mori-image-modal .mori-modal-body img {
    max-width: 100%;
    width: auto;
    height: auto;
    max-height: none;
    display: block;
    object-fit: contain;
}

.mori-modal-body video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Hide overflow menu button (3-dot menu) and download button - Webkit */
.mori-modal-body video::-webkit-media-controls-overflow-button {
    display: none !important;
}

.mori-modal-body video::-webkit-media-controls-download-button {
    display: none !important;
}

.mori-modal-body video::-internal-media-controls-overflow-button {
    display: none !important;
}

.mori-modal-body video::-webkit-media-controls-enclosure {
    overflow: hidden;
}

.mori-modal-body video::-webkit-media-controls-panel {
    width: calc(100% + 60px);
}

/* Additional hiding for safety */
video[controlslist*="nodownload"]::-webkit-media-controls-download-button,
video[controlslist*="nodownload"]::-internal-media-controls-download-button {
    display: none !important;
}

/* Responsive modal */
@media (max-width: 768px) {
    .mori-modal-content {
        width: 95%;
        max-height: 85vh;
    }
}
