/* ========================================
   App启动器风格 - 像iOS/Android应用启动器
   ======================================== */

:root {
  --app-primary: #6366F1;
  --app-secondary: #8B5CF6;
  --app-bg: #F8F9FC;
  --app-header-bg: #FFFFFF;
  --app-text: #1F2937;
  --app-text-light: #6B7280;
  --app-border: #E5E7EB;
  --app-shadow: rgba(0, 0, 0, 0.05);
  --app-shadow-lg: rgba(0, 0, 0, 0.1);
}

/* ========================================
   全局样式
   ======================================== */
body.app-launcher-body {
  background: var(--app-bg);
  color: var(--app-text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

.app-launcher-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ========================================
   顶部栏
   ======================================== */
.app-launcher-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: var(--app-header-bg);
  border-bottom: 1px solid var(--app-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 1000;
  box-shadow: 0 1px 3px var(--app-shadow);
}

/* 左侧 */
.app-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.app-back-home {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: transparent;
  border: 1px solid var(--app-border);
  border-radius: 8px;
  color: var(--app-text);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.app-back-home:hover {
  background: var(--app-bg);
  border-color: var(--app-primary);
  color: var(--app-primary);
}

.app-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-logo-icon {
  font-size: 28px;
}

.app-logo-text {
  font-size: 18px;
  font-weight: 700;
  color: var(--app-text);
}

/* 中央搜索 */
.app-global-search {
  flex: 1;
  max-width: 500px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--app-bg);
  border: 1px solid var(--app-border);
  border-radius: 10px;
  padding: 0 16px;
  height: 40px;
  transition: all 0.2s ease;
}

.app-global-search:focus-within {
  border-color: var(--app-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.app-global-search i {
  color: var(--app-text-light);
  font-size: 16px;
}

.app-global-search input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--app-text);
  font-size: 14px;
}

.app-global-search input::placeholder {
  color: var(--app-text-light);
}

.app-global-search kbd {
  font-size: 11px;
  padding: 4px 8px;
  background: white;
  border: 1px solid var(--app-border);
  border-radius: 4px;
  color: var(--app-text-light);
  font-family: monospace;
}

/* 右侧 */
.app-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-header-icon {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: var(--app-text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.app-header-icon:hover {
  background: var(--app-bg);
}

.app-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  min-width: 18px;
  height: 18px;
  background: #EF4444;
  color: white;
  font-size: 11px;
  font-weight: 600;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

/* 用户下拉 */
.app-user-dropdown {
  position: relative;
}

.app-user-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 6px;
  background: transparent;
  border: 1px solid var(--app-border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.app-user-trigger:hover {
  background: var(--app-bg);
  border-color: var(--app-primary);
}

.app-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: cover;
}

.app-user-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--app-text);
}

.app-user-trigger i {
  font-size: 12px;
  color: var(--app-text-light);
}

.app-user-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 250px;
  background: white;
  border: 1px solid var(--app-border);
  border-radius: 12px;
  padding: 8px;
  display: none;
  box-shadow: 0 4px 12px var(--app-shadow-lg);
  z-index: 100;
}

/* 点击后显示菜单 */
.app-user-dropdown.active .app-user-menu {
  display: block;
  animation: fadeInDown 0.2s ease;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.app-user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--app-border);
  margin-bottom: 4px;
}

.app-user-info img {
  width: 48px;
  height: 48px;
  border-radius: 10px;
}

.app-user-info strong {
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: var(--app-text);
  margin-bottom: 4px;
}

.app-user-info small {
  display: block;
  font-size: 12px;
  color: var(--app-text-light);
}

.app-user-menu a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--app-text);
  font-size: 14px;
  transition: all 0.2s ease;
  text-decoration: none;
}

.app-user-menu a:hover {
  background: var(--app-bg);
}

.app-user-menu a i {
  width: 16px;
  text-align: center;
  font-size: 14px;
}

.app-menu-divider {
  height: 1px;
  background: var(--app-border);
  margin: 8px 0;
}

.app-menu-danger {
  color: #EF4444 !important;
}

.app-menu-danger:hover {
  background: rgba(239, 68, 68, 0.1) !important;
}

/* ========================================
   App启动器主界面
   ======================================== */
.app-launcher-main {
  margin-top: 64px;
  padding: 60px 40px;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

/* 欢迎区域 */
.app-welcome {
  text-align: center;
  margin-bottom: 60px;
}

.app-welcome h1 {
  font-size: 36px;
  font-weight: 700;
  color: var(--app-text);
  margin: 0 0 12px 0;
}

.app-welcome p {
  font-size: 16px;
  color: var(--app-text-light);
  margin: 0;
}

/* ========================================
   App分页容器 - 可左右滑动
   ======================================== */
.app-pages-container {
  position: relative;
  width: 100%;
  margin-bottom: 60px;
  overflow: hidden;
}

.app-pages-wrapper {
  display: flex;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  width: 100%;
}

.app-page {
  min-width: 100%;
  flex-shrink: 0;
  padding: 0 20px;
}

.app-page-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--app-text);
  margin: 0 0 24px 0;
  padding: 12px 20px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px var(--app-shadow);
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-page-title i {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--app-primary), var(--app-secondary));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 16px;
}

/* App网格 */
.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 32px;
}

/* 分页导航按钮 */
.app-page-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 128px;
  height: 128px;
  background: white;
  border: 4px solid var(--app-border);
  border-radius: 50%;
  color: var(--app-text);
  font-size: 48px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: all 0.3s ease;
  box-shadow: 0 16px 48px var(--app-shadow-lg);
}

.app-page-nav:hover {
  background: var(--app-primary);
  color: white;
  border-color: var(--app-primary);
  transform: translateY(-50%) scale(1.15);
  box-shadow: 0 24px 64px rgba(99, 102, 241, 0.3);
}

.app-page-nav:disabled {
  opacity: 0.2;
  cursor: not-allowed;
  pointer-events: none;
}

.app-page-prev {
  left: -160px;
}

.app-page-next {
  right: -160px;
}

/* 分页指示器 */
.app-page-dots {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 80px;
}

.app-page-dot {
  width: 20px;
  height: 20px;
  background: var(--app-border);
  border-radius: 10px;
  transition: all 0.3s ease;
  cursor: pointer;
}

.app-page-dot.active {
  background: var(--app-primary);
  width: 64px;
}

.app-page-dot:hover {
  background: var(--app-primary);
  opacity: 0.6;
}

.app-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px;
  text-decoration: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  border-radius: 16px;
}

.app-item:hover {
  transform: translateY(-8px);
}

.app-icon {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  color: white;
  box-shadow: 0 8px 24px var(--app-shadow-lg);
  transition: all 0.3s ease;
}

.app-item:hover .app-icon {
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
  transform: scale(1.05);
}

.app-icon i {
  font-size: 36px;
}

.app-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--app-text);
  text-align: center;
}

/* 底部信息 */
.app-footer {
  text-align: center;
  padding: 20px;
  color: var(--app-text-light);
  font-size: 13px;
  border-top: 1px solid var(--app-border);
}

/* ========================================
   全屏工作区
   ======================================== */
.app-workspace {
  position: fixed;
  top: 64px;
  left: 0;
  right: 0;
  bottom: 0;
  background: white;
  z-index: 999;
}

.content-wrapper {
  height: 100%;
  background: white !important;
  margin: 0 !important;
  padding: 0 !important;
}

.tab-content {
  height: 100%;
}

.tab-pane {
  height: 100%;
}

.tab-pane iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: white;
}

/* ========================================
   响应式
   ======================================== */
@media (max-width: 768px) {
  .app-launcher-header {
    padding: 0 16px;
  }

  .app-global-search {
    max-width: 300px;
  }

  .app-user-name {
    display: none;
  }

  .app-launcher-main {
    padding: 40px 20px;
  }

  .app-welcome h1 {
    font-size: 28px;
  }

  .app-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 24px;
  }

  .app-icon {
    width: 64px;
    height: 64px;
  }

  .app-icon i {
    font-size: 28px;
  }
}

/* ========================================
   隐藏旧元素
   ======================================== */
.main-sidebar,
.main-footer,
.content-header {
  display: none !important;
}

.control-sidebar-bg {
  background: rgba(0, 0, 0, 0.5);
}
