/* device.css - Стили для страницы телеметрии устройства */

/* Заголовок устройства */
.device-header {
    background: var(--white);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.device-header h2 {
    margin: 0 0 10px 0;
    color: var(--primary-dark);
}

.device-meta {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.device-meta span {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
}

.device-id {
    font-family: monospace;
    font-size: 12px;
    color: var(--text-secondary);
}

.device-status.online {
    background-color: var(--success-bg);
    color: var(--success);
}

.device-active.active {
    background-color: var(--success-bg);
    color: var(--success);
}

/* Вкладки телеметрии */
.telemetry-tabs {
    background: var(--white);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tab-headers {
    display: flex;
    background: var(--background-alt);
    border-bottom: 1px solid var(--border);
}

.tab-header {
    padding: 15px 20px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
}

.tab-header:hover {
    background: #dfe6e9;
    color: var(--primary-dark);
}

.tab-header.active {
    background: var(--white);
    color: var(--primary-light);
    border-bottom-color: var(--primary-light);
}

.tab-content {
    padding: 0;
}

.tab-pane {
    display: none;
    padding: 20px;
}

.tab-pane.active {
    display: block;
}

/* Текущие данные телеметрии */
.current-data-section h3 {
    margin: 0 0 20px 0;
    color: var(--primary-dark);
}

.telemetry-info {
    background: var(--background);
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    border-left: 4px solid var(--primary-light);
}

.telemetry-info p {
    margin: 5px 0;
    color: var(--primary-dark);
}

.telemetry-info strong {
    color: var(--primary);
}

.blocks-data-table {
    overflow-x: auto;
}

.block-row {
    transition: background-color 0.3s ease;
}

.block-row:hover {
    background-color: var(--background);
}

/* Графики телеметрии */
.graphs-section h3 {
    margin: 0 0 20px 0;
    color: var(--primary-dark);
}

.graph-controls {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 15px;
    background: var(--background);
    border-radius: 6px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.date-range-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.date-range-inputs input {
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
}

.data-type-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.color-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid;
}

.graph-container {
    position: relative;
    height: 400px;
    margin-top: 20px;
}

.chart-status {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.8);
}

.loading-state {
    text-align: center;
}

.loading-spinner {
    font-size: 3em;
    margin-bottom: 15px;
    color: var(--primary-light);
}

/* Секция лицензии */
.license-section {
    background: var(--white);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.license-section h3 {
    margin: 0 0 20px 0;
    color: var(--primary-dark);
}

.license-controls-compact {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.license-info-compact .form-group {
    margin-bottom: 15px;
}

.license-status-display {
    padding: 8px;
    border-radius: 4px;
}

.license-not-set {
    color: var(--text-muted);
    font-weight: normal;
    background-color: var(--background-alt);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.license-date-management .form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.license-date-input {
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
}

.license-suspend-hint {
    font-size: 12px;
    color: var(--text-secondary);
}

#license-messages {
    margin-top: 15px;
}

.alert {
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 10px;
}

.alert-success {
    background-color: var(--success-bg);
    color: var(--success);
    border: 1px solid var(--success);
}

.alert-error {
    background-color: var(--danger-bg);
    color: var(--danger);
    border: 1px solid var(--danger);
}

/* Таблица устройств */
.devices-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.devices-table th {
    background: var(--primary);
    color: var(--white);
    padding: 15px;
    text-align: left;
    font-weight: bold;
    font-size: 14px;
}

.devices-table td {
    padding: 15px;
    border-bottom: 1px solid var(--background-alt);
    vertical-align: top;
}

.devices-table tr:last-child td {
    border-bottom: none;
}

/* Строки устройств */
.device-row {
    transition: all 0.3s ease;
    cursor: pointer;
}

.device-row:hover {
    background-color: var(--background) !important;
}

.device-name {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: bold;
    color: var(--primary-dark);
}

.device-icon {
    font-size: 1.2em;
    color: var(--primary-light);
}

.device-id {
    font-family: monospace;
    font-size: 12px;
    color: var(--text-secondary);
}

.device-last-seen {
    color: var(--text-muted);
    font-size: 14px;
}

.device-telemetry-count {
    text-align: center;
    font-weight: bold;
    color: var(--primary-light);
}

/* Компактная таблица устройств */
.compact-table th,
.compact-table td {
    padding: 10px 12px;
    font-size: 13px;
}

.compact-table .device-name {
    font-size: 14px;
}

.status-cell {
    text-align: center;
}

.status-indicator {
    font-size: 16px;
}

.firmware-version {
    font-family: monospace;
    font-size: 12px;
    color: var(--text-secondary);
}


/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
    .devices-table {
        display: block;
        overflow-x: auto;
    }

    .devices-table th,
    .devices-table td {
        padding: 10px;
        font-size: 12px;
    }

    .device-meta {
        flex-direction: column;
        gap: 8px;
    }

    .tab-headers {
        flex-direction: column;
    }

    .tab-header {
        text-align: center;
        border-bottom: 1px solid var(--border);
        border-right: none;
    }

    .graph-controls {
        flex-direction: column;
    }

    .data-type-checkboxes {
        flex-direction: column;
        gap: 10px;
    }

    .license-controls-compact {
        flex-direction: column;
    }

    .graph-container {
        height: 300px;
    }
}

@media (max-width: 480px) {

    .device-header,
    .license-section,
    .telemetry-tabs {
        padding: 15px;
    }

    .devices-table th,
    .devices-table td {
        padding: 8px 5px;
        font-size: 11px;
    }

    .device-name {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }

    .tab-pane {
        padding: 15px;
    }

    .graph-container {
        height: 250px;
    }

    .date-range-inputs {
        flex-direction: column;
        align-items: stretch;
    }
}