/* ==========================================================================
   CSS 基础变量与重置
   ========================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
}

:root {
  --bg-cream: #f4f3e6;
  /* 奶油色背景 */
  --win-blue: #1b45a0;
  /* 经典视窗蓝 */
  --win-border: #000000;
  /* 黑色硬边框 */
  --btn-gray: #c0c0c0;
  /* 按钮灰 */
  --btn-highlight: #ffffff;
  /* 按钮高光 */
  --btn-shadow: #808080;
  /* 按钮阴影 */
  --text-dark: #222222;
  --accent-green: #71aa62;
  /* 像素绿 */
  --accent-pink: #d84572;
  /* 视窗关闭红/粉 */

  --font-pixel: "VT323", monospace;
  --font-title: "Press Start 2P", cursive;
}

/* 暗色主题 */
[data-theme="dark"] {
  --bg-cream: #1a1a2e;
  --win-blue: #4a90e2;
  --win-border: #ffffff;
  --btn-gray: #3a3a5c;
  --btn-highlight: #5a5a7c;
  --btn-shadow: #2a2a4c;
  --text-dark: #e0e0e0;
  --accent-green: #4caf50;
  --accent-pink: #ff6b9d;
}



body {
  background-color: var(--bg-cream);
  color: var(--text-dark);
  font-family: var(--font-pixel);
  font-size: 1.2rem;
  /* 铺满屏幕并居中主视窗 */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 20px;
  cursor: crosshair;
  /* 复古十字光标 */
}

/* 主内容区域 - 不强制拉伸 */
body> :not(.project-footer):not(.loading-container) {
  flex: 0 0 auto;
}

/* Loading 容器不参与 Flex 布局 */
.loading-container {
  flex: 0 0 auto;
}

/* 全局列表去样式 */
ul {
  list-style: none;
}

/* ==========================================================================
       复古 UI 组件库 (Buttons, Boxes, Loading)
       ========================================================================== */
/* 顶部 Loading 装饰 */
.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 20px;
}

.loading-bar {
  border: 3px solid var(--win-blue);
  padding: 2px;
  display: flex;
  gap: 2px;
  height: 24px;
  width: 200px;
  background: #fff;
}

.loading-block {
  background-color: var(--win-blue);
  width: 15px;
  height: 100%;
}

.loading-text {
  margin-top: 8px;
  font-family: var(--font-title);
  font-size: 0.7rem;
  color: var(--win-blue);
  letter-spacing: 2px;
}

/* 经典 3D 像素按钮 */
.btn-pixel {
  background: var(--btn-gray);
  color: black;
  font-family: var(--font-title);
  font-size: 0.6rem;
  padding: 8px 12px;
  cursor: pointer;
  border-top: 3px solid var(--btn-highlight);
  border-left: 3px solid var(--btn-highlight);
  border-right: 3px solid var(--win-border);
  border-bottom: 3px solid var(--win-border);
  outline: none;
}

.btn-pixel:active {
  border-top: 3px solid var(--win-border);
  border-left: 3px solid var(--win-border);
  border-right: 3px solid var(--btn-highlight);
  border-bottom: 3px solid var(--btn-highlight);
  padding: 9px 11px 7px 13px;
  /* 按下时文字偏移 */
}

/* 经典视窗外框 */
.window-box {
  background: var(--win-blue);
  border: 4px solid var(--win-blue);
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  border-radius: 8px;
  /* 模拟图中的稍微圆角 */
  overflow: hidden;
  box-shadow: 10px 10px 0px rgba(0, 0, 0, 0.1);
}

.window-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  color: white;
}

.window-title {
  font-family: var(--font-title);
  font-size: 0.8rem;
  letter-spacing: 1px;
}

.btn-close {
  background: var(--accent-pink);
  color: white;
  border: 2px solid white;
  border-radius: 4px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-title);
  font-size: 0.7rem;
  cursor: pointer;
}

/* ==========================================================================
       页面布局 (Layout)
       ========================================================================== */
.window-body {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.9)),
    repeating-linear-gradient(45deg,
      transparent,
      transparent 10px,
      rgba(0, 0, 0, 0.02) 10px,
      rgba(0, 0, 0, 0.02) 20px);
  background-color: var(--bg-cream);
  border: 4px solid var(--win-blue);
  /* 内层边框 */
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* 1. 顶部区域 */
header.app-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 15px;
  border-bottom: 3px dashed var(--btn-gray);
  flex-wrap: wrap;
  gap: 15px;
}

.app-logo {
  font-family: var(--font-title);
  font-size: 1.2rem;
  color: var(--win-blue);
  text-shadow: 2px 2px 0px var(--btn-gray);
}

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

.search-input {
  font-family: var(--font-pixel);
  font-size: 1.2rem;
  padding: 4px 8px;
  border: 3px solid var(--win-blue);
  background: white;
  outline: none;
}

.search-input:focus {
  background: #e6f0ff;
}

/* 主体网格布局 */
.app-layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

/* 2. 导航区域 */
nav.app-nav {
  width: 200px;
  background: white;
  border: 3px solid var(--win-border);
  padding: 10px;
  box-shadow: 4px 4px 0px var(--btn-gray);
  flex-shrink: 0;
}

.app-nav li {
  padding: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: bold;
  transition: background 0.2s;
}

.app-nav li:hover {
  background: var(--btn-gray);
}

.app-nav li.active {
  background: var(--win-blue);
  color: white;
}

.cursor {
  font-size: 0.8rem;
}

.app-nav li:not(.active) .cursor {
  visibility: hidden;
}

.app-nav li:hover .cursor {
  visibility: visible;
}

/* 中间主内容区 */
main.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* 3A. 数据卡片区 */
section.cards-area {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 15px;
}

.data-card {
  background: var(--btn-gray);
  border-top: 3px solid var(--btn-highlight);
  border-left: 3px solid var(--btn-highlight);
  border-right: 3px solid var(--win-border);
  border-bottom: 3px solid var(--win-border);
  padding: 15px;
  text-align: center;
}

.data-card h3 {
  font-size: 1.2rem;
  margin-bottom: 10px;
  color: #333;
}

.data-card .num {
  font-family: var(--font-title);
  font-size: 2rem;
  color: var(--win-blue);
  text-shadow: 2px 2px 0px white;
}

/* 3B. 任务列表区 (模仿 Warning 弹窗风格) */
section.task-area {
  background: white;
  border: 3px solid var(--win-border);
  box-shadow: 6px 6px 0px rgba(0, 0, 0, 0.2);
}

.task-header {
  background: var(--win-blue);
  color: white;
  padding: 8px 12px;
  font-family: var(--font-title);
  font-size: 0.7rem;
  display: flex;
  justify-content: space-between;
}

.task-list {
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.task-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  border: 2px dashed var(--btn-gray);
  background: var(--bg-cream);
  transition: border-color 0.2s, opacity 0.2s;
  cursor: grab;
}

.task-item:active {
  cursor: grabbing;
}

.task-item[draggable="true"]:hover {
  border-color: var(--win-blue);
  background: #eaf1fb;
}

.task-item.dragging {
  opacity: 0.55;
  border-style: solid;
  border-color: var(--win-blue);
}

.task-item.drop-target {
  border-color: var(--win-blue);
  background: #dfeeff;
}

.task-info {
  display: flex;
  flex-direction: column;
}

.task-name {
  font-weight: bold;
  font-size: 1.3rem;
}

.task-date {
  font-size: 1rem;
  color: #666;
}

.status-badge {
  font-family: var(--font-title);
  font-size: 0.6rem;
  padding: 6px 10px;
  border: 2px solid var(--win-border);
}

.status-doing {
  background: #ffd700;
}

.status-pending {
  background: #e0e0e0;
  color: #333;
}

.status-done {
  background: var(--accent-green);
  color: white;
}

/* 4. 附加信息模块 (模仿图片1中的 Note 框) */
aside.app-aside {
  width: 250px;
  flex-shrink: 0;
}

.note-box {
  border: 3px solid var(--win-blue);
  background: white;
  padding: 15px;
  text-align: center;
  position: relative;
}

.note-title-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 15px;
}

.note-lines {
  flex: 1;
  height: 6px;
  border-top: 2px solid var(--win-blue);
  border-bottom: 2px solid var(--win-blue);
}

.note-title {
  color: var(--win-blue);
  font-family: var(--font-title);
  font-size: 0.8rem;
}

/* Modal (add/edit task) */
.modal-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  z-index: 9999;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: white;
  border: 4px solid var(--win-blue);
  padding: 16px;
  width: 340px;
  box-shadow: 10px 10px 0 rgba(0, 0, 0, 0.1);
}

.modal h3 {
  font-family: var(--font-title);
  color: var(--win-blue);
  text-align: center;
  margin-bottom: 8px;
}

.modal form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal label {
  font-size: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.modal input[type="text"],
.modal input[type="date"],
.modal select {
  padding: 6px 8px;
  border: 3px solid var(--win-blue);
  font-family: var(--font-pixel);
}

.modal .modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 6px;
}

/* Task action buttons */
.task-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.icon-btn {
  background: var(--btn-gray);
  border: 2px solid var(--win-border);
  padding: 6px 8px;
  cursor: pointer;
  font-family: var(--font-title);
  font-size: 0.8rem;
}

.icon-btn:hover {
  transform: translateY(-1px);
}

/* Priority badges */
.priority-badge {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 8px;
  flex-shrink: 0;
  border: 2px solid var(--win-border);
}

.priority-high {
  background-color: #ff4444;
}

.priority-medium {
  background-color: #ffaa00;
}

.priority-low {
  background-color: #44aa44;
}

/* Tag badges */
.tag-badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 0.7rem;
  border-radius: 10px;
  margin-right: 8px;
  color: white;
  font-family: var(--font-title);
}

.tag-work {
  background-color: #4a90e2;
}

.tag-personal {
  background-color: #e24a90;
}

.tag-study {
  background-color: #90e24a;
}

.tag-other {
  background-color: #e2c04a;
}

/* Tag filter */
.task-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tag-filter-select {
  font-family: var(--font-pixel);
  font-size: 0.7rem;
  padding: 4px 6px;
  border: 2px solid white;
  background: transparent;
  color: white;
  cursor: pointer;
  outline: none;
}

.note-content {
  font-family: var(--font-pixel);
  font-size: 1.4rem;
  line-height: 1.4;
  color: var(--win-blue);
}

/* ==========================================================================
       响应式适配 (移动端)
       ========================================================================== */
@media (max-width: 900px) {
  .app-layout {
    flex-direction: column;
  }

  nav.app-nav,
  aside.app-aside {
    width: 100%;
  }

  .app-nav ul {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
  }
}

@media (max-width: 600px) {
  header.app-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .top-actions {
    width: 100%;
    display: flex;
  }

  .search-input {
    flex: 1;
  }

  .task-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .status-badge {
    align-self: flex-end;
  }
}

/* ==========================================================================
   项目信息 Footer (SEO + 用户引导) - 全屏平铺布局
   ========================================================================== */
.project-footer {
  margin-top: auto;

  /* 👇 增加以下代码，抵消 body 的 20px padding */
  margin-bottom: -20px;
  margin-left: -20px;
  margin-right: -20px;
  width: calc(100% + 40px);
  /* 补偿左右各 20px 的宽度 */

  padding: 0;
  background: linear-gradient(135deg, #1b45a0 0%, #2d5aa8 100%);
  color: #ffffff;
  font-family: var(--font-pixel);
  border-top: 4px solid #000000;
  flex-shrink: 0;
}

.footer-container {
  width: 100%;
  max-width: none;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  margin-bottom: 0;
}

.footer-section {
  padding: 30px 25px;
  height: 100%;
  border-right: 2px solid rgba(255, 255, 255, 0.15);
  display: flex;
  flex-direction: column;
}

.footer-section:last-child {
  border-right: none;
}

.footer-title {
  font-family: var(--font-title);
  font-size: 0.9rem;
  margin-bottom: 15px;
  color: #ffd700;
  text-shadow: 2px 2px 0px #000000;
}

.footer-description {
  line-height: 1.6;
  font-size: 1rem;
  color: #e8e8e8;
  margin-bottom: 10px;
}

.footer-tagline {
  font-style: italic;
  color: #71aa62;
  font-weight: bold;
  font-size: 1.1rem;
}

.feature-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.feature-list li {
  padding: 5px 0;
  font-size: 0.95rem;
  line-height: 1.5;
  border-left: 3px solid #71aa62;
  padding-left: 10px;
  margin-bottom: 8px;
}

.feature-list strong {
  color: #ffd700;
}

.footer-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-nav li {
  margin-bottom: 12px;
}

.footer-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #e8e8e8;
  text-decoration: none;
  font-size: 1rem;
  padding: 8px 12px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  transition: all 0.3s ease;
  background: rgba(0, 0, 0, 0.2);
}

.footer-link:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: #ffd700;
  color: #ffd700;
  transform: translateX(5px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.github-link {
  background: linear-gradient(135deg, #24292e 0%, #3d4449 100%);
  border-color: #ffffff;
  font-weight: bold;
}

.github-link:hover {
  background: linear-gradient(135deg, #2f363d 0%, #4a5258 100%);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}

.external-icon {
  font-size: 0.8em;
  opacity: 0.7;
}

.tech-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tech-tag {
  display: inline-block;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 15px;
  font-size: 0.85rem;
  color: #e8e8e8;
  transition: all 0.3s ease;
}

.tech-tag:hover {
  background: rgba(255, 215, 0, 0.2);
  border-color: #ffd700;
  color: #ffd700;
  transform: translateY(-2px);
}

.footer-bottom {
  width: 100%;
  padding: 20px 30px;
  border-top: 2px solid rgba(255, 255, 255, 0.3);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
  background: rgba(0, 0, 0, 0.2);
}

.footer-copyright p {
  margin: 5px 0;
  font-size: 0.9rem;
  color: #c8c8c8;
}

.footer-copyright a {
  color: #ffd700;
  text-decoration: underline;
}

.footer-copyright a:hover {
  color: #fff;
}

.footer-disclaimer {
  color: #ff6b6b !important;
  font-weight: bold;
  font-size: 0.85rem !important;
}

.footer-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: #a8a8a8;
}

.separator {
  color: #666;
}

.footer-github-mini {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #e8e8e8;
  text-decoration: none;
  padding: 5px 10px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  transition: all 0.3s ease;
}

.footer-github-mini:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffd700;
  border-color: #ffd700;
}

/* 响应式 Footer - 全屏平铺 */
@media (max-width: 1200px) {
  .footer-container {
    grid-template-columns: repeat(2, 1fr);
  }

  .footer-section:nth-child(even) {
    border-right: none;
  }

  .footer-section:nth-child(odd) {
    border-right: 2px solid rgba(255, 255, 255, 0.15);
  }
}

@media (max-width: 768px) {
  .footer-container {
    grid-template-columns: 1fr;
  }

  .footer-section {
    border-right: none;
    border-bottom: 2px solid rgba(255, 255, 255, 0.15);
  }

  .footer-section:last-child {
    border-bottom: none;
  }

  .footer-bottom {
    flex-direction: column;
    text-align: center;
    padding: 20px;
  }

  .footer-meta {
    flex-wrap: wrap;
    justify-content: center;
  }
}
