/**
 * 设备网格视图样式
 * 包含设备卡片、位置树、网格布局等样式
 */

/* ========================================
   设备卡片样式
   ======================================== */

.equipment-card {
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
    height: 100%;
    border: 1px solid #f0f0f0;
}

.equipment-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

/* 状态样式 */
.equipment-card.status-running {
    border-left: 4px solid #52c41a;
}

.equipment-card.status-fault {
    border-left: 4px solid #f5222d;
}

.equipment-card.status-maintenance {
    border-left: 4px solid #faad14;
}

.equipment-card.status-idle {
    border-left: 4px solid #1890ff;
}

.equipment-card.status-stopped {
    border-left: 4px solid #d9d9d9;
}

/* 状态指示灯 */
.status-indicator {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    z-index: 1;
}

.status-indicator.status-running {
    background: #52c41a;
    box-shadow: 0 0 4px #52c41a;
}

.status-indicator.status-fault {
    background: #f5222d;
    box-shadow: 0 0 4px #f5222d;
    animation: blink 1s infinite;
}

.status-indicator.status-maintenance {
    background: #faad14;
    box-shadow: 0 0 4px #faad14;
}

.status-indicator.status-idle {
    background: #1890ff;
    box-shadow: 0 0 4px #1890ff;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* 尺寸变体 */
.equipment-card.size-small {
    padding: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.equipment-card.size-medium {
    padding: 12px;
}

.equipment-card.size-large {
    padding: 16px;
}

/* 设备图片 */
.equipment-image {
    width: 100%;
    height: 120px;
    background: #f5f5f5;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.equipment-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.equipment-image.placeholder {
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
}

.equipment-image .placeholder-icon {
    font-size: 48px;
    opacity: 0.3;
}

/* 设备信息 */
.equipment-info {
    position: relative;
}

.equipment-name {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #262626;
}

.equipment-model {
    font-size: 12px;
    color: #999;
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.equipment-meta {
    margin-bottom: 8px;
}

.location-path {
    font-size: 12px;
    color: #666;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 4px;
}

/* 健康评分 */
.health-score {
    display: flex;
    justify-content: center;
    margin: 12px 0;
}

/* 快速操作 */
.quick-actions {
    border-top: 1px solid #f0f0f0;
    padding-top: 8px;
    margin-top: 8px;
}

/* 小尺寸特殊样式 */
.equipment-card.size-small .equipment-name {
    font-size: 14px;
    flex: 1;
}

.equipment-card.size-small .health-score {
    margin: 0;
}

.equipment-card.size-small .status-tag {
    margin-left: auto;
}

/* ========================================
   网格视图布局
   ======================================== */

.grid-view-container {
    display: flex;
    /* 使用 flex: 1 填充父容器（父容器是 display: flex） */
    flex: 1;
    min-height: 0;
    gap: 16px;
}

.location-tree-panel {
    width: 280px;
    background: #fff;
    border-radius: 4px;
    padding: 16px;
    overflow-y: auto;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.location-tree-panel .equipment-count {
    color: #999;
    font-size: 12px;
    margin-left: 4px;
}

.location-tree .ant-tree-node-content-wrapper {
    transition: background-color 0.2s;
}

.location-tree .ant-tree-node-content-wrapper:hover {
    background-color: #e6f7ff !important;
}

.equipment-grid-panel {
    flex: 1;
    background: #fff;
    border-radius: 4px;
    padding: 16px;
    overflow-y: auto;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.grid-toolbar {
    margin-bottom: 16px;
    padding: 12px;
    background: #f5f5f5;
    border-radius: 4px;
}

.grid-toolbar .stats {
    color: #666;
    font-size: 14px;
    margin-left: 8px;
}

.equipment-grid {
    min-height: 400px;
}

/* ========================================
   视图切换器
   ======================================== */

.view-switcher-container {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.view-tabs {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.view-tabs .ant-tabs-content-holder {
    flex: 1;
    overflow: hidden;
}

.view-tabs .ant-tabs-content {
    height: 100%;
}

.view-tabs .ant-tabs-tabpane {
    height: 100%;
    overflow: auto;
}

#map-view-content {
    height: 100%;
}

#equipment-map-container {
    height: 100%;
}

.coming-soon {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 400px;
}

/* ========================================
   响应式设计
   ======================================== */

@media (max-width: 768px) {
    .grid-view-container {
        flex-direction: column;
        height: auto;
    }
    
    .location-tree-panel {
        width: 100%;
        max-height: 300px;
    }
    
    .equipment-card.size-large {
        padding: 12px;
    }
    
    .equipment-image {
        height: 100px;
    }
    
    .view-tabs .ant-tabs-nav {
        margin-bottom: 8px;
    }
    
    .view-tabs .ant-tabs-tab {
        padding: 8px 12px;
        font-size: 12px;
    }
}

