/* ============================================
   sidebar.css - 右侧浮动工具栏
   在线咨询 / 预约挂号 / 回到顶部
   桌面端: 固定右侧竖向 | 移动端: 底部横向
   ============================================ */

/* ============================================
   桌面端侧边栏 (右侧固定)
   ============================================ */
.floating-sidebar {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: var(--z-sidebar);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.floating-sidebar__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: var(--sidebar-width);
  padding: var(--space-3) var(--space-2);
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
  position: relative;
  background: var(--bg-white);
  box-shadow: var(--shadow-md);
}

.floating-sidebar__item:first-child {
  border-radius: var(--radius-md) 0 0 0;
}

.floating-sidebar__item:last-child {
  border-radius: 0 0 0 var(--radius-md);
}

.floating-sidebar__item:hover {
  background: var(--primary-blue);
  color: var(--white);
}

.floating-sidebar__icon {
  font-size: 20px;
  color: var(--primary-blue);
  margin-bottom: 4px;
  transition: color var(--transition-base);
}

.floating-sidebar__item:hover .floating-sidebar__icon {
  color: var(--white);
}

.floating-sidebar__label {
  font-size: 10px;
  color: var(--text-secondary);
  writing-mode: horizontal-tb;
  text-align: center;
  line-height: 1.3;
  transition: color var(--transition-base);
  white-space: nowrap;
}

.floating-sidebar__item:hover .floating-sidebar__label {
  color: var(--white);
}

/* ---- 在线咨询 ---- */
.floating-sidebar__item--consult {
  background: var(--primary-blue);
}

.floating-sidebar__item--consult .floating-sidebar__icon,
.floating-sidebar__item--consult .floating-sidebar__label {
  color: var(--white);
}

.floating-sidebar__item--consult:hover {
  background: var(--primary-blue-dark);
}

/* ---- 预约挂号 ---- */
.floating-sidebar__item--appointment {
  background: var(--color-appointment);
}

.floating-sidebar__item--appointment .floating-sidebar__icon,
.floating-sidebar__item--appointment .floating-sidebar__label {
  color: var(--white);
}

.floating-sidebar__item--appointment:hover {
  background: var(--color-appointment-hover);
}

/* ---- 电话咨询 ---- */
.floating-sidebar__item--phone {
  background: var(--primary-green);
}

.floating-sidebar__item--phone .floating-sidebar__icon,
.floating-sidebar__item--phone .floating-sidebar__label {
  color: var(--white);
}

.floating-sidebar__item--phone:hover {
  background: var(--primary-green-dark);
}

/* ---- 微信 ---- */
.floating-sidebar__item--wechat {
  background: var(--bg-white);
}

.floating-sidebar__item--wechat:hover {
  background: #07C160;
}

/* 微信二维码弹出 */
.floating-sidebar__popup {
  position: absolute;
  right: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-4);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
  white-space: nowrap;
  pointer-events: none;
}

.floating-sidebar__popup::after {
  content: '';
  position: absolute;
  right: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 8px solid var(--bg-white);
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
}

.floating-sidebar__item:hover .floating-sidebar__popup {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.floating-sidebar__popup-img {
  width: 120px;
  height: 120px;
  margin-bottom: var(--space-2);
}

.floating-sidebar__popup-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.floating-sidebar__popup-text {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  text-align: center;
}

/* ---- 回到顶部 ---- */
.back-to-top {
  position: fixed;
  right: 20px;
  bottom: 100px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  z-index: var(--z-sidebar);
  transition: all var(--transition-base);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  background: var(--gradient-primary);
  color: var(--white);
  border-color: transparent;
  box-shadow: var(--shadow-primary);
  transform: translateY(-2px);
}

.back-to-top__icon {
  font-size: var(--font-size-xl);
  color: var(--primary-blue);
  transition: color var(--transition-base);
}

.back-to-top:hover .back-to-top__icon {
  color: var(--white);
}

/* ============================================
   移动端底部固定栏
   ============================================ */
.mobile-bottom-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: var(--z-fixed);
  background: var(--bg-white);
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
  border-top: 1px solid var(--border-color-light);
}

.mobile-bottom-bar__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  height: 56px;
}

.mobile-bottom-bar__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
  position: relative;
}

.mobile-bottom-bar__item::after {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 2px;
  background: var(--gradient-primary);
  transition: width var(--transition-base);
}

.mobile-bottom-bar__item:hover::after,
.mobile-bottom-bar__item.active::after {
  width: 60%;
}

.mobile-bottom-bar__icon {
  font-size: 20px;
  color: var(--text-muted);
  transition: color var(--transition-base);
}

.mobile-bottom-bar__item:hover .mobile-bottom-bar__icon,
.mobile-bottom-bar__item.active .mobile-bottom-bar__icon {
  color: var(--primary-blue);
}

.mobile-bottom-bar__label {
  font-size: 10px;
  color: var(--text-muted);
  transition: color var(--transition-base);
}

.mobile-bottom-bar__item:hover .mobile-bottom-bar__label,
.mobile-bottom-bar__item.active .mobile-bottom-bar__label {
  color: var(--primary-blue);
}

/* 预约按钮特殊样式 */
.mobile-bottom-bar__item--appointment {
  background: var(--color-appointment);
}

.mobile-bottom-bar__item--appointment .mobile-bottom-bar__icon,
.mobile-bottom-bar__item--appointment .mobile-bottom-bar__label {
  color: var(--white);
}

.mobile-bottom-bar__item--appointment:hover .mobile-bottom-bar__icon,
.mobile-bottom-bar__item--appointment:hover .mobile-bottom-bar__label {
  color: var(--white);
}

.mobile-bottom-bar__item--appointment::after {
  display: none;
}

/* 咨询按钮特殊样式 */
.mobile-bottom-bar__item--consult {
  background: var(--primary-blue);
}

.mobile-bottom-bar__item--consult .mobile-bottom-bar__icon,
.mobile-bottom-bar__item--consult .mobile-bottom-bar__label {
  color: var(--white);
}

.mobile-bottom-bar__item--consult:hover .mobile-bottom-bar__icon,
.mobile-bottom-bar__item--consult:hover .mobile-bottom-bar__label {
  color: var(--white);
}

.mobile-bottom-bar__item--consult::after {
  display: none;
}
