/* Основен фон */
body {
  margin: 0;
  font-family: 'Segoe UI', Arial, sans-serif;
  background: #f3f5f8;
  color: #333;
  overflow-x: hidden;
}

/* Движеща се "вода" */
.water-bg {
  position: fixed;
  top: 0; left: 0;
  width: 200%;
  height: 100%;
  background: linear-gradient(120deg, #b3e5fc, #e1f5fe, #b3e5fc);
  background-size: 200% 100%;
  animation: waterMove 15s linear infinite;
  z-index: -1;
}
@keyframes waterMove {
  from { background-position: 0 0; }
  to { background-position: -100% 0; }
}

/* Хедър */
header {
  background: #b22222;
  color: white;
  padding: 10px 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
header h1 {
  font-size: 22px;
  margin: 0;
}
nav a {
  color: white;
  text-decoration: none;
  margin-left: 20px;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 6px;
  transition: background 0.3s;
}
nav a:hover {
  background: rgba(255,255,255,0.2);
}

/* Основно съдържание */
main {
  padding: 30px;
}

/* Карти / панели */
.card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  margin-bottom: 20px;
}

/* Mnemo Layout */
#mnemo-wrapper {
  position: relative;
  display: inline-block;
  left: 30px; /* изместваме леко надясно */
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  padding: 10px;
}
#mnemo-img {
  max-width: 100%;
  border-radius: 10px;
}
.point {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 12px;
  background: rgba(255,255,255,0.75);
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 2px 5px;
  cursor: pointer;
}
.tooltip {
  position: absolute;
  background: rgba(0,0,0,0.8);
  color: #fff;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  transform: translate(-50%, -120%);
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
.point:hover .tooltip {
  opacity: 1;
}
/* Mnemo Layout */
#mnemo-wrapper {
  position: relative;
  display: inline-block;
  margin-left: 80px; /* <-- повече място вляво */
  background: linear-gradient(145deg, #eef5f9, #e4eef6);
  border-radius: 12px;
  overflow: visible;
  padding: 20px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

/* картинката сама по себе си */
#mnemo-img {
  max-width: 100%;
  border-radius: 8px;
  display: block;
  background-color: #eef5f9; /* заменя белия фон */
  box-shadow: inset 0 0 8px rgba(0,0,0,0.1);
}

/* точки */
.point {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 12px;
  background: rgba(255,255,255,0.8);
  border: 1px solid #bbb;
  border-radius: 6px;
  padding: 2px 5px;
  cursor: pointer;
  transition: all 0.15s ease;
  backdrop-filter: blur(2px);
}
.point:hover {
  background: #ffe9c9;
  border-color: #f3a34c;
  z-index: 20;
}

/* tooltip-ите вече ще се позиционират динамично */
.tooltip {
  position: absolute;
  background: rgba(0,0,0,0.85);
  color: #fff;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  transform: translate(-50%, -120%);
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
  max-width: 220px;
}
.point:hover .tooltip {
  opacity: 1;
  transform: translate(-50%, -130%);
}
/* Нов layout: показания вляво, схема вдясно */
.mnemo-layout {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 30px;
}

/* Панел с показания */
.status-panel {
  width: 320px;
  background: #ffffffd9;
  border-radius: 12px;
  box-shadow: 0 3px 12px rgba(0,0,0,0.15);
  padding: 20px;
  font-size: 14px;
}

.status-panel h2 {
  color: #b22222;
  margin-top: 0;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.status-panel h3 {
  margin-top: 5px;
  font-size: 16px;
  color: #555;
}

.status-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 8px 0;
  border-bottom: 1px solid #eee;
  padding-bottom: 4px;
}
.status-item span.name {
  font-weight: 600;
}
.status-item span.value {
  font-weight: 500;
}
.status-item span.diff {
  font-size: 12px;
  color: #b22222;
}

/* Схемата вдясно */
.mnemo-card {
  flex: 1;
}

#mnemo-wrapper {
  margin-left: 0;       /* премахваме старото отместване */
  margin-right: 40px;   /* леко отстояние вдясно */
  background: linear-gradient(145deg, #eef5f9, #e4eef6);
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}
.status-panel {
  width: 330px;
  background: #ffffffcc;
  border-radius: 12px;
  box-shadow: 0 3px 12px rgba(0,0,0,0.15);
  padding: 20px;
  font-size: 14px;
}

.status-panel h2 {
  color: #b22222;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  border-bottom: 2px solid #b22222;
  margin-bottom: 10px;
}

.status-panel h3 {
  font-size: 15px;
  color: #333;
  margin: 4px 0 12px;
  text-transform: capitalize;
}

.status-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 8px 0;
  border-bottom: 1px solid #eee;
  padding-bottom: 4px;
}

.status-item .name {
  font-weight: 600;
  flex: 1;
}

.status-item .value {
  font-weight: 500;
  color: #111;
  margin-right: 8px;
}

.status-item .diff {
  font-size: 18px;
  font-weight: 700;
  min-width: 60px;
  text-align: right;
}

.status-item .diff.down {
  color: #b22222; /* червено при спад */
}

.status-item .diff.up {
  color: #1b8e00; /* зелено при над номинал */
}

.ts-line {
  font-size: 12px;
  color: #555;
  margin-top: 10px;
  font-style: italic;
}

/* Номинални стойности */
.nominal-box {
  margin-top: 16px;
  padding-top: 8px;
  border-top: 1px dashed #aaa;
}
.nominal-box h4 {
  margin: 0 0 6px;
  font-size: 13px;
  color: #b22222;
  text-transform: uppercase;
}
.nominal-box ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.nominal-box li {
  font-size: 13px;
  color: #222;
}
.problem-box {
  margin-top: 16px;
  padding: 10px;
  background: #ffe4e4;
  border: 1px solid #d12d2d;
  border-radius: 8px;
  color: #a00000;
}
.problem-box h4 {
  margin: 0 0 5px;
  font-size: 14px;
  color: #a00000;
}
.chart-section {
  margin-top: 15px;
  background: #fff8f8;
  border-radius: 10px;
  padding: 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
.chart-label {
  font-size: 0.9em;
  color: #555;
  margin: 5px 0 15px 5px;
}
body {
  margin: 0;
  font-family: 'Segoe UI', Arial, sans-serif;
  background: #f5f9fc;
  color: #333;
}

/* 🌊 фон */
.water-bg {
  position: fixed;
  inset: 0;
  width: 200%;
  height: 100%;
  background: linear-gradient(120deg, #cfe8fb, #e7f4ff, #cfe8fb);
  background-size: 200% 100%;
  animation: waveMove 25s linear infinite;
  z-index: -1;
}
@keyframes waveMove {
  from { background-position: 0 0; }
  to { background-position: -100% 0; }
}

/* 🔥 Хедър */
header {
  background: #b22222;
  color: #fff;
  padding: 16px 35px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.25);
  text-align: center;
}
header .title {
  font-size: 22px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* ⚙️ Лента */
#update-bar {
  width: 100%;
  background: #fafafa;
  color: #444;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 0;
  border-bottom: 1px solid #ddd;
}

/* Основен Layout */
.dashboard-container {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 30px;
  padding: 25px 40px;
}

/* Ляв панел */
.status-panel {
  width: 330px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  padding: 20px;
}

/* Дясна зона */
#mnemo-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Мнемосхема */
.mnemo-card {
  background: #fff;
  border-radius: 12px;
  padding: 15px;
  box-shadow: 0 3px 12px rgba(0,0,0,0.1);
}
#mnemo-wrapper {
  position: relative;
  background: #f3f7fb;
  border-radius: 10px;
  padding: 20px;
}
#mnemo-img {
  width: 100%;
  border-radius: 10px;
}

/* Блок под схемата */
.mnemo-extra {
  background: #fff;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

/* Проблеми и таблици */
.problem-box {
  background: #fff3f3;
  border: 1px solid #e66;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 15px;
}
.problem-box h4 {
  color: #a00000;
  margin: 0 0 6px;
}

/* Таблица */
.month-stats table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.month-stats th, .month-stats td {
  border: 1px solid #ddd;
  padding: 6px 8px;
  text-align: center;
}
.month-stats th {
  background: #f9f9f9;
  font-weight: 700;
}

/* Графики */
.chart-section {
  margin-top: 25px;
  background: #fff;
  border-radius: 12px;
  padding: 25px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}
.chart-section h4 {
  margin: 0 0 10px;
  color: #b22222;
}
canvas {
  width: 100% !important;
  height: 260px !important;
}
.chart-label {
  text-align: center;
  color: #555;
  font-size: 13px;
}
.chart-legend {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 8px;
}

.chart-legend span {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  background: #f9f9f9;
  border: 1px solid #ccc;
}

.legend-heating { color: #007bff; border-color: #007bff; }
.legend-dhw { color: #00cc66; border-color: #00cc66; }
.chart-section {
  background: #fff;
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  margin-top: 25px;
}
.chart-block {
  margin-top: 20px;
  padding: 10px 0;
}
.chart-block h5 {
  font-size: 1.1em;
  color: #b22222;
  margin-bottom: 10px;
  text-align: center;
}
.chart-info {
  font-size: 0.9em;
  text-align: center;
  margin-top: 5px;
  color: #333;
}
.chart-section {
  background: #fff;
  border-radius: 14px;
  padding: 25px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  margin-top: 25px;
}
.chart-block {
  margin-bottom: 35px;
}
.chart-block h5 {
  text-align: center;
  font-size: 1.1em;
  color: #b22222;
  margin-bottom: 10px;
}
.chart-info {
  text-align: center;
  font-size: 0.9em;
  color: #333;
  margin-top: 6px;
}
.month-picker {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.picker-box {
  background: white;
  padding: 20px 30px;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  text-align: center;
}

.picker-box h4 {
  margin-bottom: 10px;
  color: #b22222;
}

.picker-box select {
  padding: 6px 10px;
  font-size: 15px;
  border-radius: 6px;
  margin-bottom: 10px;
}

.picker-box button {
  margin: 5px;
  padding: 6px 14px;
  font-size: 14px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

#monthOk {
  background: #b22222;
  color: white;
}

#monthCancel {
  background: #ddd;
  color: #333;
}
.active-problem {
  background-color: rgba(255, 0, 0, 0.08);
  color: #b10000;
  font-weight: 600;
}
/* ================================
   📱 Responsive дизайн за мобилни
   ================================ */

/* Главен layout — пренареждаме колоните подред */
@media (max-width: 1000px) {
  .mnemo-layout,
  .dashboard-container {
    flex-direction: column;
    align-items: center;
    gap: 20px;
  }

  #mnemo-wrapper {
    width: 95%;
    margin: 0 auto;
  }

  .status-panel {
    width: 95%;
    margin-bottom: 20px;
  }

  .chart-section {
    width: 95%;
    padding: 15px;
  }

  .month-stats table {
    width: 100%;
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  .month-stats table th,
  .month-stats table td {
    font-size: 13px;
    padding: 6px 8px;
  }
}

/* Още по-малки екрани — телефони под 600px */
@media (max-width: 600px) {
  header {
    flex-direction: column;
    text-align: center;
    padding: 10px;
  }

  header .title {
    font-size: 18px;
  }

  .status-item span.name {
    font-size: 13px;
  }

  .status-item span.value,
  .status-item span.diff {
    font-size: 12px;
  }

  .chart-section canvas {
    height: 180px !important;
  }

  .chart-label {
    font-size: 12px;
    text-align: center;
  }

  .problem-box {
    font-size: 13px;
  }

  .month-stats h4, .month-stats h5 {
    text-align: center;
  }
}
.chart-block {
  width: 100%;
  overflow-x: auto;
}

.chart-block canvas {
  max-width: 100%;
  height: auto !important;
}
