/* ===========================================================================
   zivemapy.cz - sdileny mapovy engine (komponenty)
   Pouziva tokeny z assets/css/styl-zivemapy.css (musi byt nacteny pred timhle souborem).
   Vzor layoutu: Virske okruhy (okruhy-projekt/aplikace) - mapa fullscreen,
   chipy+seznam jako sbalitelny bottom sheet (mobil) / plovouci panel (desktop),
   detail bodu a doplnkovy obsah jako modal.
   =========================================================================== */

.zm-app { position: relative; }

/* --- fullscreen appka (mapa+topbar+FAB+sheet pres celou plochu) --- */
html.zm-fullscreen, html.zm-fullscreen body { height: 100%; overflow: hidden; overscroll-behavior: none; }
.zm-shell { position: fixed; inset: 0; height: 100dvh; background: var(--bg-base); }

.zm-shell .zm-map { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 0; border: none; }

/* --- topbar --- */
.zm-topbar {
    position: absolute; z-index: 600; top: 0; left: 0; right: 0;
    padding: calc(env(safe-area-inset-top, 0px) + 10px) calc(env(safe-area-inset-right, 0px) + 12px) 10px calc(env(safe-area-inset-left, 0px) + 14px);
    display: flex; align-items: center; gap: .6rem;
    background: linear-gradient(to bottom, rgba(6,9,18,.85) 0%, rgba(6,9,18,.45) 70%, transparent 100%);
    pointer-events: none;
}
.zm-topbar > * { pointer-events: auto; }
.zm-topbar-brand { display: flex; align-items: center; gap: .6rem; min-width: 0; color: var(--text); text-decoration: none; }
.zm-topbar-logo { width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0; box-shadow: 0 4px 16px rgba(0,0,0,.35); object-fit: cover; }
.zm-topbar-titles { min-width: 0; line-height: 1.15; }
.zm-topbar-t1 { font-weight: 800; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 6px rgba(0,0,0,.6); }
.zm-topbar-t2 { font-weight: 600; font-size: .68rem; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 4px rgba(0,0,0,.6); }
.zm-topbar-badge { font-size: .62rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--warn); border: 1px solid rgba(240,184,106,.4); padding: .25rem .55rem; border-radius: 100px; white-space: nowrap; flex-shrink: 0; }
.zm-topbar-spacer { flex: 1 1 auto; }

.zm-icon-btn {
    width: 38px; height: 38px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 11px;
    background: var(--bg-deep); border: 1px solid var(--border-strong);
    backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2);
    box-shadow: 0 4px 16px rgba(0,0,0,.3);
    color: var(--text); transition: transform .12s ease;
}
.zm-icon-btn:active { transform: scale(.92); }
.zm-icon-btn svg { width: 19px; height: 19px; }

/* --- FAB sloupec --- */
.zm-fab-col {
    position: absolute; z-index: 600;
    right: calc(env(safe-area-inset-right, 0px) + 12px);
    bottom: calc(var(--sheet-h, 132px) + env(safe-area-inset-bottom, 0px) + 16px);
    display: flex; flex-direction: column; gap: 10px;
    transition: bottom .28s cubic-bezier(.22,.61,.36,1);
}
.zm-fab {
    width: 46px; height: 46px; display: grid; place-items: center; border-radius: 14px;
    background: var(--bg-deep); border: 1px solid var(--border-strong);
    backdrop-filter: blur(16px) saturate(1.25); -webkit-backdrop-filter: blur(16px) saturate(1.25);
    box-shadow: 0 10px 34px rgba(0,0,0,.42);
    color: var(--text); transition: transform .12s ease, background .15s, color .15s;
}
.zm-fab:active { transform: scale(.9); }
.zm-fab svg { width: 22px; height: 22px; }
.zm-fab.active { background: var(--accent); color: #06111f; border-color: transparent; }
.zm-fab.searching svg { animation: zm-spin 1s linear infinite; }
@keyframes zm-spin { to { transform: rotate(360deg); } }

/* --- bottom sheet: chipy + seznam (sbalitelne pres "grab" madlo) --- */
.zm-sheet {
    position: absolute; z-index: 550; left: 0; right: 0; bottom: 0;
    padding: 10px calc(env(safe-area-inset-right, 0px) + 14px) calc(env(safe-area-inset-bottom, 0px) + 14px) calc(env(safe-area-inset-left, 0px) + 14px);
    background: linear-gradient(to top, var(--bg-deep) 60%, rgba(13,18,32,.92) 100%);
    border-top: 1px solid var(--border-strong);
    border-radius: 22px 22px 0 0;
    backdrop-filter: blur(18px) saturate(1.2); -webkit-backdrop-filter: blur(18px) saturate(1.2);
    box-shadow: 0 -10px 40px rgba(0,0,0,.45);
}
.zm-grab { width: 40px; height: 5px; border-radius: 3px; background: var(--border-strong); margin: 0 auto 10px; cursor: pointer; }
.zm-sheet .zm-chips { margin: 0 0 .6rem; padding: 0 .1rem .1rem; }
.zm-list-wrap { max-height: 42vh; overflow-y: auto; padding-right: .2rem; }
.zm-sheet.collapsed .zm-list-wrap { display: none; }
.zm-sheet.collapsed .zm-chips { margin-bottom: 0; }

@media (min-width: 760px) {
    .zm-sheet { left: 16px; right: auto; bottom: 16px; width: 380px; border-radius: 20px; border: 1px solid var(--border-strong); }
    .zm-list-wrap { max-height: min(58vh, 520px); }
    .zm-fab-col { bottom: calc(env(safe-area-inset-bottom, 0px) + 18px); }
}

.zm-attrib-note { font-size: .74rem; color: var(--text-dim); margin-top: .5rem; }
.mapy-logo { line-height: 0; margin: 0 0 4px 8px !important; }
.mapy-logo img { height: 20px; filter: drop-shadow(0 1px 3px rgba(0,0,0,.6)); }

/* povinne logo + atribuce mapy.com - vyzdvizene nad sheet, aby byly vzdy videt */
.zm-shell .leaflet-bottom.leaflet-left {
    bottom: calc(var(--sheet-h, 132px) + env(safe-area-inset-bottom, 0px) + 8px);
    transition: bottom .28s cubic-bezier(.22,.61,.36,1);
}
.zm-shell .leaflet-control-zoom { display: none; }

/* --- katerie chipy --- */
.zm-chips { display: flex; gap: .5rem; overflow-x: auto; padding: .2rem .1rem .6rem; scrollbar-width: none; }
.zm-chips::-webkit-scrollbar { display: none; }
.zm-chip {
    flex: 0 0 auto; display: flex; align-items: center; gap: .45rem;
    padding: .55rem 1rem; border-radius: 100px; font-size: .82rem; font-weight: 700;
    background: rgba(255,255,255,.04); border: 1px solid var(--border-strong); color: var(--text-soft);
    transition: all .2s var(--ease-out);
}
.zm-chip svg { width: 15px; height: 15px; }
.zm-chip.active { background: var(--accent-bg); border-color: var(--accent-border); color: var(--accent-light); }
.zm-chip .zm-chip-count { opacity: .65; font-weight: 500; }

/* --- seznam bodu razeny dle vzdalenosti --- */
.zm-list { display: flex; flex-direction: column; gap: .6rem; }
.zm-item {
    display: flex; align-items: center; gap: .9rem;
    padding: .85rem 1rem; border-radius: 16px;
    background: rgba(255,255,255,.03); border: 1px solid var(--border);
    transition: background .2s, border-color .2s;
}
.zm-item:hover { background: rgba(255,255,255,.06); border-color: var(--border-strong); }
.zm-item-ico {
    flex-shrink: 0; width: 40px; height: 40px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    background: var(--accent-bg); color: var(--accent-light);
}
.zm-item-ico svg { width: 20px; height: 20px; }
.zm-item-body { flex: 1; min-width: 0; }
.zm-item-name { font-weight: 700; font-size: .95rem; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zm-item-meta { font-size: .8rem; color: var(--text-muted); display: flex; gap: .5rem; align-items: center; }
.zm-item-dist { font-weight: 700; color: var(--accent-light); flex-shrink: 0; }
.zm-item-visited { color: var(--accent-light); flex-shrink: 0; }
.zm-item-visited svg { width: 18px; height: 18px; }

/* --- pocitadlo sbirky --- */
.zm-counter {
    display: inline-flex; align-items: center; gap: .5rem;
    padding: .5rem .9rem; border-radius: 100px; background: var(--accent-bg); border: 1px solid var(--accent-border);
    font-size: .82rem; font-weight: 700; color: var(--accent-light);
}
.zm-counter svg { width: 15px; height: 15px; }

/* --- modaly: detail bodu, info a dalsi doplnkovy obsah --- */
/* Spolecny "overlay" vzor: na mobilu sedi jako karta pri spodnim okraji,
   na desktopu vycentrovana - pouziva se pro detail POI i pro info modal. */
.zm-overlay { position: fixed; inset: 0; z-index: 900; background: rgba(6,9,18,.72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); display: flex; align-items: flex-end; justify-content: center; opacity: 0; pointer-events: none; transition: opacity .25s; }
.zm-overlay.open { opacity: 1; pointer-events: auto; }
.zm-panel {
    width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto;
    background: var(--bg-deep); border: 1px solid var(--border-strong); border-bottom: none;
    border-radius: 24px 24px 0 0; padding: 1.6rem 1.6rem 2rem;
    transform: translateY(24px); transition: transform .3s var(--ease-out);
    position: relative; text-align: left;
}
.zm-overlay.open .zm-panel { transform: translateY(0); }
@media (min-width: 760px) {
    .zm-overlay { align-items: center; }
    .zm-panel { border-radius: 24px; border-bottom: 1px solid var(--border-strong); }
}
.zm-panel-close { position: absolute; top: 1.1rem; right: 1.1rem; width: 36px; height: 36px; border-radius: 10px; background: rgba(255,255,255,.06); border: 1px solid var(--border-strong); display: flex; align-items: center; justify-content: center; color: var(--text); }
.zm-panel-close svg { width: 18px; height: 18px; }
.zm-panel h2 { margin-bottom: .5rem; padding-right: 2.4rem; }
.zm-panel p { color: var(--text-soft); }

/* -- detail bodu (obsah .zm-panel pro POI) -- */
.zm-detail-photo { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 14px; margin-bottom: .3rem; background: rgba(255,255,255,.04); }
.zm-detail-photo-attrib { font-size: .68rem; color: var(--text-dim); margin-bottom: 1rem; }
.zm-detail-cat { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--accent-light); margin-bottom: .3rem; }
.zm-detail-text { color: var(--text-soft); margin-bottom: 1.3rem; }
.zm-detail-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.zm-detail-actions .btn { grid-column: span 1; }
.zm-detail-actions .btn-full { grid-column: 1 / -1; }
.zm-detail-checkin { margin-top: 1rem; padding: 1rem; border-radius: 14px; background: var(--accent-bg); border: 1px solid var(--accent-border); text-align: center; }
.zm-detail-checkin.far { background: rgba(255,255,255,.03); border-color: var(--border); }
.zm-detail-checkin .zm-checkin-dist { font-weight: 800; font-size: 1.05rem; color: var(--accent-light); margin-bottom: .5rem; }
.zm-detail-checkin.far .zm-checkin-dist { color: var(--text-muted); }

/* -- info modal (obsah .zm-panel je stranka-specificky, jen zakladni typografie) -- */
.zm-info-eyebrow { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--accent-light); margin-bottom: .4rem; }
.zm-info-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; margin: 1.2rem 0; }
.zm-info-fact { text-align: center; padding: .8rem .4rem; border-radius: 14px; background: rgba(255,255,255,.03); border: 1px solid var(--border); }
.zm-info-fact strong { display: block; font-size: 1.2rem; font-weight: 800; color: var(--accent-light); }
.zm-info-fact span { font-size: .7rem; color: var(--text-muted); }
.zm-info-actions { display: flex; flex-direction: column; gap: .6rem; margin-top: 1.4rem; }

/* --- kompas / sipka na cil --- */
.zm-compass { position: fixed; inset: 0; z-index: 950; background: var(--bg-base); display: flex; flex-direction: column; }
.zm-compass-top { padding: 1.2rem var(--gutter) .5rem; display: flex; align-items: center; justify-content: space-between; }
.zm-compass-close { width: 40px; height: 40px; border-radius: 12px; background: rgba(255,255,255,.06); border: 1px solid var(--border-strong); display: flex; align-items: center; justify-content: center; color: var(--text); }
.zm-compass-close svg { width: 20px; height: 20px; }
.zm-compass-title { font-weight: 800; font-size: 1rem; }
.zm-compass-body { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.6rem; padding: 1rem; }
.zm-compass-dial { position: relative; width: min(64vw, 280px); height: min(64vw, 280px); border-radius: 50%; border: 2px solid var(--border-strong); background: radial-gradient(circle, rgba(47,111,184,.12), transparent 70%); display: flex; align-items: center; justify-content: center; }
.zm-compass-arrow { width: 46%; height: 46%; color: var(--accent-light); filter: drop-shadow(0 0 18px var(--accent-glow)); transition: transform .15s linear; }
.zm-compass-dist { font-size: clamp(2.2rem, 9vw, 3.2rem); font-weight: 900; letter-spacing: -.02em; }
.zm-compass-acc { font-size: .85rem; color: var(--text-muted); }
.zm-compass-label { font-size: 1.05rem; font-weight: 700; color: var(--text-soft); text-align: center; }
.zm-compass-far { padding: .7rem 1.2rem; border-radius: 100px; background: rgba(240,184,106,.12); border: 1px solid rgba(240,184,106,.35); color: var(--warn); font-weight: 800; font-size: .85rem; letter-spacing: .04em; text-transform: uppercase; }
.zm-compass-fallback { text-align: center; color: var(--text-muted); font-size: .85rem; max-width: 280px; }
.zm-compass-bottom { padding: 1.4rem var(--gutter) calc(1.4rem + env(safe-area-inset-bottom)); }

/* --- toasty --- */
.zm-toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 970; display: flex; flex-direction: column; gap: .5rem; align-items: center; pointer-events: none; width: 100%; padding: 0 1rem; }
.zm-toast { background: var(--bg-deep); border: 1px solid var(--border-strong); color: var(--text); padding: .8rem 1.2rem; border-radius: 100px; font-size: .85rem; font-weight: 600; box-shadow: 0 8px 24px rgba(0,0,0,.35); opacity: 0; transform: translateY(8px); transition: opacity .25s, transform .25s; max-width: 90vw; text-align: center; }
.zm-toast.show { opacity: 1; transform: translateY(0); }

/* --- badge / odznak sbirky --- */
.zm-badge-unlock { position: fixed; inset: 0; z-index: 980; background: rgba(6,9,18,.85); display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity .3s; }
.zm-badge-unlock.open { opacity: 1; pointer-events: auto; }
.zm-badge-card { text-align: center; padding: 2.4rem; max-width: 320px; }
.zm-badge-icon { width: 84px; height: 84px; margin: 0 auto 1.2rem; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent-light)); display: flex; align-items: center; justify-content: center; box-shadow: 0 0 40px var(--accent-glow); }
.zm-badge-icon svg { width: 42px; height: 42px; color: #06170f; }
