* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f5f5f5;
  color: #333;
}

.page {
  min-height: 100vh;
}

/* 登录注册页面 */
.auth-container {
  max-width: 400px;
  margin: 100px auto;
  padding: 40px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.auth-container h1 {
  text-align: center;
  margin-bottom: 30px;
  color: #1890ff;
}

.auth-tabs {
  display: flex;
  margin-bottom: 20px;
  border-bottom: 1px solid #e8e8e8;
}

.tab-btn {
  flex: 1;
  padding: 10px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 14px;
  color: #666;
}

.tab-btn.active {
  color: #1890ff;
  border-bottom: 2px solid #1890ff;
}

.auth-form .form-group {
  margin-bottom: 15px;
}

.auth-form label {
  display: block;
  margin-bottom: 5px;
  font-size: 14px;
  color: #666;
}

.auth-form input,
.auth-form textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  font-size: 14px;
}

.auth-form input:focus,
.auth-form textarea:focus {
  outline: none;
  border-color: #1890ff;
}

/* 按钮样式 */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
}

.btn-primary {
  background: #1890ff;
  color: #fff;
}

.btn-primary:hover {
  background: #40a9ff;
}

.btn-secondary {
  background: #fff;
  color: #666;
  border: 1px solid #d9d9d9;
}

.btn-danger {
  background: #ff4d4f;
  color: #fff;
  border: none;
}

.btn-danger:hover {
  background: #ff7875;
}

.btn-small {
  padding: 5px 10px;
  font-size: 12px;
}

/* 主页面布局 */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background: #fff;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.header h2 {
  font-size: 18px;
  color: #1890ff;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 15px;
}

.main-content {
  display: flex;
  height: calc(100vh - 60px);
}

/* 侧边栏 */
.sidebar {
  width: 330px;
  background: #fff;
  border-right: 1px solid #e8e8e8;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 15px;
  border-bottom: 1px solid #e8e8e8;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar-header h3 {
  font-size: 14px;
  color: #333;
}

.order-list {
  flex: 1;
  overflow-y: auto;
}

.order-item {
  padding: 15px;
  border-bottom: 1px solid #e8e8e8;
  cursor: pointer;
}

.order-item:hover {
  background: #f5f5f5;
}

.order-item.active {
  background: #e6f7ff;
  border-left: 3px solid #1890ff;
}

.order-item h4 {
  font-size: 14px;
  margin-bottom: 5px;
}

.order-item p {
  font-size: 12px;
  color: #999;
}

.order-item .order-no {
  color: #1890ff;
  font-size: 12px;
  position: relative;
  display: inline-block;
}

.unread-badge {
  position: absolute;
  top: -8px;
  right: -18px;
  background-color: #ff4d4f;
  color: #fff;
  font-size: 10px;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  font-weight: bold;
}

/* 主内容区 */
.content {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
}

.empty-state {
  text-align: center;
  padding: 100px 20px;
  color: #999;
}

.order-detail {
  background: #fff;
  border-radius: 8px;
  padding: 20px;
}

.order-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #e8e8e8;
}

.order-header h3 {
  font-size: 18px;
  margin-bottom: 5px;
}

.order-header p {
  font-size: 12px;
  color: #999;
}

.tabs {
  display: flex;
  border-bottom: 1px solid #e8e8e8;
  margin-bottom: 20px;
}

/* 上传区域 */
.upload-area {
  padding: 20px;
  background: #fafafa;
  border: 2px dashed #d9d9d9;
  border-radius: 8px;
  margin-bottom: 20px;
}

.upload-area form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.upload-info {
  display: flex;
  gap: 10px;
  align-items: center;
}

.input-small {
  padding: 8px 10px;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  font-size: 12px;
}

/* 图纸列表 */
.blueprint-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 15px;
}

.blueprint-card {
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  padding: 15px;
  position: relative;
}

.blueprint-card.obsolete {
  opacity: 0.6;
  background: #f5f5f5;
}

.blueprint-card h4 {
  font-size: 14px;
  margin-bottom: 10px;
  word-break: break-all;
}

.blueprint-info {
  font-size: 12px;
  color: #666;
  margin-bottom: 10px;
}

.blueprint-info span {
  display: block;
  margin-bottom: 3px;
}

.blueprint-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
}

.blueprint-status.active {
  background: #d9f7be;
  color: #52c41a;
}

.blueprint-status.obsolete {
  background: #ffd8d8;
  color: #ff4d4f;
}

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

/* 聊天区域 */
.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 300px);
  min-height: 400px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
  background: #fff;
  border-radius: 8px;
}

.chat-message {
  margin-bottom: 15px;
  display: flex;
}

.chat-message.mine {
  justify-content: flex-end;
}

.chat-message.other {
  justify-content: flex-start;
}

.chat-bubble {
  max-width: 70%;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.chat-message.mine .chat-bubble {
  background: linear-gradient(135deg, #07c160 0%, #06ad56 100%);
  color: #000;
  border-bottom-right-radius: 4px;
}

.chat-message.other .chat-bubble {
  background: #fff;
  color: #000;
  border-bottom-left-radius: 4px;
}

.chat-media {
  max-width: 70%;
  padding: 4px;
  border-radius: 8px;
}

.chat-sender {
  font-size: 11px;
  color: #666;
  margin-bottom: 3px;
}

.chat-time {
  font-size: 11px;
  color: #888;
  margin-top: 4px;
}

.chat-image {
  max-width: 250px;
  max-height: 250px;
  border-radius: 8px;
  object-fit: cover;
  cursor: pointer;
}

.chat-image:hover {
  opacity: 0.9;
}

.chat-video {
  max-width: 280px;
  max-height: 200px;
  border-radius: 8px;
}

.chat-input-area {
  display: flex;
  gap: 10px;
  margin-top: 15px;
}

.chat-input-area input[type="text"] {
  flex: 1;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
}

.chat-input-area {
  display: flex;
  gap: 10px;
  margin-top: 15px;
}

.chat-input-area input {
  flex: 1;
  padding: 12px 15px;
  border: 1px solid #d9d9d9;
  border-radius: 25px;
  font-size: 14px;
}

.chat-input-area input:focus {
  outline: none;
  border-color: #1890ff;
}

/* 引用区域样式 */
.chat-reply-area {
  background: #f5f5f5;
  border-left: 3px solid #1890ff;
  padding: 8px 12px;
  margin-bottom: 8px;
  border-radius: 4px;
  font-size: 13px;
}

.reply-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #666;
  font-size: 12px;
  margin-bottom: 4px;
}

.btn-cancel-reply {
  background: none;
  border: none;
  color: #999;
  cursor: pointer;
  font-size: 14px;
  padding: 0 4px;
}

.btn-cancel-reply:hover {
  color: #333;
}

.reply-content {
  color: #333;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 消息引用样式 */
.message-quote {
  background: rgba(0, 0, 0, 0.05);
  border-left: 2px solid #1890ff;
  padding: 6px 10px;
  margin-bottom: 6px;
  font-size: 13px;
  color: #666;
}

.message-quote-sender {
  font-weight: bold;
  color: #1890ff;
  margin-right: 6px;
}

/* 引用菜单样式 */
.reply-menu {
  position: fixed;
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  z-index: 1000;
}

.reply-menu-item {
  padding: 8px 16px;
  cursor: pointer;
  font-size: 14px;
}

.reply-menu-item:hover {
  background: #f5f5f5;
}

/* 消息高亮效果 */
.chat-message.message-highlight {
  animation: highlight-pulse 0.5s ease-in-out 3;
  background-color: rgba(255, 235, 59, 0.3);
  border-radius: 8px;
}

@keyframes highlight-pulse {
  0%, 100% { background-color: rgba(255, 235, 59, 0.3); }
  50% { background-color: rgba(255, 235, 59, 0.6); }
}

/* 模态框 */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-content {
  background: #fff;
  padding: 30px;
  border-radius: 8px;
  width: 90%;
  max-width: 450px;
  position: relative;
}

#edit-order-modal {
  display: none;
}

#edit-order-modal.active {
  display: flex !important;
}

.modal-content h3 {
  margin-bottom: 20px;
  font-size: 16px;
}

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

.form-group {
  margin-bottom: 15px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-size: 14px;
  color: #666;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  font-size: 14px;
}

.form-group textarea {
  resize: vertical;
}

/* 订单成员样式 */
.members-container {
  padding: 10px 0;
}

.member-list {
  margin-bottom: 20px;
}

.member-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  background: #fafafa;
  border-radius: 8px;
  margin-bottom: 10px;
}

.member-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.member-info strong {
  font-size: 14px;
}

.member-role {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  width: fit-content;
}

.member-role.admin {
  background: #ffd8d8;
  color: #ff4d4f;
}

.member-role.member {
  background: #e6f7ff;
  color: #1890ff;
}

.member-joined {
  font-size: 11px;
  color: #999;
}

.add-member-area {
  padding: 15px;
  background: #f5f5f5;
  border-radius: 8px;
}

.add-member-area h4 {
  font-size: 14px;
  margin-bottom: 10px;
  color: #333;
}

.btn-danger {
  background: #ff4d4f;
  color: #fff;
}

.btn-danger:hover {
  background: #ff7875;
}

/* 图片预览模态框 */
#image-preview-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  cursor: pointer;
}

.image-preview-content {
  position: relative;
  max-width: 90%;
  max-height: 90%;
}

.image-preview-content img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 8px;
}

.image-preview-content .close-btn {
  position: absolute;
  top: -40px;
  right: 0;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #fff;
  font-size: 30px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-preview-content .close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}
.order-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.btn-delete-order {
  background: #ff4d4f;
  color: #fff;
  border: none;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  margin-left: 5px;
}

.btn-delete-order:hover {
  background: #ff7875;
}

.order-meta .owner {
  background: #d9f7be;
  color: #52c41a;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10px;
}

.order-meta .shared {
  background: #ffe58f;
  color: #d46b08;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10px;
}

.order-meta .company-tag {
  background: #e6f7ff;
  color: #1890ff;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10px;
}

/* 用户管理样式 */
.users-modal-content {
  max-width: 600px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.users-toolbar {
  margin-bottom: 15px;
}

.users-list {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.user-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 15px;
  border-bottom: 1px solid #eee;
}

.user-item:last-child {
  border-bottom: none;
}

.user-item:hover {
  background: #f5f5f5;
}

.user-info-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.user-info-block .username {
  font-weight: bold;
  color: #333;
}

.user-info-block .nickname {
  font-size: 12px;
  color: #666;
}

.user-info-block .company {
  font-size: 12px;
  color: #999;
}

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

.user-role-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
}

.user-role-badge.factory {
  background: #fff7e6;
  color: #fa8c16;
}

.user-role-badge.customer {
  background: #e6f7ff;
  color: #1890ff;
}

.btn-edit-user, .btn-delete-user {
  padding: 4px 10px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}

.btn-edit-user {
  background: #1890ff;
  color: #fff;
}

.btn-edit-user:hover {
  background: #40a9ff;
}

.btn-delete-user {
  background: #ff4d4f;
  color: #fff;
}

.btn-delete-user:hover {
  background: #ff7875;
}
