/* 场景库对话框样式 */
.scene-library-dialog {
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15) !important;
  background: #ffffff;
}

.scene-library-dialog .el-dialog {
  margin: 0 auto !important;
  z-index: 2000;
  border-radius: 12px;
  overflow: hidden;
  background: #ffffff;
}

.scene-library-dialog .el-dialog__header {
  padding: 0;
  border-bottom: none;
  margin: 0;
  position: relative;
}

/* 场景库底部按钮样式 - 无圆角 */
.scene-library-footer {
  display: flex;
  justify-content: flex-end;
  gap: 16px;
  padding: 16px 24px;
  border-top: 1px solid #e8e8e8;
  background: #fafbfc;
}

.scene-lib-btn {
  height: 44px;
  border-radius: 0 !important;
  font-size: 15px;
  font-weight: 600;
  padding: 0 36px;
  transition: all 0.25s ease;
  border: none;
}

.scene-lib-btn-cancel {
  border: 2px solid #d0d7de !important;
  color: #5a6c7d;
  background: #fff;
}

.scene-lib-btn-cancel:hover {
  border-color: #b0b8c4 !important;
  color: #4a5568;
  background: #f8f9fa;
  transform: none;
}

.scene-lib-btn-primary {
  background: linear-gradient(135deg, #c8a46e 0%, #a67c52 100%);
  color: #fff;
  box-shadow: 0 4px 16px rgba(166, 124, 82, 0.35);
  min-width: 120px;
}

.scene-lib-btn-primary:hover {
  background: linear-gradient(135deg, #b89460 0%, #966d48 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(166, 124, 82, 0.4);
}

.scene-lib-btn-primary:active {
  background: linear-gradient(135deg, #a88858 0%, #886048 100%);
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(166, 124, 82, 0.3);
}

/* 自定义标题栏 */
.scene-library-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: #2c3e50;
}

.scene-library-header-title {
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.5px;
}

.scene-library-header-btn {
  width: 32px;
  height: 32px;
  border-radius: 0;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.8);
  font-size: 18px;
  transition: all 0.25s ease;
}

.scene-library-header-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.scene-library-header-btn:active {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(0.95);
}

.scene-library-dialog .el-dialog__body {
  padding: 20px 24px 0px;
  max-height: 70vh;
  overflow-y: visible;
  /* 确保滚动条初始位置在顶部 */
  scroll-behavior: auto;
  background: #ffffff;
}

/* 重置滚动位置到顶部 */
.scene-library-dialog .el-dialog__body {
  scroll-margin-top: 0;
}

.scene-library-content {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  overflow: hidden;
}

/* 场景库 Tab 切换样式 - 胶囊按钮样式 */
.scene-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
  padding: 4px;
  background: #f0f2f5;
  border-radius: 0;
  width: fit-content;
}

.scene-tab-item {
  padding: 8px 24px;
  font-size: 14px;
  color: #5a6c7d;
  cursor: pointer;
  border-radius: 0;
  transition: all 0.25s ease;
  user-select: none;
  font-weight: 500;
}

.scene-tab-item:hover {
  border-color: #2ea0e6;
  background: #f0f7ff;
  color: #2ea0e6;
}

.scene-tab-item.active {
  border-color: #2ea0e6;
  background: linear-gradient(135deg, #e8f5fd 0%, #d5eefa 100%);
  color: #1a7cc8;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(46, 160, 230, 0.15);
}

/* 工具栏：分类筛选 + 右上角分页 */
.scene-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e8e8e8;
}

/* 分类筛选样式 - 胶囊按钮样式 */
.scene-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1;
}

.category-item {
  padding: 6px 16px;
  background: #fafbfc;
  border: 1.5px solid #e2e8f0;
  border-radius: 0;
  font-size: 13px;
  color: #5a6c7d;
  cursor: pointer;
  transition: all 0.25s ease;
  user-select: none;
  font-weight: 500;
}

.category-item:hover {
  border-color: #2ea0e6;
  background: #f0f7ff;
  color: #2ea0e6;
}

.category-item.active {
  background: linear-gradient(135deg, #2ea0e6 0%, #1a7cc8 100%);
  border-color: #2ea0e6;
  color: #fff;
  box-shadow: 0 2px 8px rgba(46, 160, 230, 0.25);
}

/* 右上角分页样式 */
.scene-pagination-right {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.scene-pagination-right .el-pagination {
  font-weight: normal;
  padding: 0;
}

.scene-pagination-right .el-pagination .el-pagination__total {
  margin-right: 8px;
  font-size: 12px;
  color: #5a6c7d;
}

.scene-pagination-right .el-pagination .el-pagination__sizes {
  margin: 0 4px 0 0;
}

.scene-pagination-right .el-pagination .el-pagination__sizes .el-input__inner {
  height: 28px;
  font-size: 12px;
  border-radius: 0;
}

.scene-pagination-right .el-pagination .btn-prev,
.scene-pagination-right .el-pagination .btn-next {
  padding: 0 6px;
  border-radius: 0;
}

.scene-pagination-right .el-pagination .el-pager li {
  min-width: 28px;
  height: 28px;
  line-height: 28px;
  font-size: 12px;
  border-radius: 0;
  margin: 0 2px;
}

.scene-pagination-right .el-pagination .el-pager li:hover {
  color: #2ea0e6;
}

.scene-pagination-right .el-pagination .el-pager li.active {
  background: linear-gradient(135deg, #2ea0e6 0%, #1a7cc8 100%);
  color: #fff;
}

/* 场景网格布局 - 自适应高度响应式设计 */
.scene-grid {
  display: grid;
  /* 默认 5 列布局 */
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 16px;
  /* 默认高度：基于视口计算，约显示 2.5 行 */
  height: calc(196px * 2.5);
  min-height: calc(196px * 2.5);
  max-height: calc(196px * 2.5);
  overflow-y: auto;
  overflow-x: hidden;
  flex: 0 0 auto;
  /* 美化滚动条 */
  scrollbar-width: thin;
  scrollbar-color: #c8d0da #f0f2f5;
}

.scene-grid::-webkit-scrollbar {
  width: 6px;
}

.scene-grid::-webkit-scrollbar-track {
  background: #f0f2f5;
  border-radius: 3px;
}

.scene-grid::-webkit-scrollbar-thumb {
  background: #c8d0da;
  border-radius: 3px;
}

.scene-grid::-webkit-scrollbar-thumb:hover {
  background: #a0aeb8;
}



/* 场景项 */
/* --------------------- 公共场景库和个人场景库共用以下样式 --------------------- */
.scene-item--personal {
  height: 195px;
}

.scene-image--personal {
  height: 135px;
}

.scene-info {
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  background: #fff;
  border-top: 1px solid #f0f2f5;
  width: 100%;
  box-sizing: border-box;
  gap: 4px;
}

.scene-name--personal {
  font-size: 12px;
  color: #333333;
  font-weight: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
  margin-right: 0 !important;
}

.scene-area--personal {
  font-size: 12px;
  color: #5a6c7d;
  white-space: nowrap;
  margin-right: 0 !important;
}

.scene-personal-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
}

/* --------------------- 原有共享样式保留 --------------------- */
.scene-item {
  background: #fff;
  border: 1px solid #e8ecf0;
  border-radius: 0;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.scene-item:hover {
  box-shadow: 0 10px 24px rgba(46, 160, 230, 0.15);
  transform: translateY(0px);
  border-color: #2ea0e6;
}

.scene-image {
  width: 100%;
  overflow: hidden;
  background: #f0f4f8;
  position: relative;
}

.scene-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.scene-item:hover .scene-image img {
  transform: scale(1.08);
}

/* 右上角删除按钮 */
.scene-delete-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(220, 38, 38, 0.85);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease, background 0.2s ease, transform 0.15s ease;
  z-index: 3;
}

.scene-delete-btn i {
  font-size: 14px;
  color: #fff;
  line-height: 1;
}

.scene-item:hover .scene-delete-btn {
  opacity: 1;
}

.scene-delete-btn:hover {
  background: rgba(185, 28, 28, 1);
  transform: scale(1.1);
}

.scene-delete-btn:active {
  transform: scale(0.95);
}

@media (min-width: 1280px) and (max-width: 1440px) {
  .scene-delete-btn {
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
  }
  .scene-delete-btn i {
    font-size: 12px;
  }
}

@media (max-width: 768px) {
  .scene-delete-btn {
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
  }
  .scene-delete-btn i {
    font-size: 12px;
  }
}

/* 右上角信息图标样式 */
.scene-info-icon {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 14px;
  color: #fff;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 0;
  width: 24px;
  height: 24px;
  line-height: 24px;
  text-align: center;
  cursor: pointer;
  opacity: 0;
  transition: all 0.25s ease;
  z-index: 2;
}

.scene-item:hover .scene-info-icon {
  opacity: 1;
}

.scene-info-icon:hover {
  background: rgba(46, 160, 230, 0.85);
  transform: scale(1.1);
}

@media (min-width: 1280px) and (max-width: 1440px) {
  .scene-info-icon {
    top: 4px;
    left: 4px;
    font-size: 14px;
    width: 20px;
    height: 20px;
    line-height: 20px;
  }
}

@media (max-width: 768px) {
  .scene-info-icon {
    top: 4px;
    left: 4px;
    font-size: 14px;
    width: 20px;
    height: 20px;
    line-height: 20px;
  }
  .scene-delete-btn {
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
  }
  .scene-delete-btn i {
    font-size: 12px;
  }
}

.scene-name {
  font-size: 12px;
  color: #333333;
  font-weight: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-right: 8px;
  flex: 1 1 auto;
  min-width: 0;
}

.scene-area {
  font-size: 12px;
  color: #333333;
  font-weight: normal;
  white-space: nowrap;
  margin-right: 8px;
  flex: 0 0 auto;
}

/* 个人场景库可见性下拉框 */
.scene-visibility-select {
  width: auto;
  min-width: 60px;
  height: 24px;
  font-size: 12px;
  border: 1px solid #dcdfe6;
  border-radius: 0;
  padding: 0 4px;
  background: #fff;
  cursor: pointer;
  outline: none;
  color: #5a6c7d;
}

.scene-visibility-select:focus {
  border-color: #409eff;
}

.scene-favorite {
  font-size: 18px;
  color: #d0d7de;
  cursor: pointer;
  transition: all 0.25s ease;
  flex-shrink: 0;
}

.scene-favorite:hover {
  color: #faad14;
  transform: scale(1.15);
}

.scene-favorite.active {
  color: #faad14;
}

/* 空状态 */
.scene-empty {
  text-align: center;
  padding: 60px 0;
  color: #8c8c8c;
}

.scene-empty i {
  font-size: 64px;
  color: #d9d9d9;
  margin-bottom: 16px;
}

.scene-empty p {
  font-size: 14px;
  margin: 0;
}

/* 响应式调整 - 大屏幕（>1600px） */
@media (max-width: 1600px) {
  .scene-grid {
    grid-template-columns: repeat(4, 1fr);
    height: calc(195px * 2.5);
    min-height: calc(195px * 2.5);
    max-height: calc(195px * 2.5);
    overflow-y: auto;
    overflow-x: hidden;
    flex: 0 0 auto;
  }
}

/* 响应式调整 - 中等屏幕（1200px-1600px） */
@media (max-width: 1200px) {
  .scene-grid {
    grid-template-columns: repeat(3, 1fr);
    height: calc(195px * 2.5);
    min-height: calc(195px * 2.5);
    max-height: calc(195px * 2.5);
    overflow-y: auto;
    overflow-x: hidden;
    flex: 0 0 auto;
  }
}

/* 响应式调整 - 小屏幕（≤1366px 或 ≤768px 高度） */
@media (max-width: 1366px), (max-height: 768px) {
  .scene-grid {
    grid-template-columns: repeat(3, 1fr);
    height: calc(195px * 2.5);
    min-height: calc(195px * 2.5);
    max-height: calc(195px * 2.5);
    overflow-y: auto;
    overflow-x: hidden;
    flex: 0 0 auto;
  }

  .scene-item--personal {
    height: 175px;
  }

  .scene-image--personal {
    height: 105px;
  }

  .scene-library-dialog .el-dialog__body {
    overflow-y: auto;
  }

  .scene-library-content {
    overflow: hidden;
  }
}

/* 超小屏幕（≤768px） */
@media (max-width: 768px) {
  .scene-library-dialog {
    width: 95% !important;
  }

  .scene-toolbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .scene-pagination-right {
    width: 100%;
    justify-content: flex-start;
  }

  .scene-grid {
    grid-template-columns: repeat(2, 1fr);
    height: calc(180px * 2.5);
    min-height: calc(180px * 2.5);
    max-height: calc(180px * 2.5);
    gap: 12px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 0 0 auto;
  }

  .scene-item--personal {
    height: 170px;
  }

  .scene-image--personal {
    height: 95px;
  }

  .scene-categories {
    gap: 8px;
  }

  .scene-tabs {
    gap: 0;
  }

  .scene-tab-item {
    padding: 6px 16px;
    font-size: 14px;
  }

  .category-item {
    padding: 4px 12px;
    font-size: 13px;
  }

  .scene-name {
    font-size: 12px;
  }

  .scene-pagination-right .el-pagination .el-pagination__total {
    display: none;
  }

  .scene-pagination-right .el-pagination .el-pager li {
    min-width: 20px;
    height: 20px;
    line-height: 20px;
    font-size: 11px;
  }
}

/* 1366×768 分辨率区间适配 - 保持 2.5 行 */
@media (min-width: 1280px) and (max-width: 1440px) {
  .scene-library-dialog .el-dialog {
    max-height: 68vh;
    z-index: 2000;
  }

  #undo-menu-item {
    right: -2.5rem;
  }

  #redo-menu-item {
    right: 5.5rem;
  }

  .el-menu--horizontal > .el-submenu:nth-last-child(2) {
    right: 11.5rem;
  }

  .scene-library-dialog .el-dialog__header {
    padding: 0;
  }

  .scene-library-dialog .el-dialog__body {
    padding: 16px 20px;
    max-height: 60vh;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
  }

  .scene-library-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
  }

  .scene-grid {
    /* 移除 flex: 1，改为固定高度 */
    flex: 0 0 auto;
    height: calc(195px * 2.5);
    min-height: calc(195px * 2.5);
    max-height: calc(195px * 2.5);
    gap: 12px;
    margin-bottom: 0;
    overflow-y: auto;
    overflow-x: hidden;
  }

  .scene-item--personal {
    height: 170px;
  }

  .scene-image--personal {
    height: 100px;
  }

  .scene-info {
    padding: 8px 10px;
  }

  .scene-name {
    font-size: 12px;
  }

  .scene-categories {
    flex-shrink: 0;
    margin-bottom: 0;
    padding-bottom: 0;
    gap: 6px;
  }

  .category-item {
    padding: 4px 12px;
    font-size: 12px;
  }

  .scene-tab-item {
    padding: 6px 18px;
    font-size: 13px;
  }

  .scene-toolbar {
    margin-bottom: 12px;
    padding-bottom: 10px;
  }

  .scene-tabs {
    margin-bottom: 12px;
  }

  .scene-pagination-right .el-pagination {
    font-size: 12px;
  }

  .scene-pagination-right .el-pagination .el-pagination__total {
    margin-right: 4px;
    font-size: 11px;
  }

  .scene-pagination-right .el-pagination .el-pagination__sizes .el-input__inner {
    height: 26px;
    font-size: 11px;
  }

  .scene-pagination-right .el-pagination .el-pager li {
    min-width: 26px;
    height: 26px;
    line-height: 26px;
    font-size: 11px;
  }

  .scene-pagination-bottom {
    flex-shrink: 0;
    padding: 6px 0 0 0;
    margin-top: auto;
  }

  .scene-pagination-bottom .el-pagination {
    font-size: 12px;
  }
}

/* 超低分辨率（高度 ≤720px）适配 - 保持 2.5 行但压缩尺寸 */
@media (max-height: 720px) {
  .scene-grid {
    height: calc(140px * 2.5);
    min-height: calc(140px * 2.5);
    max-height: calc(140px * 2.5);
    flex: 0 0 auto;
  }

  .scene-item--personal {
    height: 130px;
  }

  .scene-image--personal {
    height: 75px;
  }

  .scene-info {
    padding: 6px 8px;
  }

  .scene-tabs {
    padding: 2px;
  }

  .scene-tab-item {
    padding: 5px 14px;
    font-size: 13px;
  }

  .category-item {
    padding: 3px 10px;
    font-size: 12px;
  }

  .scene-toolbar {
    margin-bottom: 10px;
    padding-bottom: 8px;
  }

  .scene-library-dialog .el-dialog__body {
    padding: 12px 16px;
  }
}

/* 右键菜单 */
.scene-context-menu {
  position: fixed;
  background: #fff;
  border: 1px solid #e4e7ed;
  border-radius: 4px;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  z-index: 9999;
  padding: 4px 0;
}

.context-menu-item {
  padding: 8px 16px;
  font-size: 12px;
  color: #606266;
  cursor: pointer;
  white-space: nowrap;
  outline: none;
  user-select: none;
  caret-color: transparent;
}

.context-menu-item:hover {
  background: #ecf5ff;
  color: #409eff;
}

/* 修改场景信息对话框 */
.modify-scene-dialog .el-dialog__header {
  background: #f5f7fa;
  border-bottom: 1px solid #e4e7ed;
}

.modify-scene-dialog .el-dialog__title {
  font-size: 14px;
  font-weight: 600;
}

.modify-scene-dialog .el-dialog__body {
  padding: 20px;
}

.modify-scene-dialog .el-form-item {
  margin-bottom: 18px;
}

.modify-scene-dialog .el-form-item__label {
  font-size: 13px;
}

.modify-scene-dialog .el-dialog__footer {
  border-top: 1px solid #e4e7ed;
  padding: 12px 20px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* 修改场景信息对话框 - 统一按钮样式（与场景库一致） */
.modify-scene-dialog .dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.modify-scene-dialog .dialog-footer .el-button {
  height: 36px;
  border-radius: 0;
  font-size: 14px;
  font-weight: 600;
  padding: 0 24px;
  transition: all 0.25s ease;
  border: none;
}

.modify-scene-dialog .dialog-footer .el-button--default {
  border: 1px solid #e2e8f0 !important;
  color: #5a6c7d;
  background: #fafbfc;
}

.modify-scene-dialog .dialog-footer .el-button--default:hover {
  border: 1px solid #2ea0e6 !important;
  color: #2ea0e6;
  background: rgba(46, 160, 230, 0.06);
  transform: none;
}

.modify-scene-dialog .dialog-footer .el-button--default:active {
  border: 1px solid #1a7cc8 !important;
  color: #1a7cc8;
  background: rgba(46, 160, 230, 0.12);
  transform: none;
}

.modify-scene-dialog .dialog-footer .el-button--primary {
  background: linear-gradient(135deg, #d5eefa 0%, #b8d9f5 100%);
  color: #1a7cc8;
  box-shadow: 0 4px 16px rgba(46, 160, 230, 0.35);
  min-width: 90px;
  border: 2px solid #2ea0e6;
}

.modify-scene-dialog .dialog-footer .el-button--primary:hover {
  background: linear-gradient(135deg, #c2e2f8 0%, #a8d4f5 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(46, 160, 230, 0.4);
  border-color: #1a7cc8;
}

.modify-scene-dialog .dialog-footer .el-button--primary:active {
  background: linear-gradient(135deg, #a8d4f5 0%, #8ac4ef 100%);
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(46, 160, 230, 0.3);
  border-color: #1a5fa8;
}

.el-input-group__append
{
  height: 29px;
}

/* 墙面/地面贴图删除菜单 */
.tex-delete-menu {
  position: fixed;
  background: #fff;
  border: 1px solid #e4e7ed;
  border-radius: 4px;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  z-index: 9999;
/*  padding: 4px 0;*/
  min-width: 80px;
  caret-color: transparent;
}

.tex-delete-menu .context-menu-item {
  padding: 6px 16px;
  font-size: 13px;
  cursor: pointer;
  transition: background-color 0.15s;
  outline: none;
  user-select: none;
  caret-color: transparent;
}

.context-menu-item--danger {
  color: #f56c6c;
}

.context-menu-item--danger:hover {
  background: #fef0f0;
  color: #f56c6c;
}
