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

/* 基础样式 */
:root {
  --sidebar-width: 280px;
}

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

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  @apply bg-surface-50 text-surface-900 dark:bg-surface-900 dark:text-surface-50 transition-colors duration-300;
}

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

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

::-webkit-scrollbar-thumb {
  @apply bg-surface-300 dark:bg-surface-700 rounded-full transition-colors;
  border: 2px solid transparent;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  @apply bg-surface-400 dark:bg-surface-600;
}

/* 玻璃拟态效果 */
.glass {
  @apply bg-white/70 dark:bg-surface-900/70 backdrop-blur-md border border-white/20 dark:border-surface-700/30;
}

.glass-panel {
  @apply bg-white/50 dark:bg-surface-800/50 backdrop-blur-sm border border-white/10 dark:border-white/5 shadow-soft;
}

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

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

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

/* 动画过渡 */
.page-enter-active,
.page-leave-active {
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.page-enter-from {
  opacity: 0;
  transform: translateY(10px);
}

.page-leave-to {
  opacity: 0;
  transform: translateY(-10px);
}

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

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

/* 消息气泡 - 增强版 */
.message-bubble {
  @apply relative px-4 py-2.5 max-w-[75%] break-words shadow-sm text-[15px] leading-relaxed transition-all duration-200;
}

.message-bubble.sent {
  @apply bg-gradient-to-br from-primary-500 to-primary-600 text-white ml-auto rounded-2xl rounded-tr-sm;
  box-shadow: 0 4px 15px -3px rgba(124, 58, 237, 0.3);
}

.message-bubble.received {
  @apply bg-white dark:bg-surface-800 text-surface-800 dark:text-surface-100 mr-auto rounded-2xl rounded-tl-sm border border-surface-100 dark:border-surface-700;
  box-shadow: 0 2px 10px -2px rgba(0, 0, 0, 0.05);
}

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

.device-card:hover {
  @apply transform -translate-y-1 shadow-medium border-primary-200 dark:border-primary-800/50;
}

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

.shimmer-effect {
  position: relative;
  overflow: hidden;
}

.shimmer-effect::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  animation: shimmer 1.5s infinite;
}
