﻿/* ===== 应用主布局 ===== */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ===== 侧边栏 ===== */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: transform 0.3s;
}

.sidebar-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-header .logo {
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.sidebar-header .title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
}

.sidebar-header .subtitle {
  font-size: 11px;
  color: var(--muted);
}

/* ===== 侧边栏导航 ===== */
.sidebar-nav {
  flex: 1;
  padding: 8px 0;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  transition: var(--transition);
  border-left: 3px solid transparent;
  text-decoration: none;
}

.nav-item:hover {
  background: var(--bg3);
  color: var(--ink);
}

.nav-item.active {
  background: var(--bg3);
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 600;
}

.nav-item .nav-icon {
  width: 20px;
  text-align: center;
  font-size: 16px;
  flex-shrink: 0;
}

.nav-item .nav-badge {
  margin-left: auto;
  background: var(--accent2);
  color: #fff;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
}

/* ===== 快捷方式区域 ===== */
.shortcut-section {
  padding: 6px 12px 10px;
  border-top: 1px solid var(--rule);
  margin-top: 4px;
}

.shortcut-label {
  font-size: 11px;
  color: var(--muted2);
  padding: 8px 8px 8px;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.shortcut-label::before {
  content: '';
  width: 3px;
  height: 12px;
  background: var(--accent4);
  border-radius: 2px;
}

.shortcut-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.shortcut-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 10px 4px;
  background: var(--bg3);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  color: var(--ink2);
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
  line-height: 1.3;
  position: relative;
  overflow: hidden;
}

.shortcut-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: transparent;
  transition: var(--transition);
}

.shortcut-btn:hover {
  background: var(--bg4);
  border-color: var(--accent);
  color: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.shortcut-btn:hover::before {
  background: var(--accent);
}

.shortcut-btn:active {
  transform: translateY(0);
}

.shortcut-btn-icon {
  font-size: 20px;
  line-height: 1;
}

/* ===== 侧边栏底部 - 用户菜单 ===== */
.sidebar-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--rule);
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: background 0.15s;
}

.sidebar-footer:hover {
  background: var(--bg3);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea, #764ba2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}

.user-text {
  flex: 1;
  min-width: 0;
}

.user-text .user-name {
  font-size: 13px;
  color: var(--ink);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-text .user-role {
  font-size: 11px;
  color: var(--muted);
  margin-top: 1px;
}

.sidebar-footer .chevron {
  color: var(--muted2);
  font-size: 12px;
  transition: transform 0.2s;
}

.sidebar-footer .chevron.open {
  transform: rotate(180deg);
}

/* ===== 用户下拉菜单 ===== */
.user-dropdown {
  position: fixed;
  bottom: 0;
  left: var(--sidebar-w);
  background: var(--bg3);
  border: 1px solid var(--rule);
  border-radius: 8px;
  box-shadow: 0 -8px 24px rgba(0,0,0,0.4);
  width: 260px;
  z-index: 300;
  overflow: hidden;
}

.dropdown-header {
  padding: 16px;
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar-lg {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea, #764ba2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  flex-shrink: 0;
}

.dropdown-header .user-meta {
  flex: 1;
  min-width: 0;
}

.user-name-lg {
  font-size: 14px;
  color: var(--ink);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropdown-header .user-company {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropdown-menu {
  padding: 4px 0;
}

.dropdown-item {
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 13px;
  color: var(--ink2);
  transition: background 0.1s;
}

.dropdown-item:hover {
  background: var(--bg4);
  color: var(--ink);
}

.dropdown-item .item-icon {
  width: 18px;
  text-align: center;
  font-size: 14px;
  flex-shrink: 0;
}

.dropdown-item .item-label {
  flex: 1;
}

.dropdown-item .item-value {
  font-size: 12px;
  color: var(--muted2);
}

.dropdown-item .item-arrow {
  font-size: 10px;
  color: var(--muted2);
}

.dropdown-divider {
  height: 1px;
  background: var(--rule);
  margin: 4px 0;
}

.dropdown-logout {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--accent2);
  background: var(--bg2);
  transition: background 0.1s;
}

.dropdown-logout:hover {
  background: var(--bg4);
}

.dropdown-logout .logout-icon {
  font-size: 14px;
}

/* ===== 主内容区 ===== */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 24px;
  min-height: 100vh;
}

/* ===== 页面头部 ===== */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.page-header h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
}

.page-header .actions {
  display: flex;
  gap: 10px;
}

/* ===== 页面切换 ===== */
.page {
  display: none;
}

.page.active {
  display: block;
}

/* ===== 移动端切换按钮 ===== */
.mobile-toggle {
  display: none;
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 200;
  background: var(--bg2);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  width: 40px;
  height: 40px;
  color: var(--ink);
  cursor: pointer;
  font-size: 18px;
  align-items: center;
  justify-content: center;
}

.theme-toggle {
  background: var(--bg3);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  width: 32px;
  height: 32px;
  color: var(--ink);
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
  padding: 0;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.theme-toggle-mobile {
  display: none;
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 201;
  background: var(--bg2);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  width: 40px;
  height: 40px;
  color: var(--ink);
  cursor: pointer;
  font-size: 18px;
  align-items: center;
  justify-content: center;
}

/* ===== 响应式布局 ===== */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.show {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
    padding: 16px;
  }

  .mobile-toggle {
    display: flex;
    right: 56px;
  }

  .theme-toggle {
    display: none;
  }

  .theme-toggle-mobile {
    display: flex;
  }
}

/* ===== 快捷方式管理按钮 ===== */
.shortcut-label .edit-btn {
  margin-left: auto;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
  border-radius: 3px;
  transition: var(--transition);
  line-height: 1;
  letter-spacing: 1px;
}

.shortcut-label .edit-btn:hover {
  color: var(--accent-hover);
  background: var(--bg3);
}

/* 编辑模式下的快捷按钮 */
.shortcut-btn.editing {
  border-style: dashed;
  border-color: var(--accent4);
  animation: shake 0.3s ease-in-out infinite alternate;
}

@keyframes shake {
  from { transform: translateX(-1px); }
  to { transform: translateX(1px); }
}

.shortcut-btn .delete-x {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 16px;
  height: 16px;
  background: var(--accent2);
  color: #fff;
  border-radius: 50%;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: var(--transition);
  line-height: 1;
  z-index: 5;
}

.shortcut-btn.editing .delete-x {
  opacity: 1;
}

.shortcut-btn.editing .delete-x:hover {
  background: #d32f2f;
  transform: scale(1.15);
}

/* ===== 快捷方式管理弹窗 ===== */
.shortcut-manager-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.shortcut-manager-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg3);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.shortcut-manager-item:hover {
  border-color: var(--accent);
}

.shortcut-manager-item .item-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.shortcut-manager-item .item-info {
  flex: 1;
  min-width: 0;
}

.shortcut-manager-item .item-name {
  font-size: 14px;
  color: var(--ink);
  line-height: 1.4;
}

.shortcut-manager-item .item-desc {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
}

.shortcut-manager-item .item-btn {
  padding: 4px 12px;
  font-size: 12px;
  flex-shrink: 0;
}

.shortcut-manager-available {
  border-top: 1px solid var(--rule);
  padding-top: 12px;
  margin-top: 4px;
}

.shortcut-manager-available .available-title {
  font-size: 12px;
  color: var(--muted2);
  margin-bottom: 8px;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.shortcut-manager-available .available-title::before {
  content: '';
  width: 3px;
  height: 12px;
  background: var(--accent3);
  border-radius: 2px;
}

/* ===== 待办事项区域 ===== */
.todo-section {
  padding: 6px 12px 8px;
  border-top: 1px solid var(--rule);
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  max-height: 280px;
}

.todo-label {
  font-size: 11px;
  color: var(--muted2);
  padding: 8px 8px 8px;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.todo-badge {
  background: var(--accent2);
  color: #fff;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
  font-weight: 700;
}

.todo-list {
  flex: 1;
  overflow-y: auto;
  min-height: 40px;
  max-height: 200px;
}

.todo-list::-webkit-scrollbar { width: 4px; }
.todo-list::-webkit-scrollbar-track { background: transparent; }
.todo-list::-webkit-scrollbar-thumb { background: var(--rule2); border-radius: 2px; }

.todo-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  margin-bottom: 2px;
  transition: var(--transition);
  cursor: default;
}

.todo-item:hover { background: var(--bg3); }
.todo-item.todo-overdue { background: rgba(231, 76, 60, 0.08); }

.todo-check {
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--rule2);
  border-radius: 50%;
  flex-shrink: 0;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  color: transparent;
}

.todo-check:hover { border-color: var(--accent3); }

.todo-check.todo-checked {
  background: var(--accent3);
  border-color: var(--accent3);
  color: #fff;
}

.todo-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.todo-text {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  color: var(--ink2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  line-height: 1.3;
}

.todo-text:hover { color: var(--accent-hover); }

.todo-time {
  font-size: 10px;
  color: var(--muted);
  flex-shrink: 0;
  white-space: nowrap;
}

.todo-time-overdue { color: var(--accent2); font-weight: 600; }

.todo-done { opacity: 0.6; }
.todo-text-done { text-decoration: line-through; color: var(--muted); }

.todo-completed-header {
  font-size: 10px;
  color: var(--muted2);
  padding: 6px 8px 3px;
  border-top: 1px solid var(--rule);
  margin-top: 4px;
}

.todo-more {
  font-size: 10px;
  color: var(--muted2);
  padding: 3px 8px;
  text-align: center;
}

.todo-empty {
  font-size: 11px;
  color: var(--muted2);
  text-align: center;
  padding: 16px 8px;
  line-height: 1.6;
}

.todo-add-btn {
  margin-top: 4px;
  padding: 6px 8px;
  background: transparent;
  border: 1px dashed var(--rule2);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  text-align: center;
}

.todo-add-btn:hover {
  border-color: var(--accent);
  color: var(--accent-hover);
  background: rgba(30, 136, 229, 0.06);
}

.todo-urgency-opt {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
  flex: 1;
  justify-content: center;
}

.todo-urgency-opt:hover { background: var(--bg3); }
.todo-urgency-opt.selected { font-weight: 600; }

@media (max-width: 768px) {
  .todo-section { max-height: 200px; }
  .todo-list { max-height: 140px; }
}
