/* css/device-library-panel.css */
/* 设备库侧边栏面板样式 */

/* 面板容器 */
.device-library-panel {
    position: fixed;
    width: 320px;
    max-height: calc(100vh - 100px);
    background: var(--ds-bg-panel-floating);
    border: 0;
    border-radius: 8px;
    box-shadow: var(--ds-shadow-floating-strong);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 初始位置 - 左侧居中 */
.device-library-panel.initial-position {
    left: 80px;
    top: 50%;
    transform: translateY(-50%);
}

/* 标题栏 */
.device-library-panel .panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 4px 12px 12px;
    background: #3a3a3a;
    border-bottom: 0;
    cursor: move;
    user-select: none;
}

.device-library-panel .panel-title {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 500;
}

.device-library-panel .panel-title i {
    font-size: 16px;
    color: #BD1C22;
}

.device-library-panel .panel-controls {
    display: flex;
    gap: 4px;
}

.device-library-panel .panel-close-btn {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.device-library-panel .panel-close-btn i {
    font-size: 18px;
}

.device-library-panel .panel-close-btn:hover {
    color: #ffffff;
}

/* 搜索栏 */
.device-library-panel .panel-search {
    padding: 12px 8px;
    background: #2b2b2b;
    border-bottom: 0;
    position: relative;
}

.device-library-panel .panel-search i {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    pointer-events: none;
    z-index: 1;
}

.device-library-panel .panel-search input {
    position: relative;
    z-index: 0;
    width: 100%;
    background: #3a3a3a;
    border: 0;
    border-radius: 4px;
    padding: 8px 12px 8px 30px;
    color: #ffffff;
    font-size: 12px;
    outline: none;
    box-sizing: border-box;
}

.device-library-panel .panel-search input:focus {
    border-color: #BD1C22;
}

.device-library-panel .panel-search:focus-within i {
    color: #cfcfcf;
}

.device-library-panel .panel-search input::placeholder {
    color: #999;
}

/* 设备列表区域 */
.device-library-panel .panel-devices {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

/* 滚动条样式 */
.device-library-panel .panel-devices::-webkit-scrollbar {
    width: 6px;
}

.device-library-panel .panel-devices::-webkit-scrollbar-track {
    background: #2b2b2b;
}

.device-library-panel .panel-devices::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 3px;
}

.device-library-panel .panel-devices::-webkit-scrollbar-thumb:hover {
    background: #666;
}

/* 设备分类 */
.device-library-panel .device-category {
    margin-bottom: 8px;
}

.device-library-panel .category-header {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: #3a3a3a;
    border-radius: 4px;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s;
}

.device-library-panel .category-header:hover {
    background: #4a4a4a;
}

.device-library-panel .category-icon {
    margin-right: 8px;
    color: #999;
    transition: transform 0.2s;
}

.device-library-panel .category-header.collapsed .category-icon {
    transform: rotate(-90deg);
}

.device-library-panel .category-name {
    flex: 1;
    color: #ffffff;
    font-size: 12px;
}

.device-library-panel .category-count {
    color: #999;
    font-size: 11px;
}

/* 设备列表容器 */
.device-library-panel .category-devices {
    padding: 8px 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.device-library-panel .category-header.collapsed + .category-devices {
    display: none;
}

/* 设备卡片 */
.device-library-panel .device-card {
    background: #3a3a3a;
    border: 2px solid transparent;
    border-radius: 6px;
    padding: 8px;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    display: flex;
    flex-direction: column;
    min-height: 100px;
}

.device-library-panel .device-card:hover {
    background: #4a4a4a;
    border-color: #666;
}

.device-library-panel .device-card.selected {
    border-color: #BD1C22;
    background: #4a4a4a;
}

.device-library-panel .device-card.dragging {
    opacity: 0.5;
}

.device-library-panel .device-card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    width: 100%;
    min-height: 60px;
    background: #2b2b2b;
    border-radius: 4px;
    margin-bottom: 6px;
}

.device-library-panel .device-card-icon i {
    font-size: 32px;
    color: #BD1C22;
}

.device-library-panel .device-card-info {
    text-align: center;
    flex-shrink: 0;
}

.device-library-panel .device-model {
    color: #ffffff;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.device-library-panel .device-card .device-category {
    display: none;
}

/* 无结果提示 */
.device-library-panel .no-results {
    padding: 32px;
    text-align: center;
    color: #999;
    font-size: 13px;
}

/* 面板显示/隐藏 */
.device-library-panel.hidden {
    display: none;
}

/* 拖动时的样式 */
.device-library-panel.dragging {
    opacity: 0.8;
    cursor: move;
}

/* 设备详情浮层 */
.device-detail-popup {
    position: fixed;
    z-index: 2100;
    display: flex;
    align-items: stretch;
    width: 560px;
    min-height: 220px;
    padding: 16px;
    gap: 18px;
    background: var(--ds-bg-popover);
    border: 0;
    border-radius: 8px;
    box-shadow: var(--ds-shadow-popover);
    color: #f4f4f5;
    pointer-events: none;
}

.device-detail-popup.hidden {
    display: none;
}

.device-detail-image {
    width: 220px;
    min-height: 188px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: linear-gradient(180deg, #3a3a3a 0%, #252525 100%);
    border: 0;
    border-radius: 6px;
}

.device-detail-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.device-detail-image-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 132px;
    height: 132px;
    color: #BD1C22;
    background: #2b2b2b;
    border: 0;
    border-radius: 8px;
    box-shadow: inset 0 0 0 8px #333;
}

.device-detail-image-fallback i {
    font-size: 68px;
}

.device-detail-content {
    flex: 1;
    min-width: 0;
    padding: 2px 0;
}

.device-detail-title {
    color: #ffffff;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.35;
}

.device-detail-category {
    margin-top: 2px;
    margin-bottom: 12px;
    color: #b6b6b6;
    font-size: 12px;
}

.device-detail-parameters {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.device-detail-parameters li {
    position: relative;
    padding-left: 18px;
    color: #eeeeee;
    font-size: 12px;
    line-height: 1.45;
}

.device-detail-parameters li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.42em;
    width: 9px;
    height: 9px;
    background: #BD1C22;
    border-radius: 50%;
}

/* 去线条化：设备库改为无描边面板，选中和悬停用背景变化表达 */
.device-library-panel {
    border: 0;
    background: var(--ds-bg-panel-floating);
    box-shadow: var(--ds-shadow-floating-strong);
}

.device-library-panel .panel-header,
.device-library-panel .panel-search {
    border-bottom: 0;
}

.device-library-panel .panel-header {
    background: #383838;
}

.device-library-panel .panel-search input,
.device-library-panel .device-card,
.device-detail-popup,
.device-detail-image,
.device-detail-image-fallback {
    border-color: transparent;
}

.device-library-panel .panel-search input {
    background: #383838;
}

.device-library-panel .panel-search input:focus {
    border-color: transparent;
    box-shadow: none;
    background: #424242;
}

.device-library-panel .category-header {
    background: #383838;
}

.device-library-panel .category-header:hover {
    background: #454545;
}

.device-library-panel .device-card {
    border-width: 0;
    background: #383838;
}

.device-library-panel .device-card:hover {
    border-color: transparent;
    background: #454545;
}

.device-library-panel .device-card.selected {
    border-color: transparent;
    background: rgba(189, 28, 34, 0.24);
}

.device-detail-popup {
    box-shadow: var(--ds-shadow-popover);
}

.device-detail-image-fallback {
    box-shadow: none;
}

.device-library-panel input:focus,
.device-library-panel input:focus-visible,
.device-library-panel button:focus,
.device-library-panel button:focus-visible {
    outline: none;
    border-color: transparent;
    box-shadow: none;
}
