/* 标准化标题框组件样式 */

/* 标题框容器 */
.title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background-color: #ffffff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  height: 60px;
  box-sizing: border-box;
  position: sticky;
  top: 0;
  z-index: 1000;
}

/* 安全区域适配 */
.title-bar.safe-area {
  padding-top: calc(env(safe-area-inset-top, 0) + 12px);
  padding-bottom: 12px;
  height: calc(env(safe-area-inset-top, 0) + 60px);
}

/* 返回按钮 */
.title-bar-back-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  font-size: 24px;
  color: #333333;
}

.title-bar-back-btn:hover {
  background-color: #f5f5f5;
}

.title-bar-back-btn:active {
  background-color: #e0e0e0;
}

/* 标题文本 */
.title-bar-title {
  flex: 1;
  text-align: center;
  font-size: 18px;
  font-weight: 600;
  color: #212121;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 16px;
}

/* 占位元素 */
.title-bar-spacer {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

/* 右侧自定义内容容器 */
.title-bar-right {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

/* 首页按钮 */
.title-bar-home-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  font-size: 24px;
  color: #333333;
}

.title-bar-home-btn:hover {
  background-color: #f5f5f5;
}

.title-bar-home-btn:active {
  background-color: #e0e0e0;
}

/* 右侧图标按钮 */
.title-bar-right i {
  font-size: 24px;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.title-bar-right i:hover {
  opacity: 0.7;
}

/* 响应式设计 */
@media (max-width: 375px) {
  .title-bar {
    padding: 12px 12px;
    height: 56px;
  }
  
  .title-bar.safe-area {
    height: calc(env(safe-area-inset-top, 0) + 56px);
  }
  
  .title-bar-title {
    font-size: 16px;
  }
  
  .title-bar-back-btn,
  .title-bar-home-btn {
    width: 40px;
    height: 40px;
    font-size: 20px;
  }
}

@media (min-width: 768px) {
  .title-bar {
    padding: 12px 24px;
    height: 64px;
  }
  
  .title-bar.safe-area {
    height: calc(env(safe-area-inset-top, 0) + 64px);
  }
  
  .title-bar-title {
    font-size: 20px;
  }
  
  .title-bar-back-btn,
  .title-bar-home-btn {
    width: 48px;
    height: 48px;
    font-size: 28px;
  }
}

@media (min-width: 1024px) {
  .title-bar {
    padding: 12px 32px;
    height: 72px;
  }
  
  .title-bar.safe-area {
    height: calc(env(safe-area-inset-top, 0) + 72px);
  }
  
  .title-bar-title {
    font-size: 22px;
  }
  
  .title-bar-back-btn,
  .title-bar-home-btn {
    width: 56px;
    height: 56px;
    font-size: 32px;
  }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
  .title-bar {
    background-color: #1a1a1a;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  }
  
  .title-bar-title {
    color: #ffffff;
  }
  
  .title-bar-back-btn,
  .title-bar-home-btn {
    color: #ffffff;
  }
  
  .title-bar-back-btn:hover,
  .title-bar-home-btn:hover {
    background-color: #333333;
  }
  
  .title-bar-back-btn:active,
  .title-bar-home-btn:active {
    background-color: #444444;
  }
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
  .title-bar {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  }
  
  .title-bar-back-btn,
  .title-bar-home-btn {
    border: 2px solid #333333;
  }
}

/* 减少动画模式 */
@media (prefers-reduced-motion: reduce) {
  .title-bar-back-btn,
  .title-bar-home-btn {
    transition: none;
  }
}