/* This file is part of Moodle - http://moodle.org/
 *
 * Moodle is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Moodle is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 */

/**
 * Modal styles for Popuphandler
 *
 * @package    local_popuphandler
 * @copyright  2025 YOUR NAME <your@email.com>
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */

/* Modal container */
.popuphandler-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.popuphandler-modal.show {
    opacity: 1;
}

/* Overlay/backdrop */
.popuphandler-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    z-index: 9998;
}

/* Modal content box */
.popuphandler-content {
    position: relative;
    width: 90%;
    height: 90%;
    max-width: none;
    max-height: 90vh;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.popuphandler-modal.show .popuphandler-content {
    transform: scale(1);
}

/* Header with close button */
.popuphandler-header {
    padding: 10px 15px;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    background-color: #f5f5f5;
    border-radius: 8px 8px 0 0;
    gap: 15px;
}

.popuphandler-download {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    border-radius: 6px;
    padding: 8px;
}

.popuphandler-download:hover {
    color: #000;
    background-color: #e0e0e0;
}

/* Config button — shown to admins/managers in image resource modals */
.popuphandler-config-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    margin-right: auto;
    font-size: 13px;
    font-weight: 500;
    color: #555;
    background-color: #e8e8e8;
    border: 1px solid #ccc;
    border-radius: 6px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.popuphandler-config-btn:hover {
    color: #000;
    background-color: #d4d4d4;
    border-color: #aaa;
    text-decoration: none;
}

.popuphandler-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    font-size: 32px;
    font-weight: bold;
    color: #666;
    cursor: pointer;
    line-height: 1;
    transition: all 0.2s ease;
    user-select: none;
    border-radius: 6px;
}

.popuphandler-close:hover {
    color: #000;
    background-color: #e0e0e0;
}

/* Body with iframe */
.popuphandler-body {
    flex: 1;
    padding: 0;
    overflow: hidden;
    border-radius: 0 0 8px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f9f9f9;
}

.popuphandler-body iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

.popuphandler-body img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border: none;
    display: block;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .popuphandler-content {
        width: 95%;
        height: 95%;
    }
    
    .popuphandler-close {
        font-size: 28px;
    }
}

/* Prevent body scroll when modal is open */
body.modal-open {
    overflow: hidden;
}
