/* Стили карточек, каналов, статусов и истории */

/* ===== CARD ===== */
.card {
    border: 1px solid #00ff88;
    border-radius: 10px;
    padding: 14px;
    background: rgba(0,255,136,0.05);
    overflow: visible;
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}
.card:hover {
    box-shadow: 0 0 30px rgba(0, 255, 136, 0.05);
}
.card h3 {
    margin: 0 0 10px;
    font-size: var(--font-size-lg);
    font-family: var(--font-display);
    letter-spacing: 0.1em;
    font-weight: var(--font-weight-bold);
}

/* ===== СТАТУС ===== */
#status {
    font-family: var(--font-tech);
    font-size: var(--font-size-3xl);
    font-weight: var(--font-weight-bold);
    margin-bottom: 8px;
    letter-spacing: 0.05em;
}
.status-ok {
    color: #00ff88 !important;
    text-shadow: 0 0 30px rgba(0, 255, 136, 0.3);
}
.status-lost {
    color: #ffffff !important;
    animation: blink 1.5s infinite;
    text-shadow: 0 0 30px rgba(255, 255, 255, 0.1);
}
.status-error {
    color: #ff4444 !important;
    text-shadow: 0 0 30px rgba(255, 68, 68, 0.3);
}
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.2; }
}

/* ===== META ===== */
#meta {
    font-family: var(--font-mono);
    font-size: var(--font-size-base);
    opacity: 0.8;
    letter-spacing: 0.02em;
}

/* ===== АККОРДЕОН ===== */
.accordion-header {
    cursor: pointer;
    user-select: none;
    padding: 10px 0;
    margin: 0;
    font-family: var(--font-display);
    font-weight: var(--font-weight-bold);
    letter-spacing: 0.05em;
    transition: all 0.3s ease;
}
.accordion-header:hover {
    opacity: 0.7;
    text-shadow: 0 0 20px rgba(0, 255, 136, 0.2);
}
.accordion-body {
    max-height: 520px;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
}
.accordion-body.collapsed {
    max-height: 0;
    opacity: 0;
}

/* ===== ИСТОРИЯ ===== */
#history {
    font-family: var(--font-mono);
    font-size: var(--font-size-sm);
    line-height: 1.35;
    max-height: 400px;
    overflow-y: auto;
    overflow-x: auto;
    white-space: nowrap;
    padding-right: 4px;
    margin: 0;
    letter-spacing: 0.02em;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}
#history::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
#history::-webkit-scrollbar-track {
    background: rgba(0, 255, 136, 0.05);
}
#history::-webkit-scrollbar-thumb {
    background: #00ff88;
    border-radius: 3px;
}

/* ===== LAST BYTE ===== */
#last-byte {
    font-family: var(--font-tech);
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    color: #00ff88;
    text-shadow: 0 0 20px rgba(0, 255, 136, 0.2);
}

/* ===== КАНАЛЫ ===== */
.channels-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 8px;
}
.channels-header h3 {
    margin: 0;
    font-size: var(--font-size-lg);
}
.channels-controls {
    display: flex;
    gap: 4px;
}
.channels-toggle-all {
    background: rgba(0, 255, 136, 0.08);
    border: 1px solid rgba(0, 255, 136, 0.2);
    color: #00ff88;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-family: var(--font-mono);
    transition: all 0.2s ease;
    line-height: 1.4;
    min-height: 30px;
}
.channels-toggle-all:hover {
    background: rgba(0, 255, 136, 0.15);
    border-color: #00ff88;
}
.channels-toggle-all:active {
    transform: scale(0.95);
}

/* ===== СЕТКА КАНАЛОВ ===== */
.channels-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    max-height: 500px;
    overflow-y: auto;
    overflow-x: visible;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding-right: 4px;
}
.channels-grid::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
.channels-grid::-webkit-scrollbar-track {
    background: rgba(0, 255, 136, 0.05);
}
.channels-grid::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 136, 0.3);
    border-radius: 3px;
}

/* Карточка канала */
.channel-item {
    background: rgba(0, 255, 136, 0.03);
    border: 1px solid rgba(0, 255, 136, 0.1);
    border-radius: 6px;
    overflow: hidden;
    transition: all 0.2s ease;
}
.channel-item:hover {
    border-color: rgba(0, 255, 136, 0.25);
    background: rgba(0, 255, 136, 0.06);
}
.channel-item.channel-active {
    border-color: rgba(0, 255, 136, 0.4);
    background: rgba(0, 255, 136, 0.08);
}
.channel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}
.channel-header:hover {
    background: rgba(0, 255, 136, 0.05);
}
.channel-label {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: #88ffbb;
    font-family: var(--font-tech);
}
.channel-value {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-bold);
    color: #ffffff;
    font-family: var(--font-tech);
    min-width: 32px;
    text-align: right;
    letter-spacing: 0.05em;
    padding: 2px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}
.channel-toggle {
    color: #666;
    font-size: 10px;
    transition: transform 0.3s;
    margin-left: 6px;
}
.channel-toggle.collapsed {
    transform: rotate(-90deg);
}
.channel-body {
    padding: 0 10px 10px 10px;
    transition: all 0.3s ease;
}
.channel-body.hidden {
    display: none;
}
.channel-progress {
    display: flex;
    align-items: center;
    gap: 8px;
}
.channel-progress .progress {
    flex: 1;
    height: 24px;
    padding: 3px;
    background: #2f2f2f;
    border: 2px solid #555;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.6);
}
.channel-progress .progress .fill {
    height: 100%;
    background: #e6852d;
    border-radius: 2px;
    transition: width 0.15s ease;
    width: 0%;
    box-shadow:
        inset 0 1px 2px rgba(255,255,255,0.3),
        0 0 15px rgba(255, 165, 0, 0.5);
}
.channel-item.channel-active .fill {
    box-shadow:
        inset 0 1px 2px rgba(255,255,255,0.4),
        0 0 25px rgba(255, 165, 0, 0.7);
}
.channel-stats {
    font-size: var(--font-size-xs);
    color: #666;
    margin-top: 4px;
    font-family: var(--font-mono);
    letter-spacing: 0.02em;
}

/* ===== ОСНОВНЫЕ ПРОГРЕСС-БАРЫ (bar1, bar2, bar3) ===== */
.progress-row {
    margin-bottom: 16px;
}
.progress-label {
    font-family: var(--font-mono);
    font-size: var(--font-size-base);
    margin-bottom: 6px;
    color: #ffffff;
    opacity: 0.9;
    letter-spacing: 0.03em;
}
.progress {
    width: 100%;
    height: 34px;
    padding: 4px;
    background: #222;
    border: 2px solid #444;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.4);
}
.progress-with-signal {
    display: flex;
    align-items: center;
    gap: 0;
}
.progress-90 {
    flex: 0 0 86%;
    margin-right: 10px;
}
.fill {
    height: 100%;
    width: 0%;
    background: #e6852d;
    border-radius: 2px;
    box-shadow:
        inset 0 1px 2px rgba(255,255,255,0.3),
        0 0 12px rgba(230,133,45,0.5);
    transition: width 0.25s linear;
}
.fill.no-connection {
    background: #555555 !important;
    box-shadow: none !important;
    width: 0 !important;
}

/* ===== ЗВУК И ВЫСОТА ===== */
.card:has(#bar2) .progress,
.card:has(#bar3) .progress {
    height: 34px;
    padding: 6px;
    background: #222;
    border: 2px solid #444;
    border-radius: 4px;
}
.card:has(#bar2) .fill,
.card:has(#bar3) .fill {
    background: #e6852d;
    box-shadow:
        inset 0 1px 2px rgba(255,255,255,0.3),
        0 0 12px rgba(230,133,45,0.5);
}

/* ===== ИНДИКАТОРЫ СИГНАЛА ===== */
.signal-icon {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    width: 34px;
    height: 34px;
    flex-shrink: 0;
}
.sig-bar {
    flex: 1;
    border-radius: 2px;
    min-width: 5px;
    border: 2px solid #e6852d;
    background-color: transparent;
    transition: background-color 0.3s, border-color 0.3s;
}
.sig-bar-1 { height: 33%; }
.sig-bar-2 { height: 66%; }
.sig-bar-3 { height: 100%; }
.sig-bar.dim {
    background-color: transparent;
    border-color: #1a3a1a;
}
.sig-bar.active-1,
.sig-bar.active-2,
.sig-bar.active-3 {
    background-color: #e6852d;
    border-color: #c46b1f;
}
.sig-bar.no-connection {
    background-color: #555555 !important;
    border-color: #555555 !important;
    opacity: 0.3 !important;
}

/* ===== АНИМАЦИЯ ===== */
.channel-item.updating .channel-value {
    animation: pulse-value 0.15s ease;
}
@keyframes pulse-value {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); color: #ff0; }
}

/* ===== КАРТОЧКИ НА ДЕСКТОПЕ ===== */
@media (min-width: 769px) {
    .card {
        max-height: 100%;
        overflow: visible;
    }
    .channels-card {
        max-height: 600px;
        overflow: visible;
        display: flex;
        flex-direction: column;
    }
    .channels-card .channels-grid {
        max-height: 500px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .history-card {
        max-height: 500px;
        overflow: visible;
        display: flex;
        flex-direction: column;
    }
    .history-card #history {
        max-height: 400px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* ===== МОБИЛЬНАЯ ВЕРСИЯ ===== */
@media (max-width: 768px) {
    .channels-grid {
        grid-template-columns: 1fr;
        gap: 4px;
        max-height: 400px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }
    .channels-header {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }
    .channels-controls {
        justify-content: flex-end;
    }
    .channel-label {
        font-size: var(--font-size-xs);
    }
    .channel-value {
        font-size: var(--font-size-sm);
    }
    #history {
        max-height: 300px;
    }
    .history-card #history {
        max-height: 280px;
        overflow-y: auto;
    }
}

@media (max-width: 480px) {
    .channels-grid {
        max-height: 350px;
        gap: 3px;
    }
    .channel-header {
        padding: 4px 8px;
    }
    .channel-body {
        padding: 0 8px 8px 8px;
    }
    .channel-stats {
        font-size: 9px;
    }
    #history {
        max-height: 200px;
        font-size: var(--font-size-xs);
    }
    .history-card #history {
        max-height: 180px;
    }
}