@tailwind base;
@tailwind components;
@tailwind utilities;

/* 基础样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body, #app {
  height: 100%;
  width: 100%;
  overflow: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 自定义滚动条 */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

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

::-webkit-scrollbar-thumb:hover {
  background: #a1a1aa;
}

/* 暗黑模式滚动条 */
.dark ::-webkit-scrollbar-thumb {
  background: #4b5563;
}

.dark ::-webkit-scrollbar-thumb:hover {
  background: #6b7280;
}

/* 禁止选中文本 (Tauri 窗口) */
.no-select {
  user-select: none;
  -webkit-user-select: none;
}

/* 拖拽区域 */
.drag-region {
  -webkit-app-region: drag;
}

.no-drag {
  -webkit-app-region: no-drag;
}

/* 动画 */
.fade-enter-active,
.fade-leave-active {
  transition: opacity 0.2s ease;
}

.fade-enter-from,
.fade-leave-to {
  opacity: 0;
}

.slide-enter-active,
.slide-leave-active {
  transition: transform 0.2s ease;
}

.slide-enter-from {
  transform: translateX(-100%);
}

.slide-leave-to {
  transform: translateX(-100%);
}

/* 消息气泡 */
.message-bubble {
  @apply rounded-lg px-3 py-2 max-w-[70%] break-words;
}

.message-bubble.sent {
  @apply bg-primary-500 text-white ml-auto;
}

.message-bubble.received {
  @apply bg-white text-gray-800 mr-auto shadow-sm;
}

/* 暗黑模式消息气泡 */
.dark .message-bubble.received {
  @apply bg-gray-700 text-gray-100;
}

/* 设备卡片悬停效果 */
.device-card {
  @apply transition-all duration-200 ease-in-out;
}

.device-card:hover {
  @apply shadow-md transform scale-[1.02];
}

/* 进度条动画 */
@keyframes progress-indeterminate {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

.progress-indeterminate {
  animation: progress-indeterminate 1.5s infinite linear;
}
