/**
 * 温馨家庭互动小熊 - 主题样式表
 * Bear Chatbot Theme Stylesheet
 * 
 * 基于 AI 绘图提示词的完整视觉设计系统
 * 提供色彩、纹理、动画和装饰元素的全局样式
 */

/* ================================================
   1. CSS 变量定义
   ================================================ */

:root {
  /* === 主色调 - 温暖家居系 === */
  --cream-white: #FFF8DC;      /* 奶油白 - 主背景 */
  --warm-beige: #FFE4B5;       /* 暖杏黄 - 次级背景 */
  --soft-peach: #FFEFD5;       /* 柔和桃色 - 卡片背景 */
  
  /* === 小熊角色色 === */
  --bear-caramel: #C68642;     /* 焦糖色 - 小熊主体 */
  --bear-light: #E6B87A;       /* 浅焦糖 - 小熊高光 */
  --bear-ear-pink: #FFB6C1;    /* 粉色 - 耳内渐变 */
  
  /* === 对话框色 === */
  --cloud-gold: #FFD700;       /* 金色 - 对话框底色 */
  --cloud-border: #4B0082;     /* 靛蓝紫 - 对话框文字 */
  
  /* === 装饰元素色 === */
  --sunflower-yellow: #FFD700; /* 向日葵黄 */
  --honey-amber: #FFA500;      /* 蜂蜜琥珀色 */
  --fabric-gray: #D3D3D3;      /* 针织毯浅灰 */
  --wood-brown: #D2B48C;       /* 木地板棕色 */
  
  /* === 用户消息色 === */
  --user-blue: #E6F2FF;        /* 淡蓝 */
  --user-blue-dark: #CCE5FF;   /* 中蓝 */
  --user-border: #99CCFF;      /* 蓝色边框 */
  
  /* === 功能色 === */
  --success-green: #90EE90;    /* 成功提示 */
  --error-red: #FFB6C1;        /* 错误提示（柔和粉红） */
  --info-blue: #ADD8E6;        /* 信息提示（淡蓝） */
  --warning-orange: #FFE4B5;   /* 警告提示 */
  
  /* === 阴影和光晕 === */
  --shadow-soft: 0 2px 8px rgba(0, 0, 0, 0.05), 0 4px 12px rgba(0, 0, 0, 0.03);
  --shadow-medium: 0 4px 12px rgba(0, 0, 0, 0.08), 0 8px 16px rgba(0, 0, 0, 0.05);
  --shadow-large: 0 8px 24px rgba(0, 0, 0, 0.12), 0 16px 32px rgba(0, 0, 0, 0.08);
  --glow-gold: 0 0 20px rgba(255, 215, 0, 0.3), 0 4px 12px rgba(255, 215, 0, 0.2);
  --glow-honey: 0 0 16px rgba(255, 165, 0, 0.3), 0 4px 10px rgba(255, 165, 0, 0.2);
  
  /* === 边框圆角 === */
  --radius-sm: 12px;
  --radius-md: 20px;
  --radius-lg: 28px;
  --radius-xl: 36px;
  
  /* === 动画时序 === */
  --duration-fast: 0.2s;
  --duration-normal: 0.3s;
  --duration-slow: 0.5s;
  --easing-smooth: cubic-bezier(0.34, 1.56, 0.64, 1);
  --easing-gentle: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ================================================
   2. 全局背景样式
   ================================================ */

/* 温馨家庭客厅背景 */
.bear-scene-background {
  background: linear-gradient(180deg, 
    var(--cream-white) 0%, 
    var(--warm-beige) 50%, 
    #F5DEB3 100%
  );
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  z-index: 99999; /* 确保页面在最顶层 */
}

/* 阳光斑驳效果 */
.bear-scene-background::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: 
    radial-gradient(circle at 20% 30%, rgba(255, 248, 220, 0.6) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(255, 228, 181, 0.5) 0%, transparent 50%),
    radial-gradient(circle at 50% 80%, rgba(245, 222, 179, 0.4) 0%, transparent 50%);
  animation: light-shift 20s ease-in-out infinite;
  pointer-events: none;
}

@keyframes light-shift {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 0.8; }
}

/* 木地板纹理 */
.wood-floor-texture {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 200px;
  background: repeating-linear-gradient(
    90deg,
    var(--wood-brown) 0px,
    #C19A6B 2px,
    var(--wood-brown) 4px
  );
  opacity: 0.2;
  z-index: 0;
}

/* ================================================
   3. 水彩质感和纹理
   ================================================ */

/* 水彩湿画法效果 */
.watercolor-texture {
  position: relative;
  overflow: hidden;
}

.watercolor-texture::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: 
    radial-gradient(circle at 20% 30%, rgba(255, 248, 220, 0.8) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(255, 228, 181, 0.6) 0%, transparent 50%);
  filter: blur(20px);
  mix-blend-mode: multiply;
  pointer-events: none;
}

/* 噪点纹理（胶片颗粒感） */
.film-grain {
  position: relative;
}

.film-grain::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  opacity: 0.05;
  pointer-events: none;
  mix-blend-mode: multiply;
}

/* 柔和多层阴影 */
.shadow-soft {
  box-shadow: var(--shadow-soft);
}

.shadow-medium {
  box-shadow: var(--shadow-medium);
}

.shadow-large {
  box-shadow: var(--shadow-large);
}

/* 金色光晕 */
.glow-gold {
  box-shadow: var(--glow-gold);
}

.glow-honey {
  box-shadow: var(--glow-honey);
}

/* ================================================
   4. 装饰元素
   ================================================ */

/* 飘落的光斑 */
.floating-light-spot {
  position: absolute;
  width: 80px;
  height: 80px;
  background: radial-gradient(circle, rgba(255, 248, 220, 0.4) 0%, transparent 70%);
  border-radius: 50%;
  animation: float-gentle 8s ease-in-out infinite;
  pointer-events: none;
  z-index: 1;
}

.floating-light-spot:nth-child(1) {
  top: 10%;
  left: 15%;
  animation-delay: 0s;
}

.floating-light-spot:nth-child(2) {
  top: 40%;
  right: 20%;
  animation-delay: 2.5s;
}

.floating-light-spot:nth-child(3) {
  bottom: 30%;
  left: 10%;
  animation-delay: 5s;
}

@keyframes float-gentle {
  0%, 100% {
    transform: translateY(0) scale(1);
    opacity: 0.4;
  }
  50% {
    transform: translateY(-20px) scale(1.1);
    opacity: 0.6;
  }
}

/* 向日葵装饰 */
.sunflower-decoration {
  position: absolute;
  bottom: 60px;
  right: 100px;
  width: 60px;
  height: 80px;
  opacity: 0.5;
  animation: sway 4s ease-in-out infinite;
  pointer-events: none;
  z-index: 1;
}

@keyframes sway {
  0%, 100% {
    transform: rotate(-3deg);
  }
  50% {
    transform: rotate(3deg);
  }
}

/* 纱帘效果 */
.curtain-overlay {
  position: absolute;
  top: 0;
  right: 0;
  width: 300px;
  height: 100%;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.3) 100%);
  pointer-events: none;
  z-index: 1;
}

/* ================================================
   5. 通用组件样式
   ================================================ */

/* 玻璃态卡片 */
.glass-card {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-medium);
}

.glass-card:hover {
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow-large);
  transition: all 0.3s ease;
}

/* 蜂蜜色按钮 */
.honey-button {
  padding: 12px 24px;
  background: linear-gradient(135deg, var(--honey-amber) 0%, var(--cloud-gold) 100%);
  border: 2px solid var(--cloud-gold);
  border-radius: var(--radius-md);
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-soft);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.honey-button:hover {
  background: linear-gradient(135deg, var(--cloud-gold) 0%, var(--honey-amber) 100%);
  box-shadow: var(--glow-honey);
  transform: translateY(-2px);
}

.honey-button:active {
  transform: translateY(0);
}

/* 焦糖色标签 */
.caramel-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: linear-gradient(135deg, rgba(230, 184, 122, 0.3) 0%, rgba(198, 134, 66, 0.2) 100%);
  border: 1.5px solid var(--bear-caramel);
  border-radius: 16px;
  font-size: 12px;
  color: var(--bear-caramel);
  font-weight: 600;
}

/* ================================================
   6. 通用动画
   ================================================ */

/* 淡入淡出 */
.fade-in {
  animation: fade-in var(--duration-slow) ease-out;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.fade-out {
  animation: fade-out var(--duration-slow) ease-out;
}

@keyframes fade-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* 滑入动画 */
.slide-in-up {
  animation: slide-in-up var(--duration-slow) var(--easing-smooth);
}

@keyframes slide-in-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.slide-in-down {
  animation: slide-in-down var(--duration-slow) var(--easing-smooth);
}

@keyframes slide-in-down {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.slide-in-left {
  animation: slide-in-left var(--duration-slow) var(--easing-smooth);
}

@keyframes slide-in-left {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.slide-in-right {
  animation: slide-in-right var(--duration-slow) var(--easing-smooth);
}

@keyframes slide-in-right {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* 缩放弹出 */
.scale-pop {
  animation: scale-pop var(--duration-slow) var(--easing-smooth);
}

@keyframes scale-pop {
  0% {
    opacity: 0;
    transform: scale(0.8);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* 旋转淡入 */
.rotate-fade-in {
  animation: rotate-fade-in var(--duration-slow) var(--easing-smooth);
}

@keyframes rotate-fade-in {
  from {
    opacity: 0;
    transform: rotate(-10deg) scale(0.9);
  }
  to {
    opacity: 1;
    transform: rotate(0deg) scale(1);
  }
}

/* 脉冲动画 */
.pulse {
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.9;
  }
}

/* 摇摆动画 */
.wiggle {
  animation: wiggle 1s ease-in-out;
}

@keyframes wiggle {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-5deg); }
  75% { transform: rotate(5deg); }
}

/* 弹跳动画 */
.bounce {
  animation: bounce 1s ease-in-out;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* ================================================
   7. 交互状态
   ================================================ */

/* 悬停缩放 */
.hover-scale {
  transition: transform 0.3s ease;
}

.hover-scale:hover {
  transform: scale(1.05);
}

.hover-scale:active {
  transform: scale(0.98);
}

/* 悬停提升 */
.hover-lift {
  transition: all 0.3s ease;
}

.hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-large);
}

/* 悬停发光 */
.hover-glow {
  transition: all 0.3s ease;
}

.hover-glow:hover {
  box-shadow: var(--glow-gold);
}

/* 点击波纹效果 */
.ripple {
  position: relative;
  overflow: hidden;
}

.ripple::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 215, 0, 0.4);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.ripple:active::after {
  width: 200px;
  height: 200px;
}

/* ================================================
   8. 响应式辅助类
   ================================================ */

@media (max-width: 640px) {
  :root {
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 22px;
    --radius-xl: 28px;
  }
  
  .mobile-hide {
    display: none !important;
  }
  
  .mobile-full-width {
    width: 100% !important;
  }
}

@media (min-width: 1024px) {
  .desktop-show {
    display: block;
  }
}

/* ================================================
   9. 可访问性
   ================================================ */

/* 焦点可见 */
.focus-visible:focus {
  outline: 3px solid var(--cloud-gold);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* 减少动画模式 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ================================================
   10. 性能优化
   ================================================ */

/* GPU 加速 */
.gpu-accelerated {
  will-change: transform, opacity;
  transform: translateZ(0);
  backface-visibility: hidden;
  perspective: 1000px;
}

/* 图层提升 */
.layer-promote {
  transform: translateZ(0);
  will-change: transform;
}

/* ================================================
   11. 打印样式
   ================================================ */

@media print {
  .bear-scene-background::before,
  .floating-light-spot,
  .sunflower-decoration,
  .curtain-overlay,
  .film-grain::after {
    display: none !important;
  }
  
  .glass-card {
    background: white !important;
    box-shadow: none !important;
    border: 1px solid #ccc !important;
  }
}

