// 现代化聊天应用样式
.chat-app {
  height: calc(100vh - 84px);
  display: flex;
  background: #f5f7fa;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

// 左侧边栏
.chat-sidebar {
  width: 320px;
  background: #ffffff;
  border-right: 1px solid #e4e7ed;
  display: flex;
  flex-direction: column;

  .sidebar-header {
    padding: 16px 20px;
    border-bottom: 1px solid #f0f2f5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fafbfc;

    .header-title {
      display: flex;
      align-items: center;
      font-size: 18px;
      font-weight: 600;
      color: #1f2937;
      gap: 8px;
    }
  }

  .search-container {
    padding: 16px 20px;
    background: #fafbfc;
    border-bottom: 1px solid #f0f2f5;
  }

  .conversation-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;

    .conversation-item {
      display: flex;
      align-items: center;
      padding: 12px 20px;
      cursor: pointer;
      border-left: 3px solid transparent;
      transition: background 0.2s;

      &:hover {
        background: #f5f7fa;
      }

      &.active {
        background: #ecf5ff;
        border-left-color: #409eff;
      }

      &.unread {
        background: #fefefe;
        border-left-color: #ff4757;

        .conversation-name {
          font-weight: 600;
        }
      }

      .conversation-avatar {
        margin-right: 12px;
      }

      .conversation-content {
        flex: 1;
        min-width: 0;

        .conversation-header {
          display: flex;
          justify-content: space-between;
          margin-bottom: 4px;

          .conversation-name {
            font-size: 15px;
            font-weight: 500;
            color: #1f2937;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
          }

          .conversation-time {
            font-size: 12px;
            color: #9ca3af;
          }
        }

        .conversation-preview {
          display: flex;
          justify-content: space-between;
          align-items: center;

          .last-message {
            font-size: 13px;
            color: #6b7280;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            max-width: 180px;
          }
        }
      }
    }

    .empty-conversations {
      display: flex;
      flex-direction: column;
      align-items: center;
      padding: 60px 20px;
      color: #9ca3af;
    }
  }
}

// 右侧聊天区域
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #ffffff;

  .chat-window {
    height: 100%;
    display: flex;
    flex-direction: column;

    .chat-header {
      padding: 16px 24px;
      border-bottom: 1px solid #e5e7eb;
      display: flex;
      align-items: center;
      justify-content: space-between;
      background: #fafbfc;

      .chat-user-info {
        display: flex;
        align-items: center;

        .user-details {
          margin-left: 12px;

          .user-name {
            font-size: 16px;
            font-weight: 600;
            color: #1f2937;
          }
        }
      }
    }

    .messages-container {
      flex: 1;
      overflow-y: auto;
      padding: 16px 24px;
      background: #ffffff;

      .notification-container {
        .notification-card {
          background: #f5f7fa;
          border-radius: 8px;
          padding: 16px;
          margin-bottom: 12px;
          cursor: pointer;
          transition: background 0.2s;

          &:hover {
            background: #ebedf0;
          }

          &.is-unread {
            background: #ecf5ff;
            border-left: 3px solid #409eff;
          }

          .card-title {
            font-weight: 600;
            color: #303133;
            margin-bottom: 8px;
          }

          .card-content {
            color: #606266;
            font-size: 14px;
            margin-bottom: 8px;
          }

          .card-time {
            font-size: 12px;
            color: #909399;
          }
        }

        .empty-notifications {
          text-align: center;
          padding: 60px;
          color: #909399;
        }
      }

      .messages-list {
        .message-group {
          margin-bottom: 24px;

          .date-divider {
            text-align: center;
            margin-bottom: 16px;

            .date-text {
              display: inline-block;
              padding: 4px 12px;
              background: rgba(0, 0, 0, 0.05);
              border-radius: 12px;
              font-size: 12px;
              color: #6b7280;
            }
          }

          .message-wrapper {
            margin-bottom: 12px;

            &.is-mine {
              .message-item {
                justify-content: flex-end;
              }

              .message-content {
                align-items: flex-end;
              }

              .message-meta {
                justify-content: flex-end;
              }
            }

            .message-item {
              display: flex;
              align-items: flex-start;
              gap: 12px;

              .message-content {
                display: flex;
                flex-direction: column;
                max-width: 70%;

                .message-bubble {
                  padding: 12px 16px;
                  border-radius: 12px;
                  font-size: 15px;
                  line-height: 1.5;
                  word-break: break-word;
                  position: relative;
                  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);

                  &.bubble-other {
                    background: #f0f2f5;
                    color: #303133;
                    border-top-left-radius: 2px;
                  }

                  &.bubble-mine {
                    background: #409eff;
                    color: #ffffff;
                    border-top-right-radius: 2px;
                    box-shadow: 0 2px 6px rgba(64, 158, 255, 0.25);
                  }
                }

                .message-meta {
                  display: flex;
                  margin-top: 4px;
                  padding: 0 14px;

                  .message-time {
                    font-size: 12px;
                    color: #9ca3af;
                  }
                }
              }
            }
          }
        }

        .empty-messages {
          display: flex;
          flex-direction: column;
          align-items: center;
          justify-content: center;
          height: 300px;
          color: #9ca3af;
        }
      }
    }

    .input-area {
      border-top: 1px solid #e5e7eb;
      padding: 16px 24px;

      .input-container {
        .input-footer {
          display: flex;
          justify-content: space-between;
          align-items: center;
          margin-top: 12px;

          .char-count {
            font-size: 12px;
            color: #9ca3af;
          }
        }
      }
    }
  }

  .welcome-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #f5f7fa;
    color: #606266;

    h2 {
      margin: 24px 0 12px;
      font-size: 24px;
      color: #303133;
    }

    p {
      margin-bottom: 32px;
      color: #909399;
    }
  }
}

// 右键菜单
.context-menu {
  position: fixed;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  padding: 8px 0;
  z-index: 3000;
  min-width: 150px;

  .context-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    cursor: pointer;
    font-size: 14px;

    &:hover {
      background: #f5f7fa;
    }
  }
}

// 滚动条
.conversation-list,
.messages-container {
  &::-webkit-scrollbar {
    width: 6px;
  }

  &::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
  }
}
