/* =============================================================
   map.css — Карта: контейнер, SVG-штаты, маркеры городов
   ============================================================= */

/* === КОНТЕЙНЕР И ОБЁРТКА КАРТЫ === */

#map-container {
    width: 100vw; height: 100vh;
    display: flex; justify-content: center; align-items: center;
    position: relative; overflow: hidden;
}

#map-wrapper {
    position: relative;
    width: 1000px;
    max-width: 100vw;
    aspect-ratio: 1000 / 589;
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

#svg {
    width: 100%; height: 100%;
    display: block;
}

/* === SVG-ШТАТЫ === */

#svg path {
    fill: #1a1a1a !important;
    stroke: #333 !important;
    stroke-width: 1 !important;
    transition: fill 0.3s ease, stroke 0.3s ease !important;
    cursor: pointer !important;
}

#svg path:hover {
    fill: #2a0808 !important;
    stroke: #8a0303 !important;
}

#svg path.active-state {
    fill: #571d1d !important;
}

/* Плавная перекраска для слоёв (SVG polygon тоже) */
#svg path, #svg polygon {
    transition: fill 0.6s ease-in-out;
}

/* === СЛОЙ ГОРОДОВ === */

#cities-layer {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none;
}

/* === МАРКЕРЫ ГОРОДОВ === */

.city-marker {
    position: absolute;
    width: 7px; height: 7px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    cursor: pointer; z-index: 5;
    pointer-events: auto;
}

/* Подпись над маркером */
.city-marker::before {
    content: attr(data-name);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translate(-50%, -5px);
    color: #a8a8a8;
    font-family: 'Cinzel', serif;
    font-size: 7px;
    white-space: nowrap;
    text-shadow:
         1px  1px 2px #000,
        -1px -1px 2px #000,
         1px -1px 2px #000,
        -1px  1px 2px #000;
    pointer-events: none;
    transition: color 0.3s ease;
}

.city-marker:hover::before {
    color: var(--blood-red);
}

/* Активный город (есть данные) */
.city-pulse {
    background-color: var(--blood-red);
    box-shadow: 0 0 10px var(--blood-red-glow);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%   { box-shadow: 0 0 0  0   rgba(138, 3, 3, 0.7); }
    70%  { box-shadow: 0 0 0 15px rgba(138, 3, 3, 0);   }
    100% { box-shadow: 0 0 0  0   rgba(138, 3, 3, 0);   }
}

/* Заблокированный город (нет данных) */
.city-locked {
    background-color: var(--locked-bg);
    border: 2px solid #444;
}

.city-locked::after {
    content: "🔒"; font-size: 10px;
    position: absolute; top: -2px; left: 1px; color: #666;
}

/* === ГОЛОГРАФИЧЕСКИЕ НАДПИСИ ШТАТОВ === */

.state-label-anim {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    fill: rgba(255, 255, 255, 0.35);
    text-anchor: middle;
    dominant-baseline: middle;
    pointer-events: none;
    animation: labelAppear 0.3s ease-out forwards;
    filter: drop-shadow(0px 0px 5px rgba(138, 3, 3, 0.8));
}

.state-label-anim.fade-out {
    opacity: 0;
    transition: opacity 1s ease-out;
}

@keyframes labelAppear {
    0%   { opacity: 0; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0);    }
}

/* === ПАНЕЛЬ УПРАВЛЕНИЯ СЛОЯМИ === */

#ui-overlay {
    position: absolute; top: 20px; left: 20px;
    z-index: 10; pointer-events: none;
}

#layer-controls {
    position: absolute;
    margin-top: 40px;
    background: rgba(10, 10, 10, 0.9);
    border: 1px solid #333;
    border-left: 3px solid var(--blood-red);
    padding: 15px;
    pointer-events: auto;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.8);
}

.layer-btn {
    background: transparent;
    border: 1px solid #444;
    color: #888;
    padding: 8px 12px;
    text-align: left;
    font-family: 'Roboto', monospace;
    font-size: 12px;
    cursor: pointer;
    transition: 0.3s;
}

.layer-btn:hover { border-color: var(--blood-red); color: #ddd; }

.layer-btn.active {
    background: rgba(138, 3, 3, 0.2);
    border-color: var(--blood-red);
    color: #fff;
    text-shadow: 0 0 5px var(--blood-red);
}

/* === ЛЕГЕНДА СЛОЁВ === */

#layer-legend {
    position: absolute;
    display: block;
    opacity: 1;
    transition: opacity 0.3s ease, all 0.3s ease;
    bottom: 30px;
    left: 240px;
    background: rgba(10, 10, 10, 0.95);
    border: 1px solid #333;
    padding: 12px;
    z-index: 100;
    min-width: 180px;
    box-shadow: 0 0 15px rgba(0,0,0,0.5);
}

#layer-legend.hidden {
    display: none;
    opacity: 0;
    transform: translateX(-10px);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
    font-size: 11px;
    color: #ccc;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.legend-color {
    width: 12px;
    height: 12px;
    border: 1px solid rgba(255,255,255,0.2);
}

.legend-title {
    font-size: 10px;
    color: var(--blood-red);
    margin-bottom: 8px;
    font-weight: bold;
    border-bottom: 1px solid #333;
    padding-bottom: 4px;
}
