/* ============================================================
   PMR Energy Dashboard — Styles
   ============================================================ */

.pmr-dash-root {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: #111827;
    box-sizing: border-box;
}

.pmr-dash-root *, .pmr-dash-root *::before, .pmr-dash-root *::after {
    box-sizing: inherit;
}

/* ── Статус-бар ─────────────────────────────────────────── */
.pmr-dash-status-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    font-size: 13px;
    color: #6B7280;
}

.pmr-dash-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #9CA3AF;
    flex-shrink: 0;
    transition: background 0.3s;
}
.pmr-dash-dot.online  { background: #22C55E; }
.pmr-dash-dot.offline { background: #EF4444; }
.pmr-dash-dot.loading { background: #F59E0B; animation: pmr-pulse 1s infinite; }

@keyframes pmr-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.4; }
}

.pmr-dash-update-time { margin-left: auto; font-size: 12px; }

/* ── Основной layout ─────────────────────────────────────── */
.pmr-dash-layout {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.pmr-dash-left {
    flex: 0 0 420px;
    min-width: 0;
}

/* Карта отключена — левая колонка растягивается на всю ширину */
.pmr-dash-layout--no-map .pmr-dash-left {
    flex: 1 1 auto;
    max-width: 680px;
}


.pmr-dash-right {
    flex: 1 1 auto;
    min-width: 0;
}

/* ── Заголовок ──────────────────────────────────────────── */
.pmr-dash-hero { margin-bottom: 20px; }

.pmr-dash-title {
    font-size: 28px;
    font-weight: 700;
    color: #1B3A6B;
    line-height: 1.2;
    margin: 0 0 10px;
}

.pmr-dash-subtitle {
    font-size: 13px;
    color: #6B7280;
    line-height: 1.6;
    margin: 0;
}

/* ── Карточки ───────────────────────────────────────────── */
.pmr-dash-card {
    background: #fff;
    border-radius: 12px;
    padding: 18px 20px;
    margin-bottom: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,.07);
}

.pmr-dash-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .07em;
    color: #6B7280;
    text-transform: uppercase;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.pmr-dash-info { cursor: default; opacity: .5; }

/* ── Большие значения ───────────────────────────────────── */
.pmr-dash-big {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.pmr-dash-big-num {
    font-size: 36px;
    font-weight: 700;
    color: #1B3A6B;
    line-height: 1;
    letter-spacing: -.02em;
}

.pmr-dash-big-unit {
    font-size: 16px;
    font-weight: 500;
    color: #1B3A6B;
    opacity: .7;
}

.pmr-dash-norm {
    font-size: 11px;
    color: #9CA3AF;
    margin-top: 5px;
}

.pmr-freq-warn { color: #EF4444 !important; }

/* ── Сетка 2 колонки ────────────────────────────────────── */
.pmr-dash-row2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 10px;
}

.pmr-dash-row2 .pmr-dash-card {
    margin-bottom: 0;
}

.pmr-dash-row2 .pmr-dash-big-num { font-size: 28px; }

/* ── Генерация по видам ─────────────────────────────────── */
.pmr-dash-sources {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 4px;
}

.pmr-dash-source-row {
    display: grid;
    grid-template-columns: 28px 1fr auto;
    align-items: center;
    gap: 8px;
}

.pmr-dash-source-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pmr-icon-thermal  { background: #EFF6FF; }
.pmr-icon-thermal::after  { content: '🏭'; font-size: 14px; }
.pmr-icon-hydro    { background: #EFF6FF; }
.pmr-icon-hydro::after    { content: '💧'; font-size: 14px; }
.pmr-icon-thermal2 { background: #FFF7ED; }
.pmr-icon-thermal2::after { content: '⚡'; font-size: 14px; }
.pmr-icon-solar    { background: #FEFCE8; }
.pmr-icon-solar::after    { content: '☀️'; font-size: 14px; }
.pmr-icon-default  { background: #F3F4F6; }
.pmr-icon-default::after  { content: '⚡'; font-size: 14px; }

.pmr-dash-sources-loading {
    font-size: 13px;
    color: #9CA3AF;
    padding: 8px 0;
}

.pmr-dash-source-name {
    font-size: 13px;
    color: #374151;
    font-weight: 500;
}

.pmr-dash-source-val { text-align: right; white-space: nowrap; }

.pmr-dash-source-num {
    font-size: 15px;
    font-weight: 700;
    color: #1B3A6B;
}

.pmr-dash-source-unit {
    font-size: 11px;
    color: #6B7280;
    margin-left: 2px;
}

.pmr-dash-source-pct {
    font-size: 12px;
    color: #6B7280;
    min-width: 50px;
    text-align: right;
}

/* ── Прогресс-бар ───────────────────────────────────────── */
.pmr-dash-progress-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.pmr-dash-progress-track {
    flex: 1;
    height: 8px;
    background: #E5E7EB;
    border-radius: 99px;
    overflow: hidden;
}

.pmr-dash-progress-fill {
    height: 100%;
    background: #1B3A6B;
    border-radius: 99px;
    transition: width 0.6s ease;
}

.pmr-dash-progress-pct {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    white-space: nowrap;
    min-width: 44px;
    text-align: right;
}

/* ── Карта ──────────────────────────────────────────────── */
.pmr-dash-map-container {
    position: relative;
    line-height: 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,.07);
}

.pmr-dash-map-image {
    display: block;
    width: 100%;
    height: auto;
    user-select: none;
    -webkit-user-drag: none;
}

.pmr-dash-markers-layer {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
}

/* ── Маркеры ────────────────────────────────────────────── */
.pmr-dash-marker {
    position: absolute;
    transform: translate(-50%, -50%);
    pointer-events: all;
    cursor: pointer;
    z-index: 10;
}

.pmr-dash-marker-inner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 24px;
    padding: 0 7px;
    border-radius: 12px;
    background: rgba(255,255,255,.93);
    border: 2px solid currentColor;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    line-height: 1;
    transition: transform .15s, background .15s;
}

.pmr-dash-marker:hover .pmr-dash-marker-inner {
    transform: scale(1.12);
    background: #fff;
}

@keyframes pmr-dash-flash-marker {
    0%   { background: rgba(255,220,50,.95); transform: scale(1.18); }
    100% { background: rgba(255,255,255,.88); transform: scale(1); }
}
.pmr-dash-marker.pmr-flash .pmr-dash-marker-inner {
    animation: pmr-dash-flash-marker .6s ease-out forwards;
}

/* ── Тултип ─────────────────────────────────────────────── */
.pmr-dash-tooltip {
    position: fixed;
    z-index: 99999;
    background: #fff;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    padding: 10px 14px;
    pointer-events: none;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity .15s, transform .15s;
    max-width: 220px;
    box-shadow: 0 4px 16px rgba(0,0,0,.12);
}

.pmr-dash-tooltip.visible {
    opacity: 1;
    transform: translateY(0);
}

.pmr-dash-tt-name {
    font-size: 14px;
    font-weight: 700;
    color: #111827;
}

.pmr-dash-tt-desc {
    font-size: 11px;
    color: #6B7280;
    margin-top: 3px;
    line-height: 1.4;
}

.pmr-dash-tt-value {
    font-size: 13px;
    font-weight: 700;
    color: #1B3A6B;
    margin-top: 6px;
}

.pmr-dash-tt-time {
    font-size: 10px;
    color: #9CA3AF;
    margin-top: 2px;
}

/* ── Flash данных ───────────────────────────────────────── */
@keyframes pmr-flash-anim {
    0%   { background: rgba(27,58,107,.1); }
    100% { background: transparent; }
}
.pmr-flash { animation: pmr-flash-anim .5s ease-out; border-radius: 4px; }

/* ── Адаптив ────────────────────────────────────────────── */
@media (max-width: 900px) {
    .pmr-dash-layout {
        flex-direction: column;
    }

    .pmr-dash-left  { flex: none; width: 100%; }
    .pmr-dash-right { flex: none; width: 100%; position: static; }
}

@media (max-width: 480px) {
    .pmr-dash-row2 { grid-template-columns: 1fr; }
    .pmr-dash-title { font-size: 24px; }
    .pmr-dash-big-num { font-size: 30px; }
}

/* ── График в правой колонке ────────────────────────────── */
.pmr-dash-chart-card {
    background: #fff;
    border-radius: 12px;
    padding: 16px 18px 14px;
    box-shadow: 0 1px 4px rgba(0,0,0,.07);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pmr-dash-chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.pmr-dash-chart-title {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .07em;
    color: #6B7280;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 5px;
}

.pmr-dash-chart-actions {
    display: flex;
    gap: 4px;
}

.pmr-period-btn {
    background: none;
    border: 1px solid #E5E7EB;
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 600;
    color: #6B7280;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
    line-height: 1.4;
}

.pmr-period-btn:hover {
    background: #F3F4F6;
    border-color: #D1D5DB;
    color: #374151;
}

.pmr-period-btn.active {
    background: #1B3A6B;
    border-color: #1B3A6B;
    color: #fff;
}

.pmr-dash-chart-body { flex: 1; }

.pmr-dash-chart-wrap {
    position: relative;
    height: 190px;
}

.pmr-dash-chart-legend {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.pmr-dash-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #6B7280;
}

.pmr-dash-legend-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 2px;
    flex-shrink: 0;
}

.pmr-dash-legend-dot--dashed {
    background: transparent;
    border: 2px dashed #0C2A50;
}
