/* Основные стили из первого примера */
body {
    margin: 0;
    background: #0b0f14;
    color: #dce3ea;
    font-family: Consolas, monospace;
}
header {
    background: #121820;
    padding: 10px;
    border-bottom: 2px solid #00ffd5;
}
nav {
    display: flex;
    background: #0f141b;
}
nav button {
    flex: 1;
    padding: 8px;
    background: #0f141b;
    color: #9fb2c4;
    border: none;
}
nav button.active {
    background: #00ffd5;
    color: #021410;
}
.content {
    padding: 10px;
}
.block {
    display: inline-block;
    width: 45%;
    min-width: 160px;
    margin: 6px;
    padding: 10px;
    background: #121820;
    border: 1px solid #2a3440;
}
.value {
    font-size: 1.6em;
    color: #00ffd5;
}
.label {
    color: #9fb2c4;
    font-size: 1em;
    margin-bottom: 5px;
}

/* Графики - УВЕЛИЧЕНЫ НА 50% (было 150px, стало 225px) */
.chart-container {
    position: relative;
    height: 225px; /* УВЕЛИЧЕНО С 150px НА 225px */
    width: 100%;
    margin: 10px 0;
}
canvas {
    background: #0f141b;
    border: 1px solid #2a3440;
    border-radius: 4px;
    width: 100% !important;
    height: 100% !important;
}

/* Интервалы */
.intervals {
    margin: 15px 0;
    text-align: center;
}
.intervals button {
    margin: 0 5px;
    padding: 5px 15px;
    background: #0f141b;
    color: #9fb2c4;
    border: 1px solid #2a3440;
    cursor: pointer;
    font-family: Consolas, monospace;
}
.intervals button:hover {
    background: #1a2029;
    color: #dce3ea;
}
.intervals button.active {
    background: #00ffd5;
    color: #021410;
    border-color: #00ffd5;
}

/* ===== SYSTEM ===== */
.barrel-system {
    margin: 20px auto;
    max-width: 520px;
    padding: 12px;
    background: #10161e;
    border: 2px solid #2a3440;
}
.system-title {
    color: #00ffd5;
    margin-bottom: 10px;
    text-align: center;
}
.system-container {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 180px;
}

/* Кнопки управления над клапанами */
.valve-control {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 10px;
}
.valve-control-buttons {
    display: flex;
    gap: 5px;
    margin-bottom: 5px;
}
.valve-control-btn {
    padding: 3px 8px;
    font-size: 0.8em;
    background: #1a2029;
    color: #9fb2c4;
    border: 1px solid #2a3440;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: Consolas, monospace;
}
.valve-control-btn:hover {
    background: #2a3440;
}
.valve-control-btn.active {
    background: #00ffd5;
    color: #021410;
    border-color: #00ffd5;
}
.valve-control-label {
    font-size: 0.8em;
    color: #9fb2c4;
    margin-top: 3px;
}

/* VALVE 1 - Теперь такой же как клапан 2 */
.valve1-container {
    width: 100px;
    height: 120px;
    position: relative;
}
.valve1-body {
    width: 60px;
    height: 80px;
    background: #2f3a34; /* Немного другой цвет для отличия */
    border: 3px solid #006633;
    margin: auto;
    border-radius: 8px;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
}
.valve1-handle {
    position: absolute;
    width: 60px;
    height: 20px;
    background: linear-gradient(to bottom, #4CAF50, #2E7D32);
    top: 40px;
    left: 20px;
    transform-origin: 30px 10px;
    transition: .4s;
    border-radius: 4px;
    border: 2px solid #006633;
}
.valve1-handle.manual {
    cursor: pointer;
}
.valve1-handle.disabled {
    cursor: not-allowed;
    opacity: 0.5;
}
.valve1-wheel {
    position: absolute;
    width: 30px;
    height: 30px;
    background: #c0c0c0;
    border: 2px solid #888;
    border-radius: 50%;
    top: 15px;
    left: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.4s;
}
.valve1-wheel.manual {
    cursor: pointer;
}
.valve1-wheel.disabled {
    cursor: not-allowed;
    opacity: 0.5;
}
.valve1-wheel::after {
    content: "⚙";
    color: #444;
    font-size: 16px;
}
.valve1-led {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #00aa66;
    position: absolute;
    right: 10px;
    top: 10px;
    transition: all 0.3s;
    box-shadow: 0 0 5px rgba(0, 170, 102, 0.5);
}
.valve1-led.on {
    background: #00ff88;
    box-shadow: 0 0 15px #00ff88;
}

/* VALVE 2 - Второй клапан */
.valve2-container {
    width: 100px;
    height: 120px;
    position: relative;
}
.valve2-body {
    width: 60px;
    height: 80px;
    background: #3a2f34;
    border: 3px solid #8b4513;
    margin: auto;
    border-radius: 8px;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
}
.valve2-handle {
    position: absolute;
    width: 60px;
    height: 20px;
    background: linear-gradient(to bottom, #d4af37, #b8860b);
    top: 40px;
    left: 20px;
    transform-origin: 30px 10px;
    transition: .4s;
    border-radius: 4px;
    border: 2px solid #8b4513;
}
.valve2-handle.manual {
    cursor: pointer;
}
.valve2-handle.disabled {
    cursor: not-allowed;
    opacity: 0.5;
}
.valve2-wheel {
    position: absolute;
    width: 30px;
    height: 30px;
    background: #c0c0c0;
    border: 2px solid #888;
    border-radius: 50%;
    top: 15px;
    left: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.4s;
}
.valve2-wheel.manual {
    cursor: pointer;
}
.valve2-wheel.disabled {
    cursor: not-allowed;
    opacity: 0.5;
}
.valve2-wheel::after {
    content: "⚙";
    color: #444;
    font-size: 16px;
}
.valve2-led {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ff6600;
    position: absolute;
    right: 10px;
    top: 10px;
    transition: all 0.3s;
    box-shadow: 0 0 5px rgba(255, 102, 0, 0.5);
}
.valve2-led.on {
    background: #ffff00;
    box-shadow: 0 0 15px #ffff00;
}

/* PIPE */
.pipe {
    width: 100px;
    height: 20px;
    background: #1c2229;
    border: 2px solid #000;
    margin: 0 10px;
    border-radius: 10px;
}
.pipe-liquid {
    height: 100%;
    width: 0%;
    background: repeating-linear-gradient(
        90deg,
        #00ffd5 0 10px,
        #00aa99 10px 20px
    );
    transition: width .3s;
    border-radius: 10px;
}

/* PIPE 2 - для второго клапана */
.pipe2 {
    width: 100px;
    height: 20px;
    background: #1c2229;
    border: 2px solid #000;
    margin: 0 10px;
    border-radius: 10px;
}
.pipe2-liquid {
    height: 100%;
    width: 0%;
    background: repeating-linear-gradient(
        90deg,
        #ffaa00 0 10px,
        #cc8800 10px 20px
    );
    transition: width .3s;
    border-radius: 10px;
}

/* BARREL */
.barrel {
    width: 120px;
    height: 160px;
    border: 2px solid #000;
    background: #0f141b;
    position: relative;
    border-radius: 10px;
    overflow: hidden;
}
.barrel-liquid {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 0%;
    background: linear-gradient(to top, #00c896, #00ffd5);
    transition: height .6s;
}
.barrel-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%);
    font-size: 1.4em;
    background: rgba(0,0,0,.5);
    padding: 4px 8px;
    border-radius: 4px;
    color: #dce3ea;
}

/* INFO */
.system-info {
    display: flex;
    justify-content: space-around;
    margin-top: 10px;
    border-top: 1px solid #2a3440;
    padding-top: 6px;
}
.system-info div {
    text-align: center;
}
.system-info span {
    color: #00ffd5;
    font-size: 1.2em;
}
.system-info2 {
    display: flex;
    justify-content: space-around;
    margin-top: 10px;
    padding-top: 6px;
}
.system-info2 div {
    text-align: center;
}
.system-info2 span {
    color: #ffaa00;
    font-size: 1.2em;
}

/* Дополнительные стили для статуса реле */
.relay-status {
    font-size: 0.8em;
    color: #9fb2c4;
    margin-top: 3px;
}
.relay-status.on {
    color: #00ff88;
}
.relay-status.off {
    color: #ff5555;
}
.relay-status.pending {
    color: #ffaa00;
}

/* Статус соединения */
.connection-status {
    position: fixed;
    top: 10px;
    right: 10px;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 12px;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    display: flex;
    align-items: center;
    gap: 5px;
}
.connection-status.connected {
    background: rgba(0, 255, 0, 0.2);
    color: #00ff00;
}
.connection-status.disconnected {
    background: rgba(255, 0, 0, 0.2);
    color: #ff5555;
}
.connection-status.connecting {
    background: rgba(255, 170, 0, 0.2);
    color: #ffaa00;
}