/* H5 应用区域 */
.apps-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  margin-bottom: 14px;
}

.apps-header h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.apps-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  justify-content: flex-start;
  max-width: calc(100vw - 200px);
}

.apps-tabs::-webkit-scrollbar {
  display: none;
}

.apps-tab {
  padding: 5px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: transparent;
  color: #ffffff;
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition);
}

.apps-tab:hover {
  border-color: var(--border-hover);
  color: var(--text-secondary);
}

.apps-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.app-add {
  border: 2px dashed var(--border);
  background: transparent;
  backdrop-filter: none;
}

.app-add:hover {
  border-color: var(--accent);
  background: var(--accent-glow);
}

/* 添加按钮样式（编辑模式）- 已统一到 style.css */

/* 应用窗口 */
.app-frame-window {
  position: fixed;
  left: 50px;
  top: 50px;
  width: 800px;
  height: 600px;
  max-width: calc(100vw - 100px);
  max-height: calc(100vh - 100px);
  background: transparent !important;
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 200;
}

.app-frame-window.maximized {
  left: 0 !important;
  top: 0 !important;
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  border-radius: 0;
  z-index: 10000 !important;
}

.app-frame-window.minimized {
  display: none;
}

.app-frame-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  cursor: move;
  user-select: none;
  -webkit-user-select: none;
}

.app-frame-header .app-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-frame-header .window-icon {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  object-fit: contain;
  margin-right: 8px;
  flex-shrink: 0;
}

.window-controls {
  display: flex;
  gap: 6px;
  margin-left: 12px;
}

.window-btn {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.window-btn:hover {
  background: var(--bg-glass);
}

.window-btn.minimize-btn:hover {
  color: var(--accent);
}

.window-btn.maximize-btn:hover {
  color: var(--gold);
}

.window-btn.close-btn:hover {
  background: var(--danger);
  color: #fff;
}

.app-frame-body {
  flex: 1;
  overflow: auto;
  background: #fff;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.app-frame-body iframe {
  width: 100%;
  height: 100%;
  border: none;
  touch-action: pan-y pinch-zoom;
}

.iframe-error {
  position: absolute;
  top: 40px;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--bg-secondary);
  z-index: 10;
}

.iframe-error.hidden {
  display: none;
}

.app-frame-body .iframe-error p {
  margin: 0;
  color: var(--text-primary);
  font-size: 16px;
}

.app-frame-body .iframe-error-hint {
  color: var(--text-muted) !important;
  font-size: 13px !important;
}

/* 窗口调整大小 */
.window-resizer {
  position: absolute;
  background: transparent;
  z-index: 10;
}

.window-resizer.resizer-se {
  right: 0;
  bottom: 0;
  width: 16px;
  height: 16px;
  cursor: se-resize;
}

.window-resizer.resizer-s {
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  height: 8px;
  cursor: s-resize;
}

.window-resizer.resizer-e {
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: calc(100% - 32px);
  cursor: e-resize;
}

/* 添加应用弹窗 - 已统一使用 style.css 中的 .form-modal 样式 */

/* 窗口任务栏 */
.window-taskbar {
  position: fixed;
  bottom: 110px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 4px;
  padding: 5px 6px;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.2);
  z-index: 9999;
  max-width: calc(100vw - 40px);
  overflow-x: auto;
}

.window-taskbar.hidden {
  display: none;
}

.taskbar-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  min-width: auto;
}

.taskbar-item:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.15);
}

.taskbar-item.minimized {
  opacity: 0.5;
}

.taskbar-item.minimized:hover {
  opacity: 1;
}

.taskbar-item.active {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
}

.taskbar-item .taskbar-icon {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  object-fit: contain;
  flex-shrink: 0;
}

.taskbar-item .taskbar-icon-initial {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #60a5fa 0%, #a855f7 100%);
  flex-shrink: 0;
}

.taskbar-item .taskbar-icon-ai {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.taskbar-item .taskbar-icon-ai .icon-ai {
  font-size: 14px;
  color: var(--accent);
}

.taskbar-item .taskbar-title {
  font-size: 11px;
  color: var(--text-primary);
  max-width: 60px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.taskbar-item .taskbar-close {
  margin-left: 2px;
  width: 16px;
  height: 16px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  line-height: 1;
  padding: 0;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.taskbar-item .taskbar-close:hover {
  background: rgba(239, 68, 68, 0.8);
  color: #fff;
}
