/* ===== РЕСПОНСИВНЫЙ ДИЗАЙН ===== */

/* ===== ПЛАНШЕТЫ ===== */
@media (max-width: 1024px) {
    body { padding: 10px; }
    .header-bar { gap: 10px; grid-template-columns: 1fr auto; }
    .header-bar h1 { font-size: var(--font-size-xl); }
    .header-time { font-size: var(--font-size-sm); padding: 4px 10px; }
    .cam-btn { font-size: var(--font-size-sm); padding: 6px 12px; }
    .card { padding: 12px 14px; }
    .card h3 { font-size: var(--font-size-base); }
    #status { font-size: var(--font-size-2xl); }
    .progress { height: 28px; padding: 4px; }
    .progress-label { font-size: var(--font-size-sm); }
    .signal-icon { width: 28px; height: 28px; }
}

/* ===== МОБИЛЬНЫЕ ===== */
@media (max-width: 768px) {
    body {
        padding: 8px;
        font-size: var(--font-size-base);
        overflow-y: auto;
        min-height: 100vh;
        height: auto;
    }
    button, .cam-btn, .tab-btn, .pagination-btn, .log-file-item {
        min-height: 44px;
        min-width: 44px;
    }
    .header-bar {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        margin-bottom: 12px;
        flex-shrink: 0;
    }
    .header-bar h1 {
        font-size: var(--font-size-lg);
        text-align: center;
        letter-spacing: 0.05em;
    }
    .header-bar > div {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 6px;
    }
    .header-time {
        font-size: var(--font-size-sm);
        padding: 4px 10px;
        flex: 1;
        min-width: 80px;
    }
    #audio-indicator {
        font-size: var(--font-size-base);
        padding: 4px 10px;
        min-width: 40px;
    }
    .cam-btn {
        font-size: var(--font-size-sm);
        padding: 8px 14px;
        justify-content: center;
        flex: 1;
        min-width: 80px;
    }
    .header-bar a[href="/logs.html"] {
        font-size: var(--font-size-sm);
        padding: 6px 12px;
        text-align: center;
        flex: 1;
        min-width: 60px;
    }
    .grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    .wide { grid-column: span 1; }
    .card { padding: 12px; border-radius: 8px; overflow: visible !important; height: auto !important; }
    .card h3 { font-size: var(--font-size-base); margin-bottom: 8px; }
    #status { font-size: var(--font-size-2xl); }
    #meta { font-size: var(--font-size-sm); }
    .progress-row { margin-bottom: 12px; }
    .progress-label { font-size: var(--font-size-sm); margin-bottom: 4px; }
    .progress { height: 30px; padding: 4px; border-width: 2px; }
    .progress-with-signal { flex-wrap: nowrap; }
    .progress-90 { flex: 1; margin-right: 8px; }
    .signal-icon { width: 30px; height: 30px; flex-shrink: 0; }
    .sig-bar { min-width: 4px; border-width: 1.5px; }
    .accordion-header { padding: 8px 0; font-size: var(--font-size-base); }
    .accordion-body { max-height: 400px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
    .cam-modal { height: 100%; min-height: 300px; }
    .cam-header { padding: 6px 10px; font-size: var(--font-size-sm); }
    .cam-frame { object-fit: cover; }
    .crosshair-box { width: 80px; height: 80px; border-width: 1.5px; }
    .hotkey-hint { font-size: var(--font-size-xs); padding: 4px 0; flex-shrink: 0; }
    .hotkey-hint kbd { padding: 2px 6px; font-size: var(--font-size-xs); }
    .channels-grid { overscroll-behavior: auto !important; max-height: none !important; overflow-y: visible !important; }
}

/* ===== МАЛЕНЬКИЕ ТЕЛЕФОНЫ ===== */
@media (max-width: 480px) {
    body { padding: 6px; }
    .header-bar h1 { font-size: var(--font-size-base); }
    .header-bar > div { flex-wrap: wrap; }
    .header-time { font-size: var(--font-size-xs); padding: 4px 8px; min-width: 60px; }
    #audio-indicator { font-size: var(--font-size-sm); padding: 4px 8px; min-width: 35px; }
    .cam-btn { font-size: var(--font-size-xs); padding: 6px 10px; min-width: 60px; }
    .card { padding: 10px; border-radius: 6px; }
    .card h3 { font-size: var(--font-size-sm); }
    #status { font-size: var(--font-size-xl); }
    #meta { font-size: var(--font-size-xs); }
    .progress { height: 24px; padding: 3px; border-width: 2px; }
    .progress-label { font-size: var(--font-size-xs); }
    .signal-icon { width: 24px; height: 24px; }
    .sig-bar { min-width: 3px; border-width: 1px; }
    .sig-bar-1 { height: 30%; }
    .sig-bar-2 { height: 60%; }
    .sig-bar-3 { height: 90%; }
    .right { height: 35vh; min-height: 200px; }
    .cam-header { padding: 4px 8px; font-size: var(--font-size-xs); }
    .crosshair-box { width: 60px; height: 60px; }
    #history { font-size: var(--font-size-xs); max-height: 200px; }
}

/* ===== ТАЧ-ИНТЕРФЕЙС ===== */
@media (hover: none) and (pointer: coarse) {
    button, .cam-btn, .tab-btn, .pagination-btn, .log-file-item,
    .accordion-header, .pagination-goto-btn {
        min-height: 44px;
        min-width: 44px;
        padding: 8px 16px;
    }
    .cam-btn:hover, .tab-btn:hover, .pagination-btn:hover, .log-file-item:hover {
        transform: none;
    }
    .cam-btn:active, .tab-btn:active, .pagination-btn:active, .log-file-item:active {
        transform: scale(0.95);
        background: rgba(0, 255, 136, 0.15);
    }
    .panel, .logs-content, .logs-sidebar, #history, #dataTableContainer, .accordion-body {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
        overscroll-behavior: contain;
    }
    .pagination-input { min-height: 44px; font-size: var(--font-size-base); padding: 8px 12px; }
    input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; }
    .header-link, .cam-btn, .cam-close-btn { min-height: 44px !important; min-width: 44px !important; padding: 8px 14px !important; }
    .header-link:active, .cam-btn:active { transform: scale(0.95); }
}

/* ===== ТЁМНАЯ ТЕМА ===== */
@media (prefers-color-scheme: dark) {
    body { background: #0a0f0a; }
}

/* ===== ПЕЧАТЬ ===== */
@media print {
    .header-bar, .cam-btn, .resizer, .right, .pagination-container, .hotkey-hint {
        display: none !important;
    }
    .layout { display: block !important; height: auto !important; }
    .panel { height: auto !important; overflow: visible !important; }
    .card { break-inside: avoid; border: 1px solid #00ff88; }
}

/* ===== СКРОЛЛБАРЫ ===== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: rgba(0, 255, 136, 0.05); border-radius: 4px; }
::-webkit-scrollbar-thumb { background: rgba(0, 255, 136, 0.3); border-radius: 4px; transition: background 0.3s ease; }
::-webkit-scrollbar-thumb:hover { background: rgba(0, 255, 136, 0.5); }
* { scrollbar-width: thin; scrollbar-color: rgba(0, 255, 136, 0.3) rgba(0, 255, 136, 0.05); }

.panel::-webkit-scrollbar, .logs-sidebar::-webkit-scrollbar,
.logs-content::-webkit-scrollbar, #history::-webkit-scrollbar,
.accordion-body::-webkit-scrollbar, .channels-grid::-webkit-scrollbar {
    width: 6px;
}
.panel::-webkit-scrollbar-track, .logs-sidebar::-webkit-scrollbar-track,
.logs-content::-webkit-scrollbar-track, #history::-webkit-scrollbar-track,
.accordion-body::-webkit-scrollbar-track, .channels-grid::-webkit-scrollbar-track {
    background: rgba(0, 255, 136, 0.05);
    border-radius: 3px;
}
.panel::-webkit-scrollbar-thumb, .logs-sidebar::-webkit-scrollbar-thumb,
.logs-content::-webkit-scrollbar-thumb, #history::-webkit-scrollbar-thumb,
.accordion-body::-webkit-scrollbar-thumb, .channels-grid::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 136, 0.3);
    border-radius: 3px;
}
.panel::-webkit-scrollbar-thumb:hover, .logs-sidebar::-webkit-scrollbar-thumb:hover,
.logs-content::-webkit-scrollbar-thumb:hover, #history::-webkit-scrollbar-thumb:hover,
.accordion-body::-webkit-scrollbar-thumb:hover, .channels-grid::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 255, 136, 0.5);
}