/* Element Plus 深色模式样式 - 高优先级版 */

/* 基础深色变量 - 使用 :root 和 html.dark 双重定义确保生效 */
:root {
  /* 浅色模式默认值 */
  --amj-bg-color: #ffffff;
  --amj-text-color: #303133;
  --amj-border-color: #dcdfe6;
  --amj-card-bg: #ffffff;
  --amj-header-bg: #ffffff;
  --amj-hover-bg: #f5f7fa;
  --amj-sidebar-bg: #ffffff;
}

/* 深色模式变量 */
html.dark,
html.dark body {
  /* Element Plus 官方深色变量 */
  --el-color-white: #1a1a2e !important;
  --el-color-black: #ffffff !important;
  --el-color-primary: #409eff !important;
  --el-color-primary-light-3: #3375b9 !important;
  --el-color-primary-light-5: #2a598a !important;
  --el-color-primary-light-7: #213d5b !important;
  --el-color-primary-light-8: #1d3043 !important;
  --el-color-primary-light-9: #18222c !important;
  --el-color-primary-dark-2: #66b1ff !important;
  --el-color-success: #67c23a !important;
  --el-color-success-light-3: #4e8e2f !important;
  --el-color-success-light-5: #3e6b27 !important;
  --el-color-success-light-7: #2d481f !important;
  --el-color-success-light-8: #25371c !important;
  --el-color-success-light-9: #1c2518 !important;
  --el-color-success-dark-2: #85ce61 !important;
  --el-color-warning: #e6a23c !important;
  --el-color-warning-light-3: #a77730 !important;
  --el-color-warning-light-5: #7d5b28 !important;
  --el-color-warning-light-7: #533f20 !important;
  --el-color-warning-light-8: #3e301c !important;
  --el-color-warning-light-9: #292218 !important;
  --el-color-warning-dark-2: #ebb563 !important;
  --el-color-danger: #f56c6c !important;
  --el-color-danger-light-3: #b25252 !important;
  --el-color-danger-light-5: #854040 !important;
  --el-color-danger-light-7: #582e2e !important;
  --el-color-danger-light-8: #412626 !important;
  --el-color-danger-light-9: #2b1d1d !important;
  --el-color-danger-dark-2: #f78989 !important;
  --el-color-error: #f56c6c !important;
  --el-color-error-light-3: #b25252 !important;
  --el-color-error-light-5: #854040 !important;
  --el-color-error-light-7: #582e2e !important;
  --el-color-error-light-8: #412626 !important;
  --el-color-error-light-9: #2b1d1d !important;
  --el-color-error-dark-2: #f78989 !important;
  --el-color-info: #909399 !important;
  --el-color-info-light-3: #6b6d71 !important;
  --el-color-info-light-5: #525457 !important;
  --el-color-info-light-7: #393a3c !important;
  --el-color-info-light-8: #2d2d2f !important;
  --el-color-info-light-9: #202121 !important;
  --el-color-info-dark-2: #a6a9ad !important;
  
  /* 背景色 */
  --el-bg-color: #1a1a2e !important;
  --el-bg-color-page: #141426 !important;
  --el-bg-color-overlay: #16213e !important;
  
  /* 文字色 */
  --el-text-color-primary: #e0e0e0 !important;
  --el-text-color-regular: #cfd3dc !important;
  --el-text-color-secondary: #a3a6ad !important;
  --el-text-color-placeholder: #8d9095 !important;
  --el-text-color-disabled: #6c6e72 !important;
  
  /* 边框色 */
  --el-border-color: #4c4d4f !important;
  --el-border-color-light: #414243 !important;
  --el-border-color-lighter: #363637 !important;
  --el-border-color-extra-light: #2b2b2c !important;
  --el-border-color-dark: #58585b !important;
  --el-border-color-darker: #636466 !important;
  
  /* 填充色 */
  --el-fill-color: #262727 !important;
  --el-fill-color-light: #1d1d1f !important;
  --el-fill-color-lighter: #19191a !important;
  --el-fill-color-extra-light: #1c1c1d !important;
  --el-fill-color-dark: #2c2c2e !important;
  --el-fill-color-darker: #363638 !important;
  --el-fill-color-blank: transparent !important;
  
  /* 阴影 */
  --el-box-shadow: 0px 12px 32px 4px rgba(0, 0, 0, 0.36), 0px 8px 20px rgba(0, 0, 0, 0.72) !important;
  --el-box-shadow-light: 0px 0px 12px rgba(0, 0, 0, 0.72) !important;
  --el-box-shadow-lighter: 0px 0px 6px rgba(0, 0, 0, 0.72) !important;
  --el-box-shadow-dark: 0px 16px 48px 16px rgba(0, 0, 0, 0.72), 0px 12px 32px rgba(0, 0, 0, 0.72), 0px 8px 16px -8px rgba(0, 0, 0, 0.72) !important;
  
  /* 禁用状态 */
  --el-disabled-bg-color: #262727 !important;
  --el-disabled-text-color: #6c6e72 !important;
  --el-disabled-border-color: #363637 !important;
  
  /* 覆盖层 */
  --el-overlay-color: rgba(0, 0, 0, 0.8) !important;
  --el-overlay-color-light: rgba(0, 0, 0, 0.7) !important;
  --el-overlay-color-lighter: rgba(0, 0, 0, 0.5) !important;
  
  /* 遮罩 */
  --el-mask-color: rgba(0, 0, 0, 0.9) !important;
  --el-mask-color-extra-light: rgba(0, 0, 0, 0.3) !important;
  
  /* 自定义变量 */
  --amj-bg-color: #1a1a2e !important;
  --amj-text-color: #e0e0e0 !important;
  --amj-border-color: #4c4d4f !important;
  --amj-card-bg: #16213e !important;
  --amj-header-bg: #0f0f23 !important;
  --amj-hover-bg: #1f4068 !important;
  --amj-sidebar-bg: #141426 !important;
}

/* 全局背景 - 强制应用 */
html.dark,
html.dark body,
html.dark #app,
html.dark #amj-vue-app {
  background-color: #1a1a2e !important;
  color: #e0e0e0 !important;
}

/* 应用到插件容器 - 强制覆盖 */
html.dark .amj-app-container,
html.dark .amj-frontend-wrapper,
html.dark .amj-project-workspace,
html.dark .amj-app {
  background-color: #1a1a2e !important;
  color: #e0e0e0 !important;
}

/* ==================== Element Plus 组件深色样式 - 强制覆盖 ==================== */

/* 按钮 - 强制深色 */
html.dark .el-button {
  background-color: #262727 !important;
  border-color: #4c4d4f !important;
  color: #cfd3dc !important;
}

html.dark .el-button:hover,
html.dark .el-button:focus {
  background-color: #363638 !important;
  border-color: #409eff !important;
  color: #409eff !important;
}

html.dark .el-button--primary {
  background-color: #409eff !important;
  border-color: #409eff !important;
  color: #ffffff !important;
}

html.dark .el-button--primary:hover,
html.dark .el-button--primary:focus {
  background-color: #3375b9 !important;
  border-color: #3375b9 !important;
  color: #ffffff !important;
}

html.dark .el-button--success {
  background-color: #67c23a !important;
  border-color: #67c23a !important;
  color: #ffffff !important;
}

html.dark .el-button--warning {
  background-color: #e6a23c !important;
  border-color: #e6a23c !important;
  color: #ffffff !important;
}

html.dark .el-button--danger {
  background-color: #f56c6c !important;
  border-color: #f56c6c !important;
  color: #ffffff !important;
}

/* 卡片 - 强制深色 */
html.dark .el-card {
  background-color: #16213e !important;
  border-color: #414243 !important;
  color: #e0e0e0 !important;
}

html.dark .el-card__header {
  border-bottom-color: #414243 !important;
  color: #e0e0e0 !important;
}

/* 表格 - 强制深色 */
html.dark .el-table {
  background-color: #1a1a2e !important;
  color: #cfd3dc !important;
}

html.dark .el-table__header-wrapper th.el-table__cell {
  background-color: #16213e !important;
  color: #e0e0e0 !important;
  border-bottom-color: #414243 !important;
}

html.dark .el-table__body-wrapper td.el-table__cell {
  background-color: #1a1a2e !important;
  border-bottom-color: #363637 !important;
  color: #cfd3dc !important;
}

html.dark .el-table--striped .el-table__body tr.el-table__row--striped td.el-table__cell {
  background-color: #19191a !important;
}

html.dark .el-table__body tr:hover > td.el-table__cell {
  background-color: #262727 !important;
}

/* 输入框 - 强制深色 */
html.dark .el-input__wrapper {
  background-color: #262727 !important;
  border-color: #4c4d4f !important;
  box-shadow: 0 0 0 1px #4c4d4f inset !important;
}

html.dark .el-input__wrapper:hover {
  box-shadow: 0 0 0 1px #58585b inset !important;
}

html.dark .el-input__wrapper.is-focus {
  box-shadow: 0 0 0 1px #409eff inset !important;
}

html.dark .el-input__inner {
  color: #cfd3dc !important;
  background-color: transparent !important;
}

html.dark .el-input__inner::placeholder {
  color: #8d9095 !important;
}

/* 选择器 - 强制深色 */
html.dark .el-select .el-input__wrapper {
  background-color: #262727 !important;
}

html.dark .el-select-dropdown {
  background-color: #16213e !important;
  border-color: #414243 !important;
  box-shadow: 0px 0px 12px rgba(0, 0, 0, 0.72) !important;
}

html.dark .el-select-dropdown__item {
  color: #cfd3dc !important;
}

html.dark .el-select-dropdown__item:hover,
html.dark .el-select-dropdown__item.hover {
  background-color: #1d1d1f !important;
}

html.dark .el-select-dropdown__item.selected {
  color: #409eff !important;
  background-color: #262727 !important;
}

/* 对话框 - 强制深色 */
html.dark .el-dialog {
  background-color: #1a1a2e !important;
  box-shadow: 0px 12px 32px 4px rgba(0, 0, 0, 0.36), 0px 8px 20px rgba(0, 0, 0, 0.72) !important;
}

html.dark .el-dialog__header {
  border-bottom-color: #414243 !important;
}

html.dark .el-dialog__title {
  color: #e0e0e0 !important;
}

html.dark .el-dialog__headerbtn .el-dialog__close {
  color: #a3a6ad !important;
}

html.dark .el-dialog__headerbtn:hover .el-dialog__close {
  color: #409eff !important;
}

/* 菜单 - 强制深色 */
html.dark .el-menu {
  background-color: #1a1a2e !important;
  border-right-color: #414243 !important;
}

html.dark .el-menu-item {
  color: #cfd3dc !important;
}

html.dark .el-menu-item:hover {
  background-color: #1d1d1f !important;
}

html.dark .el-menu-item.is-active {
  color: #409eff !important;
  background-color: #262727 !important;
}

/* 标签 - 强制深色 */
html.dark .el-tag {
  background-color: #262727 !important;
  border-color: #4c4d4f !important;
  color: #e0e0e0 !important;
}

html.dark .el-tag--primary {
  background-color: #18222c !important;
  border-color: #1d3043 !important;
  color: #409eff !important;
}

html.dark .el-tag--success {
  background-color: #1c2518 !important;
  border-color: #25371c !important;
  color: #67c23a !important;
}

html.dark .el-tag--warning {
  background-color: #292218 !important;
  border-color: #3e301c !important;
  color: #e6a23c !important;
}

html.dark .el-tag--danger {
  background-color: #2b1d1d !important;
  border-color: #412626 !important;
  color: #f56c6c !important;
}

/* 分页 - 强制深色 */
html.dark .el-pagination {
  color: #cfd3dc !important;
}

html.dark .el-pagination .btn-prev,
html.dark .el-pagination .btn-next {
  background-color: transparent !important;
  color: #e0e0e0 !important;
}

html.dark .el-pagination .btn-prev:hover,
html.dark .el-pagination .btn-next:hover {
  color: #409eff !important;
}

html.dark .el-pager li {
  background-color: transparent !important;
  color: #e0e0e0 !important;
}

html.dark .el-pager li:hover {
  color: #409eff !important;
}

html.dark .el-pager li.is-active {
  background-color: #409eff !important;
  color: #ffffff !important;
}

/* 折叠面板 - 强制深色 */
html.dark .el-collapse {
  border-top-color: #414243 !important;
  border-bottom-color: #414243 !important;
}

html.dark .el-collapse-item__header {
  background-color: #1a1a2e !important;
  color: #e0e0e0 !important;
  border-bottom-color: #414243 !important;
}

html.dark .el-collapse-item__wrap {
  background-color: #1a1a2e !important;
  border-bottom-color: #414243 !important;
}

html.dark .el-collapse-item__content {
  color: #cfd3dc !important;
}

/* 描述列表 - 强制深色 */
html.dark .el-descriptions__title {
  color: #e0e0e0 !important;
}

html.dark .el-descriptions__label {
  background-color: #262727 !important;
  color: #cfd3dc !important;
}

html.dark .el-descriptions__content {
  background-color: transparent !important;
  color: #e0e0e0 !important;
}

html.dark .el-descriptions__cell {
  border-color: #414243 !important;
}

/* 时间线 - 强制深色 */
html.dark .el-timeline-item__node {
  background-color: #4c4d4f !important;
}

html.dark .el-timeline-item__tail {
  border-left-color: #414243 !important;
}

html.dark .el-timeline-item__content {
  color: #cfd3dc !important;
}

html.dark .el-timeline-item__timestamp {
  color: #a3a6ad !important;
}

/* 步骤条 - 强制深色 */
html.dark .el-step__title {
  color: #cfd3dc !important;
}

html.dark .el-step__title.is-process {
  color: #e0e0e0 !important;
}

html.dark .el-step__title.is-success {
  color: #67c23a !important;
}

html.dark .el-step__description {
  color: #a3a6ad !important;
}

html.dark .el-step__line {
  background-color: #414243 !important;
}

/* 进度条 - 强制深色 */
html.dark .el-progress-bar__outer {
  background-color: #262727 !important;
}

html.dark .el-progress__text {
  color: #cfd3dc !important;
}

/* 下拉菜单 - 强制深色 */
html.dark .el-dropdown-menu {
  background-color: #16213e !important;
  border-color: #414243 !important;
  box-shadow: 0px 0px 12px rgba(0, 0, 0, 0.72) !important;
}

html.dark .el-dropdown-menu__item {
  color: #cfd3dc !important;
}

html.dark .el-dropdown-menu__item:hover {
  background-color: #1d1d1f !important;
  color: #409eff !important;
}

/* 消息提示 - 强制深色 */
html.dark .el-message {
  background-color: #16213e !important;
  border-color: #414243 !important;
  box-shadow: 0px 0px 12px rgba(0, 0, 0, 0.72) !important;
}

html.dark .el-message__content {
  color: #cfd3dc !important;
}

/* 通知 - 强制深色 */
html.dark .el-notification {
  background-color: #16213e !important;
  border-color: #414243 !important;
  box-shadow: 0px 0px 12px rgba(0, 0, 0, 0.72) !important;
}

html.dark .el-notification__title {
  color: #e0e0e0 !important;
}

html.dark .el-notification__content {
  color: #cfd3dc !important;
}

/* 空状态 - 强制深色 */
html.dark .el-empty__description {
  color: #a3a6ad !important;
}

/* 加载动画 - 强制深色 */
html.dark .el-loading-mask {
  background-color: rgba(0, 0, 0, 0.9) !important;
}

html.dark .el-loading-spinner .circular {
  stroke: #409eff !important;
}

html.dark .el-loading-spinner .el-loading-text {
  color: #409eff !important;
}

/* 复选框 - 强制深色 */
html.dark .el-checkbox {
  color: #cfd3dc !important;
}

html.dark .el-checkbox__input.is-checked + .el-checkbox__label {
  color: #409eff !important;
}

/* 单选框 - 强制深色 */
html.dark .el-radio {
  color: #cfd3dc !important;
}

html.dark .el-radio__input.is-checked + .el-radio__label {
  color: #409eff !important;
}

/* 开关 - 强制深色 */
html.dark .el-switch__label {
  color: #cfd3dc !important;
}

/* 滑块 - 强制深色 */
html.dark .el-slider__runway {
  background-color: #262727 !important;
}

html.dark .el-slider__bar {
  background-color: #409eff !important;
}

/* 上传 - 强制深色 */
html.dark .el-upload-dragger {
  background-color: transparent !important;
  border-color: #4c4d4f !important;
}

html.dark .el-upload-dragger:hover {
  border-color: #409eff !important;
}

/* 标签页 - 强制深色 */
html.dark .el-tabs__item {
  color: #cfd3dc !important;
}

html.dark .el-tabs__item:hover {
  color: #409eff !important;
}

html.dark .el-tabs__item.is-active {
  color: #409eff !important;
}

html.dark .el-tabs__active-bar {
  background-color: #409eff !important;
}

/* 面包屑 - 强制深色 */
html.dark .el-breadcrumb__inner {
  color: #cfd3dc !important;
}

html.dark .el-breadcrumb__inner:hover {
  color: #409eff !important;
}

html.dark .el-breadcrumb__item:last-child .el-breadcrumb__inner {
  color: #e0e0e0 !important;
}

/* 分割线 - 强制深色 */
html.dark .el-divider {
  background-color: #414243 !important;
}

/* 回到顶部 - 强制深色 */
html.dark .el-backtop {
  background-color: #16213e !important;
  color: #409eff !important;
  box-shadow: 0px 0px 12px rgba(0, 0, 0, 0.72) !important;
}

/* 滚动条 - 强制深色 */
html.dark ::-webkit-scrollbar {
  width: 8px !important;
  height: 8px !important;
}

html.dark ::-webkit-scrollbar-track {
  background: #262727 !important;
}

html.dark ::-webkit-scrollbar-thumb {
  background: #4c4d4f !important;
  border-radius: 4px !important;
}

html.dark ::-webkit-scrollbar-thumb:hover {
  background: #58585b !important;
}

/* ==================== 自定义组件样式 - 强制覆盖 ==================== */

/* 头部 - 强制深色 */
html.dark .amj-header {
  background-color: #0f0f23 !important;
  border-bottom-color: #414243 !important;
}

html.dark .amj-header .amj-logo span {
  color: #e0e0e0 !important;
}

/* 侧边栏 - 强制深色 */
html.dark .amj-sidebar {
  background-color: #141426 !important;
  border-right-color: #414243 !important;
}

/* 统计卡片 - 强制深色 */
html.dark .stat-card {
  background-color: #16213e !important;
  border-color: #414243 !important;
}

html.dark .stat-card .stat-value {
  color: #e0e0e0 !important;
}

html.dark .stat-card .stat-label {
  color: #a3a6ad !important;
}

/* 项目卡片 - 强制深色 */
html.dark .project-card {
  background-color: #16213e !important;
  border-color: #414243 !important;
}

html.dark .project-card .project-name {
  color: #e0e0e0 !important;
}

html.dark .project-card .project-desc {
  color: #a3a6ad !important;
}

/* 工作区 - 强制深色 */
html.dark .workspace-view {
  background-color: #141426 !important;
}

html.dark .workspace-header {
  background-color: #0f0f23 !important;
  border-bottom-color: #414243 !important;
}

html.dark .workspace-header .project-title {
  color: #e0e0e0 !important;
}

html.dark .step-sidebar {
  background-color: #141426 !important;
  border-right-color: #414243 !important;
}

html.dark .step-item {
  color: #cfd3dc !important;
}

html.dark .step-item:hover:not(.disabled) {
  background-color: #1d1d1f !important;
}

html.dark .step-item.active {
  background-color: #18222c !important;
  border-left-color: #409eff !important;
}

html.dark .step-item .step-title {
  color: #e0e0e0 !important;
}

html.dark .step-item .step-desc {
  color: #a3a6ad !important;
}

html.dark .content-area {
  background-color: #1a1a2e !important;
}

html.dark .content-header {
  background-color: #1a1a2e !important;
  border-bottom-color: #414243 !important;
}

html.dark .content-header h3 {
  color: #e0e0e0 !important;
}

html.dark .content-header .step-hint {
  color: #a3a6ad !important;
}

html.dark .content-footer {
  background-color: #1a1a2e !important;
  border-top-color: #414243 !important;
}

/* 场景卡片 - 强制深色 */
html.dark .scene-card {
  background-color: #16213e !important;
  border-color: #414243 !important;
}

html.dark .scene-card .scene-title {
  color: #e0e0e0 !important;
}

html.dark .scene-card .scene-description {
  color: #cfd3dc !important;
}

html.dark .scene-card .scene-details {
  color: #a3a6ad !important;
}

/* 图片和视频卡片 - 强制深色 */
html.dark .image-card,
html.dark .video-card {
  background-color: #16213e !important;
  border-color: #414243 !important;
}

html.dark .image-card .image-preview,
html.dark .video-card .video-preview {
  background-color: #262727 !important;
}

html.dark .image-placeholder,
html.dark .video-placeholder {
  color: #a3a6ad !important;
}

/* 角色、地点、道具项 - 强制深色 */
html.dark .character-item,
html.dark .location-item,
html.dark .prop-item {
  background-color: #16213e !important;
}

/* 加载状态 - 强制深色 */
html.dark .amj-loading {
  background-color: #1a1a2e !important;
  color: #cfd3dc !important;
}

/* 通知和提示 - 强制深色 */
html.dark .amj-notice {
  background-color: #16213e !important;
  border-color: #414243 !important;
}

html.dark .amj-notice-info {
  border-left-color: #909399 !important;
}

html.dark .amj-notice-success {
  border-left-color: #67c23a !important;
}

html.dark .amj-notice-warning {
  border-left-color: #e6a23c !important;
}

html.dark .amj-notice-error {
  border-left-color: #f56c6c !important;
}

/* 确保所有文本在深色模式下可见 */
html.dark,
html.dark *,
html.dark *::before,
html.dark *::after {
  color-scheme: dark;
}

/* 修复标题颜色 - 强制浅色 */
html.dark h1,
html.dark h2,
html.dark h3,
html.dark h4,
html.dark h5,
html.dark h6,
html.dark .page-title,
html.dark .card-title,
html.dark .project-name,
html.dark .step-title,
html.dark .content-header h3,
html.dark .el-card__header span,
html.dark .stat-value,
html.dark .el-descriptions__title,
html.dark .el-dialog__title {
  color: #e0e0e0 !important;
}

/* 修复副标题和描述文字 */
html.dark .page-subtitle,
html.dark .step-desc,
html.dark .step-hint,
html.dark .project-desc,
html.dark .el-card__header .subtitle {
  color: #a3a6ad !important;
}

/* 修复可能的白色背景 */
html.dark [class*="el-"],
html.dark [class*="amj-"] {
  background-color: inherit;
}

/* 强制所有主要容器使用深色背景 */
html.dark .el-container,
html.dark .el-main,
html.dark .el-aside,
html.dark .el-header,
html.dark .el-footer {
  background-color: #1a1a2e !important;
}

/* 修复输入框背景 */
html.dark .el-textarea__inner {
  background-color: #262727 !important;
  border-color: #4c4d4f !important;
  color: #cfd3dc !important;
}

/* 修复下拉选择器 */
html.dark .el-popper {
  background-color: #16213e !important;
  border-color: #414243 !important;
}

html.dark .el-popper .el-popper__arrow::before {
  background-color: #16213e !important;
  border-color: #414243 !important;
}
