/* =========================================================
   JP MindMap 0.3 — CLEAN SHELL
   Wszystkie reguły ograniczone do .jpmap-embed.
   ========================================================= */

.jpmap-embed {
    --jpmap-height: 720px;
    position: relative;
    width: 100%;
    margin: 1.5rem 0;
    overflow: hidden;

    border: 1px solid #dfe3e8;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 4px 18px rgba(0, 0, 0, .08);
}


/* ---------- nasz pasek ---------- */

.jpmap-shell {
    position: relative;
    z-index: 100;

    min-height: 52px;
    box-sizing: border-box;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;

    padding: 8px 12px 8px 18px;

    border-bottom: 1px solid #e4e7eb;
    background: #fff;
}

.jpmap-shell-title {
    min-width: 0;
    overflow: hidden;

    font-size: 18px;
    line-height: 1.25;
    font-weight: 600;

    white-space: nowrap;
    text-overflow: ellipsis;
}


/* ---------- fullscreen ---------- */

.jpmap-fullscreen {
    flex: 0 0 auto;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;

    min-height: 36px;
    padding: 6px 11px;

    border: 1px solid #cfd5dc;
    border-radius: 8px;

    background: #fff;
    color: inherit;

    font: inherit;
    cursor: pointer;
}

.jpmap-fullscreen:hover {
    background: #f4f6f8;
}

.jpmap-fullscreen-icon {
    font-size: 18px;
    line-height: 1;
}


/* ---------- obszar mapy ---------- */

.jpmap-runtime {
    position: relative;

    width: 100%;
    height: var(--jpmap-height);
    min-height: 420px;

    overflow: hidden;
    background: #fff;
}

.jpmap-runtime > .app,
.jpmap-runtime .paper-container {
    width: 100%;
    height: 100%;
}


/* =========================================================
   SPRZĄTANIE CHROME MINDMANAGERA
   Nie ingerujemy w silnik ani canvas.
   ========================================================= */

.jpmap-embed .toolbar-logo,
.jpmap-embed .btn-menu,
.jpmap-embed .btn-open,
.jpmap-embed .btn-close,
.jpmap-embed .btn-help,
.jpmap-embed .btn-switch-mode,
.jpmap-embed .btn-download,
.jpmap-embed .btn-upload,
.jpmap-embed .btn-share,
.jpmap-embed .btn-presentation-save,
.jpmap-embed .menu-version {
    display: none !important;
}

/* Nazwę mapy pokazujemy już we własnym shellu. */
.jpmap-embed .map-name-and-filter-toggle-wrap .map-name {
    display: none !important;
}


/* =========================================================
   FULLSCREEN
   ========================================================= */

.jpmap-embed:fullscreen {
    width: 100vw;
    height: 100vh;

    margin: 0;
    border: 0;
    border-radius: 0;

    background: #fff;
}

.jpmap-embed:fullscreen .jpmap-runtime {
    height: calc(100vh - 53px);
    min-height: 0;
}

.jpmap-embed:fullscreen .jpmap-shell {
    height: 53px;
}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 767px) {

    .jpmap-embed {
        margin: 1rem 0;
        border-radius: 8px;
    }

    .jpmap-runtime {
        height: 70vh;
        min-height: 420px;
    }

    .jpmap-shell {
        padding-left: 12px;
    }

    .jpmap-shell-title {
        font-size: 16px;
    }

    .jpmap-fullscreen-text {
        display: none;
    }

    .jpmap-fullscreen {
        width: 38px;
        padding-left: 0;
        padding-right: 0;
    }
}


/* ---------- błąd ---------- */

.jpmap-error {
    padding: 1rem;
    border: 1px solid #c33;
    border-radius: 6px;
    background: #fff;
}

/* =========================================================
   JP MindMap 0.3.1 — MINIMAL VIEWER UI
   ========================================================= */

/* Dolny pasek viewera */
.jpmap-embed .search-controls,
.jpmap-embed .transform-tools {
    display: none !important;
}

/* Prawy panel MindManagera */
.jpmap-embed .side-toolbox {
    display: none !important;
}

/*
 * Viewer rezerwuje miejsce na prawy toolbox.
 * Po jego usunięciu canvas ma wykorzystać całą szerokość.
 */
.jpmap-embed .joint-paper-scroller {
    width: 100% !important;
    right: 0 !important;
}


/* =========================================================
   JP MindMap 0.3.2 — MOBILE SCROLL / FULLSCREEN
   ========================================================= */

/* Desktop — duży obszar roboczy. */
@media (min-width: 768px) {
    .jpmap-runtime {
        height: var(--jpmap-height);
        min-height: 1200px;
    }
}


/*
 * TELEFON — zwykły artykuł
 *
 * Mapa jest podglądem.
 * Nie przechwytuje gestów dotykowych, dzięki czemu użytkownik
 * może przeciągnąć palcem po mapie i nadal przewijać stronę.
 *
 * Do interaktywnej pracy z mapą służy Pełny ekran.
 */
@media (max-width: 767px) {

    .jpmap-runtime {
        height: 72svh;
        min-height: 460px;
        max-height: 720px;
    }

    .jpmap-embed:not(:fullscreen) .jpmap-runtime {
        pointer-events: none;
        touch-action: pan-y;
    }

    /*
     * Nasz nagłówek pozostaje aktywny,
     * więc przycisk Pełny ekran nadal działa.
     */
    .jpmap-embed:not(:fullscreen) .jpmap-shell {
        pointer-events: auto;
    }


    /* ---------- FULLSCREEN MOBILE ---------- */

    .jpmap-embed:fullscreen {
        width: 100vw;
        height: 100dvh;
        max-height: none;
        margin: 0;

        border: 0;
        border-radius: 0;
        background: #fff;
    }

    .jpmap-embed:fullscreen .jpmap-runtime {
        width: 100%;
        height: calc(100dvh - 53px);
        min-height: 0;
        max-height: none;

        pointer-events: auto;
        touch-action: none;
    }

    .jpmap-embed:fullscreen .paper-container,
    .jpmap-embed:fullscreen .joint-paper-scroller {
        width: 100% !important;
        height: 100% !important;
    }
}


/* =========================================================
   JP MindMap 0.3.3 — RESTORE JOOMLA PAGE SCROLL
   mm-viewer.css pochodzi z pełnej aplikacji MindManagera
   i nie może kontrolować dokumentu Joomla.
   ========================================================= */

html {
    height: auto !important;
    min-height: 100% !important;
    overflow-y: auto !important;
}

body {
    height: auto !important;
    min-height: 100vh !important;
    overflow-y: auto !important;
}

/* Poza fullscreen strona Joomla zawsze ma być przewijalna. */
body:not(:has(.jpmap-embed:fullscreen)) {
    overscroll-behavior-y: auto !important;
}


/* Telefon — gest pionowy należy do strony, nie do viewera. */
@media (max-width: 767px) {
    html,
    body {
        overflow-y: auto !important;
        touch-action: pan-y;
    }

    .jpmap-embed:not(:fullscreen) .jpmap-runtime {
        pointer-events: none !important;
    }

    .jpmap-embed:fullscreen .jpmap-runtime {
        pointer-events: auto !important;
        touch-action: none;
    }
}


/* =========================================================
   JP MindMap 0.3.4 — BRANDED LOADER
   ========================================================= */

.jpmap-loader {
    position: absolute;
    inset: 0;
    z-index: 90;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;

    box-sizing: border-box;
    padding: 24px;

    background: #fff;

    opacity: 1;
    visibility: visible;

    transition:
        opacity .28s ease,
        visibility .28s ease;
}

.jpmap-loader.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}


/* ---------- znak / wordmark ---------- */

.jpmap-loader-logo {
    display: flex;
    align-items: center;
    gap: 11px;
}

.jpmap-loader-mark {
    width: 44px;
    height: 44px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    box-sizing: border-box;

    border: 2px solid currentColor;
    border-radius: 50%;

    font-size: 17px;
    line-height: 1;
    font-weight: 800;
    letter-spacing: -.04em;
}

.jpmap-loader-wordmark {
    font-size: 20px;
    line-height: 1;
    font-weight: 700;
    letter-spacing: .02em;
}


/* ---------- spinner ---------- */

.jpmap-loader-spinner {
    width: 26px;
    height: 26px;

    box-sizing: border-box;

    border: 3px solid #e1e5e9;
    border-top-color: #555;
    border-radius: 50%;

    animation: jpmap-loader-spin .8s linear infinite;
}

.jpmap-loader-text {
    color: #68717b;
    font-size: 14px;
}

@keyframes jpmap-loader-spin {
    to {
        transform: rotate(360deg);
    }
}


@media (max-width: 767px) {

    .jpmap-loader-wordmark {
        font-size: 17px;
    }

    .jpmap-loader-mark {
        width: 40px;
        height: 40px;
        font-size: 15px;
    }
}


/* =========================================================
   JP MindMap 0.3.5 — LOADER FIX
   ========================================================= */

.jpmap-loader {
    z-index: 999999 !important;
}


/* logo pobrane z aktualnego nagłówka strony */

.jpmap-loader-brand {
    display: flex;
    align-items: center;
    justify-content: center;

    width: min(360px, 80%);
    min-height: 70px;

    margin-bottom: 4px;

    pointer-events: none;
}

.jpmap-loader-brand img {
    display: block;

    width: auto !important;
    height: auto !important;

    max-width: 100% !important;
    max-height: 90px !important;

    object-fit: contain;
}

.jpmap-loader-brand .jpmap-loader-brand-text {
    font-size: 28px;
    line-height: 1.15;
    font-weight: 600;
}


/* stare sztuczne logo nie może się już pojawić */

.jpmap-loader-logo,
.jpmap-loader-mark,
.jpmap-loader-wordmark {
    display: none !important;
}


@media (max-width: 767px) {

    .jpmap-loader-brand {
        width: min(280px, 80%);
        min-height: 60px;
    }

    .jpmap-loader-brand img {
        max-height: 72px !important;
    }

    .jpmap-loader-brand .jpmap-loader-brand-text {
        font-size: 23px;
    }
}
