/* ====================================================
   КАРТА БОЕВЫХ ДЕЙСТВИЙ — battlemap.css
   ==================================================== */

/* ── Page layout ─────────────────────────────────────── */
.bm-page {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 0;
    background: #0f172a;
    overflow: hidden;
    position: relative;
}

.bm-page-header {
    position: relative;
    text-align: center;
    padding: 12px 16px 8px;
    background: rgba(15, 23, 42, 0.95);
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.bm-page-header .btn-close {
    position: absolute;
    right: 12px;
    top: 12px;
}

.bm-page-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary, #fff);
    margin: 0;
}

.bm-page-subtitle {
    font-size: 0.7rem;
    color: var(--text-secondary, #94a3b8);
    margin: 2px 0 0;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

/* ── Faction stats bar ───────────────────────────────── */
.bm-faction-stats {
    display: flex;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(15, 23, 42, 0.9);
}

.bm-faction-stat {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.bm-faction-mine {
    border: 1px solid rgba(250, 204, 21, 0.4);
    border-radius: 6px;
    padding: 3px 4px;
    background: rgba(250, 204, 21, 0.06);
}

.bm-faction-label {
    font-size: 0.65rem;
    color: var(--text-secondary, #94a3b8);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bm-faction-bar-wrap {
    height: 4px;
    background: rgba(255,255,255,0.08);
    border-radius: 2px;
    overflow: hidden;
}

.bm-faction-bar {
    height: 100%;
    border-radius: 2px;
    transition: width 0.5s ease;
}

.bm-faction-count {
    font-size: 0.6rem;
    color: var(--text-secondary, #94a3b8);
    font-family: monospace;
}

/* ── Canvas container ────────────────────────────────── */
.bm-canvas-wrap {
    flex: 1;
    position: relative;
    overflow: hidden;
    touch-action: none;
    min-height: 250px;
}

.bm-canvas-wrap canvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
}

/* ── Zoom control buttons ────────────────────────────── */
.bm-zoom-controls {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 5;
}
.bm-zoom-btn {
    width: 36px;
    height: 36px;
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 8px;
    background: rgba(17,24,39,0.55);
    color: rgba(255,255,255,0.75);
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    touch-action: manipulation;
}
.bm-zoom-btn:active {
    background: rgba(255,255,255,0.15);
}

/* ── Hex info panel ──────────────────────────────────── */
.bm-hex-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(8px);
    border-top: 1px solid rgba(255,255,255,0.1);
    padding: 12px 16px;
    z-index: 10;
}

.bm-hex-info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.bm-hex-info-type {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 2px 8px;
    border-radius: 4px;
}

.bm-hex-type-faction { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.bm-hex-type-pvpve   { background: rgba(139, 92, 246, 0.2); color: #a78bfa; }
.bm-hex-type-black   { background: rgba(30, 30, 30, 0.5); color: #d4d4d4; }

.bm-hex-info-value {
    font-size: 0.85rem;
    color: #fbbf24;
    font-weight: 600;
}

.bm-hex-info-owner {
    font-size: 0.8rem;
    color: var(--text-primary, #fff);
    margin-bottom: 4px;
}

.bm-hex-info-coords {
    font-size: 0.65rem;
    color: var(--text-secondary, #64748b);
    font-family: monospace;
}

.bm-hex-info-base {
    margin-top: 4px;
    font-size: 0.75rem;
    color: #fbbf24;
}

.bm-hex-info-black {
    margin-top: 4px;
    font-size: 0.75rem;
    color: #d4d4d4;
}

.bm-hex-info-here {
    margin-top: 4px;
    font-size: 0.75rem;
    color: #22c55e;
    font-weight: 600;
}

.bm-hex-info-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.bm-hex-enter-btn,
.bm-hex-leave-btn {
    width: 100%;
    min-height: 44px;
    font-size: 0.85rem;
}

/* ── Battle overlay & modal ──────────────────────────── */
.bm-battle-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.85);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
}

.bm-battle-modal {
    background: #1e293b;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    width: 100%;
    max-width: 420px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ── Progress bar ────────────────────────────────────── */
.bm-progress-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.bm-progress-bar {
    flex: 1;
    height: 10px;
    background: rgba(255,255,255,0.08);
    border-radius: 5px;
    overflow: hidden;
}

.bm-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #22c55e, #16a34a);
    border-radius: 5px;
    width: 0%;
    transition: width 0.3s ease;
}

.bm-progress-label {
    font-size: 0.75rem;
    color: #22c55e;
    font-weight: 600;
    min-width: 32px;
    text-align: right;
}

/* ── Teams ───────────────────────────────────────────── */
.bm-teams-row {
    display: flex;
    gap: 6px;
    align-items: flex-start;
}

.bm-team {
    flex: 1;
    min-width: 0;
}

.bm-team-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary, #94a3b8);
    margin-bottom: 4px;
    font-weight: 600;
}

.bm-team-allies .bm-team-label { color: #60a5fa; }
.bm-team-enemies .bm-team-label { color: #f87171; }

.bm-vs {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-secondary, #94a3b8);
    padding: 8px 4px;
}

.bm-players-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 180px;
    overflow-y: auto;
}

.bm-player,
.bm-player-bot,
.bm-player-dead {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 0.72rem;
}

.bm-player {
    background: rgba(59, 130, 246, 0.1);
}

.bm-player-bot {
    background: rgba(107, 114, 128, 0.1);
}

.bm-player-dead {
    background: rgba(239, 68, 68, 0.1);
    opacity: 0.5;
}

.bm-player-dead .bm-player-name {
    text-decoration: line-through;
    color: #f87171;
}

.bm-player-name {
    color: var(--text-primary, #fff);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 80px;
}

.bm-player-hp {
    font-size: 0.65rem;
    color: var(--text-secondary, #94a3b8);
    font-family: monospace;
    white-space: nowrap;
}

.bm-player-overflow {
    font-size: 0.65rem;
    color: var(--text-secondary, #64748b);
    padding: 2px 6px;
}

/* ── My status ───────────────────────────────────────── */
.bm-my-status {
    display: flex;
    justify-content: space-between;
    background: rgba(255,255,255,0.04);
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 0.8rem;
    color: var(--text-primary, #fff);
}

/* ── Attack power bar ────────────────────────────────── */
.bm-attack-power-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.bm-attack-power-bar {
    flex: 1;
    height: 8px;
    background: rgba(255,255,255,0.08);
    border-radius: 4px;
    overflow: hidden;
}

.bm-attack-power-fill {
    height: 100%;
    background: linear-gradient(90deg, #f59e0b, #ef4444);
    border-radius: 4px;
    width: 30%;
    transition: width 0.05s linear;
}

.bm-attack-power-label {
    font-size: 0.72rem;
    color: #f59e0b;
    font-weight: 600;
    min-width: 50px;
    text-align: right;
}

/* ── Battle actions ──────────────────────────────────── */
.bm-battle-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bm-attack-main-btn {
    width: 100%;
    min-height: 50px;
    font-size: 1.1rem;
    font-weight: 700;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

.bm-action-row {
    display: flex;
    gap: 8px;
}

.bm-skills-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 6px;
}

.bm-action-btn {
    flex: 1;
    min-height: 44px;
    font-size: 0.85rem;
}

/* ── Battle log ──────────────────────────────────────── */
.bm-battle-log {
    max-height: 100px;
    overflow-y: auto;
    background: rgba(0,0,0,0.3);
    border-radius: 6px;
    padding: 8px;
    font-size: 0.7rem;
    color: var(--text-secondary, #94a3b8);
    line-height: 1.5;
}

.bm-log-line {
    padding: 1px 0;
}

.bm-log-line .log-player-name {
    color: #4ade80;
    font-weight: 700;
}

/* ── Retreat ─────────────────────────────────────────── */
.bm-retreat-wrap {
    display: flex;
    justify-content: center;
}

.bm-retreat-btn {
    min-height: 44px;
    width: 100%;
    font-size: 0.85rem;
}

/* ── Responsive (mobile first by default, 360-430px) ── */
@media (min-width: 600px) {
    .bm-battle-modal {
        max-width: 480px;
    }
    
    .bm-player-name {
        max-width: 120px;
    }
}

/* ── Black Hex Timer ─────────────────────────────────── */
#bmBlackHexTimer {
    text-align: center;
    font-size: 0.75rem;
    color: #d4d4d4;
    padding: 4px 8px;
    background: rgba(30, 30, 30, 0.3);
    border-radius: 6px;
    margin: 4px 12px 0;
    letter-spacing: 0.5px;
}

#bmBlackHexTimer.bm-black-timer-active {
    background: rgba(30, 30, 30, 0.6);
    animation: bm-black-pulse 1.5s ease-in-out infinite;
    font-weight: 700;
    color: #fff;
}

@keyframes bm-black-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ── Base Reward ─────────────────────────────────────── */
#bmBaseReward,
.bm-base-reward {
    display: none;
    margin: 8px 12px;
    padding: 10px 12px;
    background: rgba(34, 197, 94, 0.08);
    border: 1px solid rgba(34, 197, 94, 0.2);
    border-radius: 8px;
}

.bm-base-reward-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: #22c55e;
    margin-bottom: 6px;
}

.bm-base-reward-timer {
    font-size: 0.7rem;
    color: #86efac;
}

.bm-base-reward-bar-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.bm-base-reward-bar {
    flex: 1;
    height: 14px;
    background: rgba(255,255,255,0.08);
    border-radius: 7px;
    overflow: hidden;
}

.bm-base-reward-fill {
    height: 100%;
    background: linear-gradient(90deg, #22c55e, #4ade80);
    border-radius: 7px;
    transition: width 0.5s ease;
}

.bm-base-reward-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #fff;
    min-width: 60px;
    text-align: right;
}

.bm-base-reward-btn {
    min-height: 44px;
    width: 100%;
    font-size: 0.85rem;
    background: #22c55e;
    color: #000;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
}

.bm-base-reward-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

#bmBaseReward.bm-base-reward-maxed {
    animation: bm-base-blink 1.2s ease-in-out infinite;
    border-color: #22c55e;
}

@keyframes bm-base-blink {
    0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
    50% { box-shadow: 0 0 12px 4px rgba(34, 197, 94, 0.35); }
}

/* ── POI in hex info ─────────────────────────────────── */
.bm-hex-info-poi {
    font-size: 0.8rem;
    color: #fbbf24;
    padding: 2px 0;
}

.bm-hex-info-base-action {
    margin-top: 4px;
}

/* ── Auto-sell select ────────────────────────────────── */
.char-setting-select {
    width: 100%;
    padding: 8px 12px;
    font-size: 14px;
    background: var(--bg-secondary, #1e293b);
    color: var(--text-primary, #fff);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 8px;
    margin-top: 4px;
    min-height: 44px;
    -webkit-appearance: none;
    appearance: none;
}
