/* ============================================
   ОБЁРТКА КАРТЫ — как было раньше
   ============================================ */

.clash-container {
    margin-top: 80px;
    width: 100%;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 16px;
    box-sizing: border-box;
}

@media (max-width: 768px) {
    .clash-container {
        margin-top: 64px;
        padding: 0 8px;
    }
}

@media (max-width: 480px) {
    .clash-container {
        margin-top: 36px;
        padding: 0 4px;
    }
}

/* ============================================
   ИНТЕРАКТИВНАЯ КАРТА — VIEWPORT & WORLD
   ============================================ */

.map-viewport {
    position: relative;
    width: 100%;
    height: 80vh;           /* ← ФИКСИРОВАННАЯ высота, НЕ auto */
    overflow: hidden;
    background: #0a0a0f;
    border-radius: 12px;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

.map-viewport:active {
    cursor: grabbing;
}

.map-viewport.is-dragging {
    cursor: grabbing;
}

.map-world {
    position: absolute;
    transform-origin: 0 0;
    will-change: transform;
}

.map-world img#clashBackImage {
    display: block;
    width: 100%;
    height: auto;
    pointer-events: none;
    -webkit-user-drag: none;
    object-fit: cover;
}

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

/* ============================================
   КОНТРОЛЫ МАСШТАБА
   ============================================ */

.map-controls {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 100;
}

.map-ctrl-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 8px;
    background: rgba(20, 20, 28, 0.9);
    color: #e0e0e0;
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    line-height: 1;
}

.map-ctrl-btn:hover {
    background: rgba(40, 40, 55, 0.95);
    transform: scale(1.05);
}

.map-ctrl-btn:active {
    transform: scale(0.95);
}

.map-zoom-indicator {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: rgba(20, 20, 28, 0.85);
    color: #aaa;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    z-index: 100;
    backdrop-filter: blur(10px);
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* ============================================
   ЭЛЕМЕНТЫ ПОСТРОЕК
   ============================================ */

.building-element {
    position: absolute;
    pointer-events: auto;
    cursor: pointer;
    transition: filter 0.2s ease;
}

.building-element:hover {
    filter: drop-shadow(0 0 12px rgba(255, 255, 255, 0.6)) brightness(1.15);
}

.building-element:active {
    filter: drop-shadow(0 0 8px rgba(255, 200, 50, 0.8)) brightness(1.2);
}

.building-element img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.5));
}

@keyframes buildingPulse {
    0%, 100% {
        filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.2));
    }
    50% {
        filter: drop-shadow(0 0 14px rgba(255, 255, 255, 0.5));
    }
}

.building-element:not(:hover) {
    animation: buildingPulse 2.5s ease-in-out infinite;
}

/* ============================================
   ПРОГРЕСС-БАР СТРОИТЕЛЬСТВА
   ============================================ */

.building-progress-wrapper {
    position: absolute;
    bottom: -24px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    display: flex;
    flex-direction: column;
    gap: 2px;
    pointer-events: none;
}

.building-progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2px;
}

.building-progress-info span {
    font-size: 10px;
    font-weight: 700;
    text-shadow: 0 0 6px rgba(59, 130, 246, 0.8), 0 1px 2px rgba(0, 0, 0, 0.9);
    white-space: nowrap;
}

.building-progress-info .progress-percent {
    color: #60a5fa;
}

.building-progress-info .progress-time {
    color: #3b82f6;
}

.building-progress-track {
    width: 100%;
    height: 6px;
    background: rgba(20, 30, 40, 0.95);
    border-radius: 3px;
    overflow: hidden;
    border: 1px solid rgba(59, 130, 246, 0.35);
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.4), inset 0 1px 2px rgba(0, 0, 0, 0.5);
}

.building-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #1e40af 0%, #3b82f6 50%, #60a5fa 100%);
    transition: width 0.5s ease;
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.7);
    position: relative;
}

@keyframes progressShine {
    0% { left: -100%; }
    100% { left: 200%; }
}

.building-progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
    animation: progressShine 2.5s infinite;
}

/* ============================================
   ТУЛТИП
   ============================================ */

#buildingTooltip {
    position: fixed;
    background: rgba(18, 18, 24, 0.96);
    color: #e5e5e5;
    padding: 14px 18px;
    border-radius: 10px;
    font-size: 14px;
    pointer-events: none;
    z-index: 10000;
    display: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
    max-width: 300px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    line-height: 1.5;
}

#buildingTooltip hr {
    border: none;
    border-top: 1px solid rgba(212, 175, 55, 0.3);
    margin: 8px 0;
}

/* ============================================
   УВЕДОМЛЕНИЯ
   ============================================ */

#notificationsContainer {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

/* ============================================
   АДАПТИВНОСТЬ
   ============================================ */

@media (max-width: 768px) {
    .map-viewport {
        height: 65vh;
        border-radius: 8px;
    }

    .map-controls {
        bottom: 14px;
        right: 14px;
    }

    .map-ctrl-btn {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }

    .map-zoom-indicator {
        bottom: 14px;
        left: 14px;
        font-size: 11px;
        padding: 4px 10px;
    }

    .building-progress-info span {
        font-size: 8px;
    }

    .building-progress-track {
        height: 4px;
    }

    .building-progress-wrapper {
        bottom: -18px;
    }
}

@media (max-width: 480px) {
    .map-viewport {
        height: 55vh;
        border-radius: 6px;
    }
}

@media (max-width: 768px) and (orientation: landscape) {
    .map-viewport {
        height: 80vh;
    }
}
