/**
 * 芯片绑定管理样式
 */

/* ================================
   芯片绑定容器
   ================================ */
.chip-bindings-container {
    max-width: 100%;
    margin: 0 auto;
}

.chip-bindings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
}

.chip-bindings-header h4 {
    margin: 0;
    color: #333;
    font-size: 1.4em;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95em;
}

.user-label {
    color: #666;
    font-weight: 500;
}

.user-name {
    color: #2c5aa0;
    font-weight: 600;
    background: #f0f4f8;
    padding: 4px 8px;
    border-radius: 4px;
}

/* ================================
   统计信息
   ================================ */
.chip-bindings-stats {
    margin-bottom: 20px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-item {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
}

.stat-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.stat-item.active {
    background: #d4edda;
    border-color: #28a745;
}

.stat-item.inactive {
    background: #f8d7da;
    border-color: #dc3545;
}

.stat-item.suspended {
    background: #fff3cd;
    border-color: #ffc107;
}

.stat-item.recent {
    background: #d1ecf1;
    border-color: #17a2b8;
}

.stat-value {
    font-size: 1.8em;
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.85em;
    color: #666;
    font-weight: 500;
}

/* ================================
   操作按钮区域
   ================================ */
.chip-bindings-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.chip-bindings-actions .btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.9em;
    transition: all 0.3s ease;
}

.chip-bindings-actions .btn .icon {
    font-size: 1em;
}

/* ================================
   芯片绑定表格
   ================================ */
.chip-bindings-table-container {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.chip-bindings-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9em;
}

.chip-bindings-table th {
    background: #f8f9fa;
    padding: 12px 8px;
    text-align: left;
    font-weight: 600;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
    white-space: nowrap;
}

.chip-bindings-table td {
    padding: 10px 8px;
    border-bottom: 1px solid #dee2e6;
    vertical-align: middle;
}

.chip-bindings-table tr:hover {
    background: #f8f9fa;
}

.chip-bindings-table tr:last-child td {
    border-bottom: none;
}

/* 芯片ID样式 */
.chip-id {
    font-family: 'Courier New', monospace;
    background: #f1f3f4;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85em;
    color: #333;
    word-break: break-all;
    max-width: 120px;
    display: inline-block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 芯片名称和型号 */
.chip-name {
    font-weight: 500;
    color: #333;
}

.chip-model {
    font-size: 0.8em;
    color: #666;
    margin-top: 2px;
}

/* 应用ID */
.app-id {
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
    color: #666;
}

/* 绑定时间 */
.binding-time {
    font-size: 0.85em;
    color: #666;
}

/* 绑定人 */
.bound-by {
    font-size: 0.9em;
    color: #495057;
}

/* 同步状态 */
.sync-status {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: 500;
}

.sync-status.sync-pending {
    background: #fff3cd;
    color: #856404;
}

.sync-status.sync-synced {
    background: #d4edda;
    color: #155724;
}

.sync-status.sync-failed {
    background: #f8d7da;
    color: #721c24;
}

.sync-time {
    font-size: 0.75em;
    color: #666;
    margin-top: 2px;
}

/* ================================
   分页控件
   ================================ */
.chip-bindings-pagination {
    margin-top: 20px;
}

.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.pagination-controls .btn {
    padding: 6px 12px;
    font-size: 0.85em;
    min-width: 40px;
}

.pagination-controls .btn.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.pagination-info {
    font-size: 0.85em;
    color: #666;
    margin-left: 15px;
}

/* ================================
   芯片绑定表单
   ================================ */
.chip-binding-form {
    max-width: 600px;
    margin: 0 auto;
}

.chip-binding-form .form-section {
    margin-bottom: 25px;
}

.chip-binding-form .form-section h4 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 1.2em;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 8px;
}

.chip-binding-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.chip-binding-form .form-group {
    display: flex;
    flex-direction: column;
}

.chip-binding-form .form-group label {
    font-weight: 500;
    color: #333;
    margin-bottom: 5px;
    font-size: 0.9em;
}

.chip-binding-form .form-group input,
.chip-binding-form .form-group select,
.chip-binding-form .form-group textarea {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9em;
    transition: border-color 0.3s ease;
}

.chip-binding-form .form-group input:focus,
.chip-binding-form .form-group select:focus,
.chip-binding-form .form-group textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
}

.chip-binding-form .field-help {
    font-size: 0.8em;
    color: #666;
    margin-top: 4px;
    font-style: italic;
}

.chip-binding-form .form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

/* ================================
   芯片绑定详情
   ================================ */
.chip-binding-detail {
    max-width: 800px;
    margin: 0 auto;
}

.chip-binding-detail .detail-section {
    margin-bottom: 25px;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.chip-binding-detail .detail-section h4 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 1.1em;
    border-bottom: 2px solid #007bff;
    padding-bottom: 8px;
}

.chip-binding-detail .detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.chip-binding-detail .detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chip-binding-detail .detail-item.full-width {
    grid-column: 1 / -1;
}

.chip-binding-detail .detail-item label {
    font-weight: 600;
    color: #495057;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chip-binding-detail .detail-item span {
    color: #333;
    font-size: 0.95em;
    padding: 4px 0;
}

.chip-binding-detail .error-message {
    color: #dc3545;
    background: #f8d7da;
    padding: 8px 12px;
    border-radius: 4px;
    border: 1px solid #f5c6cb;
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
}

.chip-binding-detail .detail-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
}

/* ================================
   用户表格中的芯片绑定信息
   ================================ */
.chip-binding-info {
    text-align: center;
}

.chip-binding-info.no-bindings {
    color: #999;
    font-size: 0.85em;
    font-style: italic;
}

.chip-count {
    display: inline-block;
    background: #e3f2fd;
    color: #1976d2;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: 500;
    cursor: help;
}

/* 操作按钮中的芯片按钮 */
.action-btn.chip {
    background: #e3f2fd;
    color: #1976d2;
    border: 1px solid #bbdefb;
}

.action-btn.chip:hover {
    background: #1976d2;
    color: white;
    border-color: #1976d2;
}

/* ================================
   无数据状态
   ================================ */
.no-data {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-style: italic;
    background: #f8f9fa;
    border-radius: 8px;
    margin: 20px 0;
}

/* ================================
   响应式设计
   ================================ */
@media (max-width: 768px) {
    .chip-bindings-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .chip-bindings-actions {
        flex-direction: column;
    }
    
    .chip-bindings-table-container {
        overflow-x: auto;
    }
    
    .chip-bindings-table {
        min-width: 800px;
    }
    
    .chip-binding-form .form-row {
        grid-template-columns: 1fr;
    }
    
    .chip-binding-detail .detail-grid {
        grid-template-columns: 1fr;
    }
    
    .pagination-controls {
        flex-direction: column;
        gap: 5px;
    }
    
    .pagination-info {
        margin-left: 0;
        margin-top: 10px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .chip-binding-detail .detail-actions {
        flex-direction: column;
    }
    
    .chip-bindings-actions .btn {
        width: 100%;
        justify-content: center;
    }
}
