/* ============================================================
   admin-page-modal.css
   فتح صفحات الأدمن/الموزع داخل مودال (iframe) بدل تبويب/صفحة جديدة.
   • .apm-*       : هيكل المودال (يُحمَّل فى القالب العام للأدمن والموزع).
   • html.is-framed : الصفحة تُعرض داخل المودال → إخفاء الشريط العلوى والهيدر والتذييل.
   ============================================================ */

html.is-framed .topbar,
html.is-framed body > header,
html.is-framed #mobileNav,
html.is-framed body > footer,
html.is-framed .guest-banner,
html.is-framed .tour-fab,
html.is-framed #tourGuideFab {
    display: none !important;
}

html.is-framed body::before {
    display: none !important;
}

html.is-framed body {
    background: #fff;
}

html.is-framed .admin-container {
    padding: 12px;
}

.apm-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2vh 2vw;
    background: rgba(8, 20, 35, 0.62);
    backdrop-filter: blur(3px);
    animation: apmFade 0.18s ease;
}

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

.apm-panel {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 1400px;
    height: 100%;
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 24px 72px rgba(0, 0, 0, 0.4);
}

.apm-header {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    color: #fff;
    background: linear-gradient(135deg, #0f2640 0%, #1a3a5c 100%);
    border-bottom: 3px solid #c8860a;
}

.apm-title {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 1rem;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.apm-btn {
    flex: 0 0 auto;
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 0;
    color: #fff;
    background: rgba(255, 255, 255, 0.14);
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.15s ease;
}

.apm-btn:hover,
.apm-btn:focus-visible {
    color: #fff;
    background: rgba(255, 255, 255, 0.28);
}

.apm-body {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    background: #f4f6f9;
}

.apm-frame {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    background: #fff;
}

.apm-loader {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: grid;
    place-items: center;
    background: #fff;
}

.apm-loader[hidden] {
    display: none;
}

@media (max-width: 767.98px) {
    .apm-overlay {
        padding: 0;
    }

    .apm-panel {
        max-width: none;
        border-radius: 0;
    }

    .apm-header {
        padding-top: calc(10px + env(safe-area-inset-top, 0px));
        padding-inline: max(14px, env(safe-area-inset-right, 0px), env(safe-area-inset-left, 0px));
    }
}

@media print {
    .apm-overlay {
        display: none !important;
    }
}
