/* Dobyvatelé - interactive SVG map styles */

.map-wrap {
    position: relative;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    background: linear-gradient(180deg, #eaf4fb 0%, #d4e8f5 100%);
    border: 1px solid #b8d2e6;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(20, 50, 80, 0.12);
    overflow: hidden;
}

#dobyvatele-map {
    display: block;
    width: 100%;
    height: auto;
    background: transparent;
}

#dobyvatele-map .orp {
    fill: #f2efe6;
    stroke: #6f7a86;
    stroke-width: 0.6;
    stroke-linejoin: round;
    transition: fill 120ms ease-out, stroke 120ms ease-out, stroke-width 120ms ease-out;
    cursor: pointer;
}

#dobyvatele-map .orp:hover {
    stroke: #1a3a5c;
    stroke-width: 1.6;
    filter: brightness(1.08);
}

#dobyvatele-map .orp.selected {
    stroke: #d83f1e;
    stroke-width: 2.2;
}

#dobyvatele-map .orp.hl {
    stroke: #1a3a5c;
    stroke-width: 1.8;
    filter: brightness(1.12);
}

.map-tooltip {
    position: absolute;
    pointer-events: none;
    background: rgba(20, 30, 45, 0.94);
    color: #fff;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
    line-height: 1.4;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    z-index: 50;
    max-width: 220px;
    opacity: 0;
    transition: opacity 90ms ease-out;
}

.map-tooltip.visible {
    opacity: 1;
}

.map-tooltip strong {
    display: block;
    margin-bottom: 2px;
    font-size: 13px;
}
.map-tooltip .tt-state {
    font-size: 16px;
    line-height: 1.15;
    color: #fff;
}
.map-tooltip .tt-state--empty {
    color: #c8d4dd;
    font-style: italic;
    font-weight: normal;
}
.map-tooltip .tt-owner {
    font-size: 12px;
    color: #d6e8f0;
    margin-top: 2px;
}
.map-tooltip .tt-team {
    color: #aac0d0;
}
.map-tooltip .tt-orp {
    font-size: 10px;
    color: #8fa8b8;
    margin-top: 4px;
    font-style: italic;
}

.map-tooltip em {
    color: #b8d2e6;
    font-style: normal;
    font-size: 11px;
}

.map-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 1rem;
}

.map-legend a {
    padding: 0.3rem 0.7rem;
    border-radius: 3px;
    font-size: 0.9rem;
    text-decoration: none;
    border: 1px solid rgba(0, 0, 0, 0.15);
    cursor: pointer;
}

.map-loading {
    padding: 2rem;
    text-align: center;
    color: #888;
    font-style: italic;
}

/* ── Zoom controls (touch-friendly) ── */
.zoom-controls {
    position: absolute;
    right: 10px;
    bottom: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 10;
}

.zoom-controls .zoom-btn {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    border: 1px solid #1a3a5c;
    background: rgba(255, 255, 255, 0.95);
    color: #1a3a5c;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.zoom-controls .zoom-btn:hover { background: #1a3a5c; color: #fff; }
.zoom-controls .zoom-btn:active { transform: scale(0.95); }

#dobyvatele-map { touch-action: pan-y pinch-zoom; }

/* ── Mobile breakpoints ── */
@media (max-width: 768px) {
    .map-wrap { border-radius: 0; }
    .zoom-controls .zoom-btn { width: 48px; height: 48px; font-size: 22px; }
    #dobyvatele-map .orp { stroke-width: 0.4; }
    .map-tooltip { font-size: 14px; max-width: 100%; padding: 12px 14px; }
}

/* ── Touch: tooltip becomes a bottom sheet, never off-screen ── */
.map-tooltip.sheet {
    position: fixed;
    left: 0 !important;
    right: 0;
    bottom: 0;
    top: auto !important;
    width: 100%;
    max-width: 100%;
    border-radius: 12px 12px 0 0;
    padding: 14px 18px 18px;
    padding-bottom: calc(18px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.25);
    pointer-events: auto;
    z-index: 1000;
    font-size: 14px;
}

.map-tooltip-close {
    position: absolute;
    top: 6px;
    right: 10px;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 10px;
    touch-action: manipulation;
}
.map-tooltip:not(.sheet) .map-tooltip-close { display: none; }

/* ── Mobile attack picker (list view fallback) ── */
.mobile-target-list {
    display: none;
    margin-top: 1rem;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 0.6rem;
}
.mobile-target-list h3 {
    margin: 0 0 0.5rem;
    font-size: 1rem;
    color: #1a3a5c;
}
.mobile-target-list .target-row {
    padding: 0.6rem 0.5rem;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}
.mobile-target-list .target-row:last-child { border-bottom: none; }
.mobile-target-list .target-row:hover, .mobile-target-list .target-row.active {
    background: #eaf4fb;
}
.mobile-target-list .target-row .swatch {
    width: 20px; height: 20px; border-radius: 3px; border: 1px solid #888; flex-shrink: 0;
}
.mobile-target-list .target-row .info { flex: 1; min-width: 0; }
.mobile-target-list .target-row .name { font-weight: bold; }
.mobile-target-list .target-row .meta { font-size: 0.8rem; color: #666; }

.view-toggle {
    display: none;
    gap: 0.3rem;
    margin-bottom: 0.6rem;
}
.view-toggle button {
    flex: 1;
    padding: 0.6rem;
    background: #fff;
    border: 1px solid #aaa;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}
.view-toggle button.active {
    background: #1a3a5c;
    color: #fff;
    border-color: #1a3a5c;
}

@media (max-width: 600px) {
    .view-toggle { display: flex; }
    body.view-list .map-wrap { display: none; }
    body.view-list .mobile-target-list { display: block; }
    body.view-map .map-wrap { display: block; }
    body.view-map .mobile-target-list { display: none; }
}

