/* ========== 全局基础 ========== */
* {
    box-sizing: border-box;
}
body {
    background-color: #f5f7fa;
    font-family: "Microsoft YaHei", sans-serif;
    padding: 10px 0;
    font-size: 13px;
    line-height: 1.4;
}
.container {
    max-width: 1200px;
}

/* ========== 顶部与标题 ========== */
.top-bar {
    margin-bottom: 8px;
}
.page-header {
    text-align: center;
    margin-bottom: 14px;
}
.page-header h3 {
    font-size: 20px;
    margin: 0 0 4px 0;
    color: #303133;
    font-weight: 600;
}
.page-header .tip {
    font-size: 12px;
    color: #909399;
    margin: 0;
}

/* ========== 卡片通用（兼容Bootstrap原生card） ========== */
.card {
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    padding: 14px 16px;
    margin-bottom: 12px;
    border: 1px solid #ebeef5;
}

/* ========== 表单紧凑化 ========== */
.form-label {
    font-size: 12px;
    margin-bottom: 3px;
    color: #606266;
    font-weight: 500;
}
.form-control,
select.form-control {
    font-size: 13px;
    padding: 4px 8px;
    min-height: 32px;
    line-height: 1.3;
    border-radius: 4px;
}
.form-control-sm {
    min-height: 30px;
}
textarea.form-control {
    resize: vertical;
}
.file-input-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.file-input {
    padding: 2px 6px;
    font-size: 12px;
}

/* ========== 上传进度条 ========== */
.upload-progress-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}
.upload-progress-wrap .progress {
    flex: 1;
    height: 8px;
    border-radius: 4px;
    background: #f0f0f0;
    overflow: hidden;
}
.progress-text {
    font-size: 12px;
    color: #666;
    min-width: 40px;
}
.upload-tip {
    font-size: 12px;
    margin-top: 4px;
}
.upload-tip.text-success { color: #67c23a; }
.upload-tip.text-danger { color: #f56c6c; }

/* ========== 按钮组 ========== */
.btn-group-wrap {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 10px;
}
.btn-group-wrap .btn {
    min-width: 100px;
    padding: 5px 16px;
    font-size: 13px;
}

/* ========== 查询结果头部（合并重复定义） ========== */
.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 10px;
}
.result-header h5 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #303133;
}
.result-count {
    font-size: 12px;
    color: #909399;
    font-weight: normal;
}
.result-tools {
    display: flex;
    align-items: center;
    gap: 10px;
}
.inner-search {
    width: 260px;
}
.inner-search input {
    font-size: 12px;
}

/* ========== 表格样式（保留兼容，可切换回表格模式） ========== */
.table-wrap {
    overflow-x: auto;
}
#device-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-bottom: 0;
}
#device-table thead th {
    background-color: #f0f7ff;
    color: #409eff;
    font-weight: 600;
    padding: 7px 8px;
    text-align: left;
    border-bottom: 1px solid #e6f2ff;
    white-space: nowrap;
}
#device-table tbody td {
    padding: 6px 8px;
    border-bottom: 1px solid #ebeef5;
    color: #606266;
    vertical-align: middle;
    word-break: break-all;
    line-height: 1.5;
}
#device-table tbody tr:hover {
    background-color: #fafafa;
}
.empty-state {
    text-align: center;
    padding: 30px 0;
    color: #909399;
    font-size: 13px;
}

/* 表格内多媒体缩略图（兼容旧模式） */
.media-thumb {
    display: inline-block;
    margin: 2px 4px 2px 0;
    cursor: pointer;
    vertical-align: middle;
}
.media-thumb.img-thumb img {
    max-width: 60px;
    max-height: 45px;
    border-radius: 3px;
    border: 1px solid #eee;
}
.media-thumb.video-thumb {
    width: 60px;
    height: 45px;
    background: #000;
    color: #fff;
    border-radius: 3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}
.media-thumb.file-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    background: #f5f7fa;
    border-radius: 3px;
    font-size: 12px;
    color: #409eff;
    text-decoration: none;
    margin: 2px 4px 2px 0;
}
.media-thumb.file-item:hover {
    background: #ecf5ff;
    text-decoration: none;
}

/* ========== 输入建议下拉 ========== */
.suggestion-list {
    position: absolute;
    z-index: 9999;
    width: 100%;
    max-height: 160px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #dcdfe6;
    border-radius: 4px;
    list-style: none;
    padding: 2px 0;
    margin: 2px 0 0 0;
    display: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.suggestion-list li {
    padding: 5px 10px;
    cursor: pointer;
    font-size: 13px;
    list-style: none;
}
.suggestion-list li:hover {
    background-color: #f5f7fa;
    color: #409eff;
}
.input-wrap {
    position: relative;
    width: 100%;
}

/* ========== 多媒体预览弹窗（灯箱） ========== */
.media-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: none;
}
.modal-mask {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.75);
}
.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 90vw;
    max-height: 90vh;
    background: #fff;
    border-radius: 6px;
    overflow: hidden;
}
.modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    background: rgba(0,0,0,0.5);
    color: #fff;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    z-index: 10;
}
.modal-close:hover {
    background: rgba(0,0,0,0.7);
}
.modal-body {
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-body img {
    max-width: 90vw;
    max-height: 85vh;
    display: block;
}
.modal-body video {
    max-width: 90vw;
    max-height: 85vh;
    display: block;
}

/* ========== 卡片列表布局（核心展示区） ========== */
.card-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}
.device-card {
    border: 1px solid #ebeef5;
    border-radius: 6px;
    padding: 12px 14px;
    background: #fcfdff;
    transition: all 0.2s ease;
}
.device-card:hover {
    box-shadow: 0 2px 8px rgba(64, 158, 255, 0.12);
    border-color: #d9ecff;
    transform: translateY(-1px);
}
/* 卡片标题：设备基本信息 */
.card-title {
    font-size: 15px;
    font-weight: 600;
    color: #303133;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #ebeef5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
}
.card-title .device-name {
    color: #409eff;
}
.card-title .device-meta {
    font-size: 12px;
    color: #909399;
    font-weight: normal;
}

/* 卡片内容：分区文件列表 */
.card-section {
    margin-bottom: 8px;
}
.card-section:last-child {
    margin-bottom: 0;
}
.section-label {
    font-size: 12px;
    color: #606266;
    font-weight: 500;
    margin-bottom: 4px;
}
/* 文件列表：每行一个，完整文件名不截断 */
.file-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.file-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    line-height: 1.4;
    word-break: break-all;
    color: #606266;
    padding: 3px 6px;
    border-radius: 3px;
    background: #fff;
    border: 1px solid #f0f0f0;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}
.file-item:hover {
    background: #ecf5ff;
    border-color: #d9ecff;
    color: #409eff;
    text-decoration: none;
}
.file-icon {
    font-size: 14px;
    flex-shrink: 0;
}
.file-name {
    flex: 1;
    word-break: break-all;
}
/* 图片缩略图小图 */
.file-item.img-item .file-thumb {
    width: 32px;
    height: 32px;
    object-fit: cover;
    border-radius: 2px;
    flex-shrink: 0;
}
/* 纯文本内容（非文件字段） */
.text-content {
    font-size: 12px;
    color: #606266;
    line-height: 1.5;
    word-break: break-all;
    padding: 4px 6px;
    background: #fff;
    border-radius: 3px;
    border: 1px solid #f0f0f0;
}

/* ========== 响应式断点（按从大到小顺序，避免覆盖混乱） ========== */
@media (max-width: 992px) {
    .card-list {
        grid-template-columns: 1fr;
    }
    .inner-search {
        width: 180px;
    }
}

@media (max-width: 768px) {
    body {
        padding: 6px 0;
    }
    .container {
        padding-left: 10px;
        padding-right: 10px;
    }
    .card {
        padding: 12px;
        margin-bottom: 10px;
    }
    .page-header h3 {
        font-size: 17px;
    }
    .btn-group-wrap {
        flex-wrap: wrap;
    }
    .btn-group-wrap .btn {
        flex: 1;
        min-width: auto;
    }
    /* 结果头部适配 */
    .result-header {
        flex-direction: column;
        align-items: stretch;
    }
    .result-tools {
        justify-content: space-between;
    }
    .inner-search {
        width: 100%;
        flex: 1;
    }
    /* 卡片适配 */
    .device-card {
        padding: 10px 12px;
    }
    .card-title {
        font-size: 14px;
    }
    .file-item {
        font-size: 12px;
    }
    /* 表格兼容适配 */
    #device-table {
        font-size: 12px;
    }
    #device-table thead th,
    #device-table tbody td {
        padding: 5px 6px;
    }
    .media-thumb.img-thumb img {
        max-width: 50px;
        max-height: 38px;
    }
    .media-thumb.video-thumb {
        width: 50px;
        height: 38px;
        font-size: 16px;
    }
}

/* 联想列表通用样式：所有输入框的下拉列表统一生效 */
.input-wrap {
    position: relative;
}

.suggestion-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 9999;
    list-style: none;
    margin: 4px 0 0 0;
    padding: 0;
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    max-height: 220px;
    overflow-y: auto;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: none;
}

.suggestion-list li {
    padding: 6px 12px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
}

.suggestion-list li:hover {
    background-color: #f0f7ff;
    color: #0d6efd;
}



/* ========== v2 新增：卡片操作栏 ========== */
.card-actions {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px dashed #ebeef5;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}
.card-actions .btn {
    padding: 3px 12px;
    font-size: 12px;
    min-width: auto;
}
.card-actions .btn-del {
    color: #f56c6c;
    border-color: #fbc4c4;
    background: #fff;
}
.card-actions .btn-del:hover {
    background: #fef0f0;
    border-color: #f56c6c;
}

/* ========== 编辑弹窗适配 ========== */
#editDeviceModal .modal-content {
    padding: 20px 24px;
    position: relative;
}
#editDeviceModal .modal-close {
    position: absolute;
    top: 8px;
    right: 12px;
    background: rgba(0,0,0,0.5);
    color: #fff;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    z-index: 10;
}


/* 文件删除按钮 */
.file-item { position: relative; padding-right: 50px; }
.file-del-btn {
    position: absolute; right: 8px; top: 50%;
    transform: translateY(-50%);
    font-size: 12px; color: #f56c6c;
    cursor: pointer; user-select: none;
}
.file-del-btn:hover { color: #e64545; text-decoration: underline; }

.file-del-btn:hover {
    background: #e64545;
}
