/* ============================================
   MAPA — full-screen map with overlay panel
   ============================================ */

/* Body adjustments for map page */
body.page-mapa {
    overflow: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
}
body.page-mapa::before { display: none; }
body.page-mapa .bg-decoration { display: none; }

.page-mapa .site-header {
    flex-shrink: 0;
    position: relative;
    backdrop-filter: none;
    background: var(--cream);
    z-index: 100;
}

/* ============================================
   MAIN LAYOUT
   ============================================ */
.mapa-main {
    flex: 1;
    position: relative;
    min-height: 0;
}

.mapa-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background: #e8e8e8;
    z-index: 1;
}

/* Leaflet zoom control restyle */
.leaflet-bar a,
.leaflet-bar a:hover {
    background: var(--paper) !important;
    color: var(--ink) !important;
    border-color: var(--ink) !important;
    font-weight: 700;
    font-size: 1.3rem;
}
.leaflet-control-attribution {
    font-size: 0.7rem !important;
    background: rgba(255,255,255,0.9) !important;
}

/* Move zoom controls so they don't overlap the panel */
.leaflet-top.leaflet-left {
    left: auto;
    right: 16px;
    top: 16px;
}

/* ============================================
   OVERLAY PANEL — slides in from left
   ============================================ */
.overlay-panel {
    position: absolute;
    top: 16px;
    left: 16px;
    bottom: 16px;
    width: 400px;
    max-width: calc(100% - 32px);
    background: var(--paper);
    border: 3px solid var(--ink);
    border-radius: var(--r-lg);
    box-shadow: 0 6px 0 var(--ink), 0 20px 40px rgba(26, 34, 56, 0.2);
    z-index: 20;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 350ms cubic-bezier(0.4, 0, 0.2, 1),
    opacity 250ms ease;
}

.overlay-panel.is-hidden {
    transform: translateX(calc(-100% - 32px));
    opacity: 0;
    pointer-events: none;
}

/* ============================================
   PANEL VIEW (list / detail)
   ============================================ */
.panel-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.panel-head {
    flex-shrink: 0;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.2rem 1.4rem 1rem;
    border-bottom: 2px dashed var(--ink-muted);
    background: var(--cream);
}
.panel-head-text {
    flex: 1;
}
.panel-head-text .section-eyebrow {
    margin-bottom: 0.2rem;
    font-size: 0.95rem;
}
.panel-h1 {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 900;
    letter-spacing: -0.01em;
    line-height: 1;
}

.panel-close {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--paper);
    border: 2px solid var(--ink);
    box-shadow: 0 2px 0 var(--ink);
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
    color: var(--ink);
    cursor: pointer;
    transition: transform var(--t-fast), box-shadow var(--t-fast);
    flex-shrink: 0;
}
.panel-close:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 0 var(--ink);
    background: var(--sun-light);
}
.panel-close:active {
    transform: translateY(1px);
    box-shadow: 0 1px 0 var(--ink);
}

.panel-back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: var(--olive);
    color: var(--paper);
    border: 2px solid var(--ink);
    border-radius: var(--r-pill);
    box-shadow: 0 3px 0 var(--ink);
    font-family: var(--font-body);
    font-weight: 800;
    font-size: 0.95rem;
    cursor: pointer;
    transition: transform var(--t-fast), box-shadow var(--t-fast);
}
.panel-back:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 0 var(--ink);
}
.panel-back:active {
    transform: translateY(1px);
    box-shadow: 0 2px 0 var(--ink);
}

/* ============================================
   EVENTS LIST (View A)
   ============================================ */
.events-list {
    list-style: none;
    padding: 1.2rem;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    overflow-y: auto;
}

.event-item {
    background: var(--paper);
    border: 2px solid var(--ink);
    border-radius: var(--r-md);
    padding: 0.9rem 1rem;
    cursor: pointer;
    transition: transform var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
    box-shadow: 0 3px 0 var(--ink);
    display: flex;
    gap: 0.8rem;
    align-items: flex-start;
    text-align: left;
}
.event-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 0 var(--ink);
    background: var(--cream-deep);
}
.event-item.is-active {
    background: var(--sun-light);
}
.event-item-icon {
    font-size: 1.7rem;
    line-height: 1;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--sun);
    border: 2px solid var(--ink);
    border-radius: var(--r-sm);
}
.event-item-content {
    flex: 1;
    min-width: 0;
}
.event-item-title {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.1rem;
    margin-bottom: 0.2rem;
    color: var(--ink);
    line-height: 1.2;
}
.event-item-meta {
    font-size: 0.88rem;
    color: var(--ink-soft);
    font-weight: 600;
    line-height: 1.3;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}
.event-item-meta-icon {
    opacity: 0.7;
}
.event-item-empty {
    font-style: italic;
    color: var(--ink-muted);
    font-size: 0.85rem;
}

/* ============================================
   DETAIL VIEW (View B)
   ============================================ */
.detail-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.2rem 1.4rem 1.5rem;
}

/* Header part: icon + name + address */
.detail-place {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.detail-place-icon {
    font-size: 1.8rem;
    width: 52px;
    height: 52px;
    background: var(--sun);
    border: 2px solid var(--ink);
    border-radius: var(--r-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 3px 0 var(--ink);
}
.detail-place-text {
    flex: 1;
    min-width: 0;
    padding-top: 0.15rem;
}
.detail-place-name {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 0.3rem;
    color: var(--ink);
}
.detail-place-address {
    font-size: 0.95rem;
    color: var(--ink-soft);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

/* Action buttons row */
.detail-actions {
    display: flex;
    gap: 0.7rem;
    margin-bottom: 1.8rem;
}
.detail-action {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.9rem 1rem;
    border: 2px solid var(--ink);
    border-radius: var(--r-pill);
    box-shadow: 0 3px 0 var(--ink);
    font-family: var(--font-body);
    font-weight: 800;
    font-size: 0.95rem;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: transform var(--t-fast), box-shadow var(--t-fast);
}
.detail-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 0 var(--ink);
}
.detail-action:active {
    transform: translateY(1px);
    box-shadow: 0 2px 0 var(--ink);
}
.detail-action-primary {
    background: var(--olive);
    color: var(--paper);
}
.detail-action-secondary {
    background: var(--paper);
    color: var(--ink);
}
.detail-action-secondary[aria-disabled="true"] {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

/* "Najbližšie podujatie" highlight card */
.detail-next-section {
    margin-bottom: 1.5rem;
}
.detail-section-title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 800;
    margin-bottom: 0.7rem;
    color: var(--ink);
}

.detail-next-card {
    background: var(--cream-deep);
    border: 2px solid var(--olive);
    border-radius: var(--r-md);
    padding: 1.2rem;
    position: relative;
}
.detail-next-label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--olive-dark);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.detail-next-name {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 800;
    line-height: 1.2;
    color: var(--ink);
    margin-bottom: 0.7rem;
}
.detail-meta-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    color: var(--ink-soft);
    font-weight: 600;
    margin-bottom: 0.3rem;
}
.detail-meta-row:last-child { margin-bottom: 0; }
.detail-meta-row-icon {
    opacity: 0.7;
    flex-shrink: 0;
}

/* Other events list */
.detail-other-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.detail-other-item {
    background: var(--paper);
    border: 2px solid var(--ink-muted);
    border-radius: var(--r-md);
    padding: 0.9rem 1rem;
}
.detail-other-name {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1rem;
    color: var(--ink);
    margin-bottom: 0.3rem;
    line-height: 1.2;
}
.detail-other-meta {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    font-size: 0.88rem;
    color: var(--ink-soft);
    font-weight: 600;
}
.detail-other-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.detail-no-events {
    background: var(--cream-deep);
    border: 2px dashed var(--ink-muted);
    border-radius: var(--r-md);
    padding: 1.2rem;
    text-align: center;
    color: var(--ink-soft);
    font-size: 0.95rem;
}

/* Event "More info" link buttons */
.event-info-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.7rem;
    padding: 0.55rem 1rem;
    background: var(--paper);
    color: var(--ink);
    border: 2px solid var(--ink);
    border-radius: var(--r-pill);
    box-shadow: 0 2px 0 var(--ink);
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 0.9rem;
    text-decoration: none;
    transition: transform var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.event-info-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 0 var(--ink);
    background: var(--sun-light);
}
.event-info-link:active {
    transform: translateY(1px);
    box-shadow: 0 1px 0 var(--ink);
}
.event-info-link-arrow {
    margin-left: 0.1rem;
    opacity: 0.5;
    font-size: 0.85em;
}
/* Bigger version for the "Najbližšie podujatie" card */
.event-info-link-primary {
    margin-top: 1rem;
    padding: 0.7rem 1.2rem;
    background: var(--olive);
    color: var(--paper);
    font-size: 0.95rem;
    box-shadow: 0 3px 0 var(--ink);
}
.event-info-link-primary:hover {
    background: var(--olive-dark);
    box-shadow: 0 5px 0 var(--ink);
}
.event-info-link-primary .event-info-link-arrow {
    opacity: 0.8;
}

/* Neaktívny stav — keď URL ešte nie je v JSON */
.event-info-link.is-disabled {
    background: var(--paper);
    color: var(--ink-soft, #777);
    border-color: var(--ink-soft, #aaa);
    box-shadow: 0 2px 0 var(--ink-soft, #aaa);
    cursor: not-allowed;
    opacity: 0.7;
    font-weight: 600;
}
.event-info-link.is-disabled:hover {
    transform: none;
    box-shadow: 0 2px 0 var(--ink-soft, #aaa);
    background: var(--paper);
}
.event-info-link-primary.is-disabled {
    background: var(--paper);
    color: var(--ink-soft, #777);
    box-shadow: 0 3px 0 var(--ink-soft, #aaa);
}
.event-info-link-primary.is-disabled:hover {
    box-shadow: 0 3px 0 var(--ink-soft, #aaa);
}

/* ============================================
   FLOATING BUTTONS (over the map)
   ============================================ */

/* Bench button: bottom center */
.floating-bench-btn {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 15;
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    padding: 1rem 1.6rem;
    background: var(--sun);
    border: 3px solid var(--ink);
    border-radius: var(--r-pill);
    box-shadow: 0 5px 0 var(--ink), 0 12px 24px rgba(26, 34, 56, 0.2);
    font-family: var(--font-body);
    font-weight: 800;
    font-size: 1.05rem;
    color: var(--ink);
    cursor: pointer;
    transition: transform var(--t-fast), box-shadow var(--t-fast);
    white-space: nowrap;
}
.floating-bench-btn:hover {
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0 7px 0 var(--ink), 0 14px 28px rgba(26, 34, 56, 0.25);
    background: var(--sun-light);
}
.floating-bench-btn:active {
    transform: translateX(-50%) translateY(2px);
    box-shadow: 0 3px 0 var(--ink), 0 8px 16px rgba(26, 34, 56, 0.2);
}
.floating-bench-btn:disabled {
    opacity: 0.7;
    cursor: wait;
}
.bench-btn-icon {
    font-size: 1.6rem;
    line-height: 1;
}

/* List re-open button: top-left (shown when panel is closed) */
.floating-list-btn {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 15;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.2rem;
    background: var(--olive);
    color: var(--paper);
    border: 3px solid var(--ink);
    border-radius: var(--r-pill);
    box-shadow: 0 4px 0 var(--ink), 0 8px 16px rgba(26, 34, 56, 0.15);
    font-family: var(--font-body);
    font-weight: 800;
    font-size: 1rem;
    cursor: pointer;
    transition: transform var(--t-fast), box-shadow var(--t-fast);
}
.floating-list-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 var(--ink), 0 10px 20px rgba(26, 34, 56, 0.2);
}
.floating-list-btn:active {
    transform: translateY(1px);
    box-shadow: 0 3px 0 var(--ink);
}

/* ============================================
   TOAST (status messages, lavica result)
   ============================================ */
.map-toast {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    max-width: min(440px, calc(100% - 32px));
    background: var(--paper);
    border: 3px solid var(--ink);
    border-radius: var(--r-md);
    box-shadow: 0 4px 0 var(--ink), 0 8px 20px rgba(26, 34, 56, 0.2);
    padding: 1rem 1.2rem;
    z-index: 30;
    animation: toast-in 250ms ease-out;
}
.map-toast.is-info { background: var(--sky); }
.map-toast.is-success { background: #C8E6C9; }
.map-toast.is-error { background: var(--rose); }
.map-toast.is-loading { background: var(--sun-light); }

.toast-row {
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
}
.toast-text {
    flex: 1;
    min-width: 0;
}
.toast-title {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.05rem;
    line-height: 1.2;
    margin-bottom: 0.15rem;
}
.toast-message {
    font-size: 0.92rem;
    color: var(--ink-soft);
    line-height: 1.4;
}
.toast-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.4rem;
    color: var(--ink-soft);
    line-height: 1;
    padding: 0 0.2rem;
    flex-shrink: 0;
}
.toast-action {
    margin-top: 0.7rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    background: var(--ink);
    color: var(--cream);
    border-radius: var(--r-pill);
    font-weight: 700;
    font-size: 0.9rem;
    text-decoration: none;
}
.toast-action:hover {
    background: var(--olive-dark);
}

@keyframes toast-in {
    from { opacity: 0; transform: translateX(-50%) translateY(-12px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ============================================
   CUSTOM MARKERS — based on draft image
   ============================================ */
.poi-marker {
    background: transparent !important;
    border: none !important;
}

.poi-marker-card {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: var(--paper);
    border: 3px solid var(--sun);
    border-radius: 12px;
    box-shadow:
            0 0 0 2px var(--ink),
            0 4px 0 var(--ink),
            0 8px 16px rgba(26, 34, 56, 0.25);
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
    transition: transform 150ms ease, box-shadow 150ms ease;
    position: relative;
}

.poi-marker:hover .poi-marker-card,
.poi-marker-card.is-active {
    transform: translateY(-3px);
    box-shadow:
            0 0 0 2px var(--ink),
            0 7px 0 var(--ink),
            0 12px 20px rgba(26, 34, 56, 0.3);
}

.poi-marker-card.is-active {
    background: var(--sun-light);
    border-color: var(--sun-deep);
}

/* Label under the marker */
.poi-marker-label {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--paper);
    border: 2px solid var(--ink);
    border-radius: 8px;
    padding: 3px 10px;
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--ink);
    white-space: nowrap;
    box-shadow: 0 2px 0 var(--ink);
    pointer-events: none;
}

/* Bench marker - different style */
.bench-marker .poi-marker-card {
    background: var(--leaf);
    border-color: var(--sun);
    color: var(--paper);
    font-size: 1.5rem;
    width: 48px;
    height: 48px;
}
.bench-marker.is-nearest .poi-marker-card {
    width: 56px;
    height: 56px;
    font-size: 1.8rem;
}

/* User location marker */
.user-marker {
    background: transparent !important;
    border: none !important;
}
.user-marker-dot {
    width: 24px;
    height: 24px;
    background: var(--olive);
    border: 4px solid var(--paper);
    border-radius: 50%;
    box-shadow: 0 0 0 2px var(--olive), 0 0 0 8px rgba(46, 91, 186, 0.25);
    animation: user-pulse 2s ease-in-out infinite;
}
@keyframes user-pulse {
    0%, 100% { box-shadow: 0 0 0 2px var(--olive), 0 0 0 8px rgba(46, 91, 186, 0.25); }
    50% { box-shadow: 0 0 0 2px var(--olive), 0 0 0 16px rgba(46, 91, 186, 0.1); }
}

/* ============================================
   RESPONSIVE
   ============================================ */
/* ===== MOBILE: posuň tlačidlo lavičky vyššie, aby nebolo skryté ===== */
@media (max-width: 768px) {
    .floating-bench-btn {
        bottom: 90px !important;
    }
}
@media (max-width: 760px) {
    .overlay-panel {
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        max-height: 60vh;
        border-radius: var(--r-lg) var(--r-lg) 0 0;
        border-bottom: none;
        box-shadow: 0 -6px 0 var(--ink), 0 -10px 30px rgba(26, 34, 56, 0.15);
    }
    .overlay-panel.is-hidden {
        transform: translateY(100%);
    }

    /* Move zoom to bottom-right on mobile to avoid overlap */
    .leaflet-top.leaflet-left {
        top: auto;
        right: 12px;
        bottom: 100px;
    }

    .floating-bench-btn {
        bottom: 16px;
        padding: 0.85rem 1.2rem;
        font-size: 0.95rem;
    }
    .bench-btn-icon { font-size: 1.4rem; }

    .floating-list-btn {
        top: 12px;
        left: 12px;
        padding: 0.65rem 1rem;
        font-size: 0.95rem;
    }

    .panel-h1 { font-size: 1.5rem; }
    .detail-place-name { font-size: 1.3rem; }

    /* On mobile, when panel is open, hide bench btn to avoid overlap */
    .overlay-panel:not(.is-hidden) ~ .floating-bench-btn {
        opacity: 0;
        pointer-events: none;
    }
}

@media (max-width: 480px) {
    .header-inner {
        gap: 0.4rem;
        padding-block: 0.6rem;
    }
    .nav-btn {
        padding: 0.5rem 0.8rem;
        font-size: 0.85rem;
    }
    .logo-text { font-size: 1.1rem; }

    .detail-actions {
        flex-direction: column;
    }

    .bench-btn-text {
        /* Keep text but allow shrink */
    }
}
