/* 自定义样式 - HabitVerse 低保真原型 */
:root {
  --nav-height: 56px;
  --tabbar-height: 56px;
  --safe-area-top: env(safe-area-inset-top);
  --safe-area-bottom: env(safe-area-inset-bottom);
}

/* 全局隐藏滚动条（保留滚动功能）*/
* {
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
}

*::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
  width: 0;
  height: 0;
}

html, body {
  overflow-x: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
  display: none;
}

/* iPhone 15 模拟器样式 */
.phone-container {
  width: 393px;
  height: 852px;
  margin: 20px auto;
  background: #000;
  border-radius: 47px;
  padding: 8px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  position: relative;
}

.phone-screen {
  width: 100%;
  height: 100%;
  background: #fff;
  border-radius: 39px;
  overflow: hidden;
  position: relative;
}

/* 状态栏 */
.status-bar {
  height: 44px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  font-size: 14px;
  font-weight: 600;
  background: transparent;
  position: relative;
  z-index: 100;
}

/* 导航栏 */
.nav-bar {
  height: var(--nav-height);
  display: flex;
  align-items: center;
  padding: 0 16px;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 50;
}

/* ========== 三Tab导航栏设计 ========== */

/* TabBar容器 - 磨砂玻璃效果 */
.tab-bar {
  height: 68px;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  display: flex;
  justify-content: space-around;
  align-items: center;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 0 32px calc(12px + var(--safe-area-bottom));
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  box-shadow: 
    0 -4px 20px rgba(0, 0, 0, 0.08),
    0 1px 0 rgba(255, 255, 255, 0.4) inset;
}

/* 左右Tab项 */
.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 16px;
  color: #64748b;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 12px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

.tab-item i {
  font-size: 24px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Tab激活状态 */
.tab-item.active {
  color: #667eea;
}

.tab-item.active i {
  transform: scale(1.1);
}

/* Tab按下反馈（手机端点击效果） */
.tab-item:active {
  transform: scale(0.95);
  background: rgba(0, 0, 0, 0.05);
}

/* ========== 中间星球按钮（特殊设计）========== */

.fab {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  
  /* 渐变背景 - 星空主题 */
  background: linear-gradient(135deg, 
    #667eea 0%, 
    #764ba2 50%,
    #f093fb 100%
  );
  
  /* 多层阴影 - 创造悬浮效果 */
  box-shadow: 
    0 0 0 4px rgba(255, 255, 255, 1),           /* 白色边框 */
    0 0 0 6px rgba(102, 126, 234, 0.15),       /* 外发光1 */
    0 0 0 10px rgba(102, 126, 234, 0.08),      /* 外发光2 */
    0 8px 24px rgba(102, 126, 234, 0.35),      /* 底部阴影 */
    0 4px 12px rgba(118, 75, 162, 0.25);       /* 紫色阴影 */
  
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 26px;
  cursor: pointer;
  
  /* 向上突出 */
  margin-top: -36px;
  
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 110;
  
  /* 呼吸光效动画 */
  animation: planet-glow 3s ease-in-out infinite;
}

.fab i {
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
  transition: all 0.2s ease;
}

/* 按下效果（手机端点击反馈） */
.fab:active {
  transform: translateY(0) scale(0.92);
  transition-duration: 0.15s;
  box-shadow: 
    0 0 0 4px rgba(255, 255, 255, 1),
    0 0 0 6px rgba(102, 126, 234, 0.2),
    0 4px 16px rgba(102, 126, 234, 0.4),
    0 2px 8px rgba(118, 75, 162, 0.3);
}

.fab:active i {
  transform: scale(0.95);
}

/* 呼吸光效动画 */
@keyframes planet-glow {
  0%, 100% {
    box-shadow: 
      0 0 0 4px rgba(255, 255, 255, 1),
      0 0 0 6px rgba(102, 126, 234, 0.15),
      0 0 0 10px rgba(102, 126, 234, 0.08),
      0 8px 24px rgba(102, 126, 234, 0.35),
      0 4px 12px rgba(118, 75, 162, 0.25);
  }
  50% {
    box-shadow: 
      0 0 0 4px rgba(255, 255, 255, 1),
      0 0 0 10px rgba(102, 126, 234, 0.25),
      0 0 0 16px rgba(102, 126, 234, 0.12),
      0 12px 32px rgba(102, 126, 234, 0.5),
      0 6px 16px rgba(118, 75, 162, 0.35);
  }
}

/* 卡片样式 */
.card {
  background: white;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* 按钮样式 */
.btn {
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
  color: white;
}

.btn-secondary {
  background: #f1f5f9;
  color: #475569;
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #94a3b8;
}

.empty-state i {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

/* 输入框 */
.input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 16px;
}

/* 星球3D区域占位 */
.planet-3d-area {
  width: 100%;
  height: 70vh;
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.planet-placeholder {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #3b82f6, #1e40af);
  box-shadow: 0 0 60px rgba(59, 130, 246, 0.5);
  position: relative;
}

/* 首页3D星球容器 */
#planet-canvas-container {
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

#planet-canvas-container:active {
  cursor: grabbing;
}

/* 悬浮胶囊容器样式 */
.planet-info-capsule {
  background: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 9999px;
  padding: 10px 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* 3D星球交互提示 */
.planet-interaction-hint {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(8px);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.8);
  pointer-events: none;
  z-index: 10;
}

/* 阶段卡片 */
.stage-card {
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(10px);
  padding: 20px;
  border-radius: 20px 20px 0 0;
  position: fixed;
  bottom: var(--tabbar-height);
  left: 0;
  right: 0;
  z-index: 40;
}

/* 进度条 */
.progress-bar {
  width: 100%;
  height: 8px;
  background: #1e293b;
  border-radius: 4px;
  overflow: hidden;
  margin: 12px 0;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #60a5fa, #3b82f6);
  transition: width 0.3s;
}

/* 引导页指示器 */
.guide-indicator {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 40px;
}

.indicator-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #cbd5e1;
  transition: all 0.3s;
}

.indicator-dot.active {
  width: 24px;
  border-radius: 4px;
  background: #60a5fa;
}

/* 习惯卡片 */
.habit-card {
  background: white;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.habit-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

/* Switch 开关 */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  transition: 0.3s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: #3b82f6;
}

input:checked + .slider:before {
  transform: translateX(20px);
}

/* PRD标注系统 */
.annotation-container {
  position: relative;
  width: 100%;
  height: 100%;
}

.annotation-marker {
  position: absolute;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #3b82f6;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
  transition: all 0.2s;
}

.annotation-marker:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.6);
}

.annotation-line {
  position: absolute;
  border: 1px dashed #3b82f6;
  z-index: 999;
  pointer-events: none;
}

.annotation-popup {
  position: absolute;
  background: white;
  border: 2px solid #3b82f6;
  border-radius: 8px;
  padding: 12px;
  min-width: 280px;
  max-width: 320px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1001;
  font-size: 12px;
  line-height: 1.6;
  display: none;
}

.annotation-popup.show {
  display: block;
}

.annotation-popup .title {
  font-weight: bold;
  color: #1e293b;
  margin-bottom: 8px;
  font-size: 13px;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 6px;
}

.annotation-popup .section {
  margin-bottom: 8px;
}

.annotation-popup .section-label {
  color: #64748b;
  font-size: 11px;
  margin-bottom: 4px;
  font-weight: 500;
}

.annotation-popup .section-content {
  color: #475569;
  font-size: 11px;
}

.annotation-popup .close-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  color: #64748b;
}

.annotation-popup .close-btn:hover {
  background: #e2e8f0;
}

/* 标注显示/隐藏控制 */
.annotation-toggle {
  /* position 和定位由 JS 动态设置 */
  z-index: 99999 !important;
  background: #3b82f6;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 24px;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
  font-weight: 600;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.annotation-toggle:hover {
  background: #2563eb;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.5);
}

.annotation-toggle:active {
  transform: translateY(0) scale(0.98);
}

/* 响应式 */
@media (max-width: 393px) {
  .phone-container {
    width: 100%;
    height: 100vh;
    margin: 0;
    border-radius: 0;
    padding: 0;
  }
  
  .phone-screen {
    border-radius: 0;
  }
  
  .annotation-popup {
    max-width: 280px;
    font-size: 11px;
  }
}
