// 关键记忆组件样式
.section-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;

  &:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
  }

  .section-header {
    display: flex;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e2e8f0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;

    .section-icon {
      margin-right: 12px;
      font-size: 1.5rem;
    }

    h2 {
      flex: 1;
      margin: 0;
      font-size: 1.25rem;
      font-weight: 600;
    }

    .section-actions {
      display: flex;
      gap: 8px;
    }
  }

  .section-content {
    padding: 24px;
  }
}

// 按钮样式
.btn-primary {
  background: #4299e1;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background-color 0.2s ease;

  &:hover {
    background: #3182ce;
  }
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;

  &:hover {
    background: rgba(255, 255, 255, 0.3);
  }
}

.btn-icon {
  background: none;
  border: none;
  color: #718096;
  padding: 4px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;

  &:hover {
    background: #f7fafc;
    color: #4a5568;
  }
}

.btn-copy {
  background: #e2e8f0;
  border: none;
  color: #4a5568;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;

  &:hover {
    background: #cbd5e0;
  }
}

.btn-expand {
  background: none;
  border: none;
  color: #718096;
  padding: 2px;
  cursor: pointer;
  margin-left: 8px;
}

// 统计数据样式
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;

  .stat-item {
    text-align: center;
    padding: 16px;
    background: #f7fafc;
    border-radius: 8px;

    .stat-number {
      display: block;
      font-size: 2rem;
      font-weight: 700;
      color: #2d3748;
    }

    .stat-label {
      font-size: 0.875rem;
      color: #718096;
    }
  }
}

// 搜索控制样式
.search-controls {
  margin-bottom: 24px;

  .search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;

    input {
      flex: 1;
      border: none;
      outline: none;
      font-size: 0.875rem;
    }
  }

  .filter-controls {
    display: flex;
    align-items: center;
    gap: 16px;

    .type-filter {
      padding: 6px 12px;
      border: 1px solid #e2e8f0;
      border-radius: 6px;
      background: white;
      font-size: 0.875rem;
    }

    .secret-toggle {
      display: flex;
      align-items: center;
      gap: 8px;
      cursor: pointer;
      font-size: 0.875rem;

      input[type="checkbox"] {
        display: none;
      }

      .checkmark {
        width: 16px;
        height: 16px;
        border: 2px solid #e2e8f0;
        border-radius: 3px;
        position: relative;
        transition: all 0.2s ease;

        &::after {
          content: '';
          position: absolute;
          left: 3px;
          top: 0px;
          width: 6px;
          height: 10px;
          border: solid white;
          border-width: 0 2px 2px 0;
          transform: rotate(45deg);
          opacity: 0;
          transition: opacity 0.2s ease;
        }
      }

      input:checked + .checkmark {
        background: #4299e1;
        border-color: #4299e1;

        &::after {
          opacity: 1;
        }
      }
    }
  }
}

// 快速访问样式
.quick-access {
  margin-bottom: 24px;

  h3 {
    margin: 0 0 12px 0;
    color: #2d3748;
    font-size: 1rem;
  }

  .quick-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;

    .quick-item {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 8px 12px;
      background: #f7fafc;
      border-radius: 6px;
      transition: background-color 0.2s ease;

      &:hover {
        background: #edf2f7;
      }

      .item-key {
        font-weight: 600;
        color: #2d3748;
        font-size: 0.75rem;
      }

      .item-value {
        flex: 1;
        font-size: 0.75rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
    }
  }
}

// 分类列表样式
.categories-list {
  .category-section {
    margin-bottom: 16px;

    .category-header {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 12px 16px;
      background: #f7fafc;
      border-radius: 8px;
      cursor: pointer;
      transition: background-color 0.2s ease;

      &:hover {
        background: #edf2f7;
      }

      .category-name {
        flex: 1;
        font-weight: 600;
        color: #2d3748;
      }

      .item-count {
        color: #718096;
        font-size: 0.875rem;
      }

      .icon-chevron {
        transition: transform 0.2s ease;

        &.expanded {
          transform: rotate(90deg);
        }
      }
    }

    .category-items {
      margin-top: 8px;
      margin-left: 12px;

      .memory-item {
        border: 1px solid #e2e8f0;
        border-radius: 8px;
        margin-bottom: 8px;
        overflow: hidden;
        transition: all 0.2s ease;

        &:hover {
          border-color: #cbd5e0;
          box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
        }

        .item-header {
          display: flex;
          justify-content: space-between;
          align-items: flex-start;
          padding: 12px 16px;
          background: #fafafa;

          .item-info {
            flex: 1;

            .item-key {
              display: flex;
              align-items: center;
              gap: 8px;
              margin-bottom: 4px;

              .key-text {
                font-weight: 600;
                color: #2d3748;
                font-size: 0.875rem;
              }

              .secret-badge {
                background: #fed7d7;
                color: #e53e3e;
                padding: 2px 6px;
                border-radius: 12px;
                font-size: 0.625rem;
              }
            }

            .item-description {
              font-size: 0.75rem;
              color: #718096;
            }
          }

          .item-actions {
            display: flex;
            gap: 4px;
          }
        }

        .item-content {
          padding: 12px 16px;

          .value-container {
            display: flex;
            align-items: flex-start;
            gap: 8px;
            margin-bottom: 12px;

            .value-text {
              flex: 1;
              font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
              font-size: 0.875rem;
              color: #4a5568;
              background: #f7fafc;
              padding: 8px 12px;
              border-radius: 6px;
              border: 1px solid #e2e8f0;

              pre {
                margin: 0;
                white-space: pre-wrap;
                word-break: break-all;
              }

              &.truncated {
                max-height: 60px;
                overflow: hidden;
              }
            }
          }

          .item-meta {
            .tags {
              display: flex;
              flex-wrap: wrap;
              gap: 4px;
              margin-bottom: 8px;

              .tag {
                background: #e2e8f0;
                padding: 2px 6px;
                border-radius: 12px;
                font-size: 0.625rem;
                color: #4a5568;
              }
            }

            .meta-info {
              display: flex;
              justify-content: space-between;
              font-size: 0.625rem;
              color: #a0aec0;
            }
          }
        }
      }
    }
  }
}

// 最近使用样式
.recent-items {
  h3 {
    margin: 0 0 12px 0;
    color: #2d3748;
    font-size: 1rem;
  }

  .recent-list {
    display: flex;
    flex-direction: column;
    gap: 8px;

    .recent-item {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 8px 12px;
      background: #f7fafc;
      border-radius: 6px;
      transition: background-color 0.2s ease;

      &:hover {
        background: #edf2f7;
      }

      .recent-info {
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 2px;

        .recent-key {
          font-weight: 600;
          color: #2d3748;
          font-size: 0.75rem;
        }

        .recent-value {
          font-size: 0.625rem;
          color: #718096;
          font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
        }
      }
    }
  }
}

// 响应式设计
@media (max-width: 768px) {
  .stats-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .quick-items {
    grid-template-columns: 1fr;
  }

  .filter-controls {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}
