/* 移动端适配增强样式 - 交互效果和高级适配 */

/* ===== 触摸交互效果 ===== */

/* 触摸激活状态 */
.touch-active {
  opacity: 0.8;
  transform: scale(0.98);
}

/* 长按效果 */
.long-press {
  position: relative;
}

.long-press:active::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.1);
  border-radius: inherit;
  pointer-events: none;
}

/* 滑动手势指示 */
.swipe-hint::after {
  content: '→';
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: #70533B;
  opacity: 0.7;
  animation: swipeHint 2s infinite;
}

@keyframes swipeHint {
  0% {
    transform: translateY(-50%) translateX(0);
    opacity: 0.7;
  }
  50% {
    transform: translateY(-50%) translateX(10px);
    opacity: 1;
  }
  100% {
    transform: translateY(-50%) translateX(0);
    opacity: 0.7;
  }
}

/* ===== 移动端导航样式 ===== */

/* 汉堡菜单按钮 */
.mobile-menu-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  color: #70533B;
  cursor: pointer;
  z-index: 1001;
}

.mobile-menu-toggle i {
  font-size: 1.5rem;
  transition: transform 0.3s ease;
}

/* 移动端导航菜单样式 */
.mobile-menu {
  padding: 4rem 1.5rem 2rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.mobile-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #EAD2BE;
}

.mobile-menu-logo {
  height: 2.5rem;
  width: auto;
}

.mobile-menu-nav {
  list-style: none;
  padding: 0;
  margin: 0;
}

.mobile-menu-nav li {
  margin-bottom: 0.5rem;
}

.mobile-menu-nav a {
  display: block;
  padding: 1rem;
  color: #2D2D2D;
  text-decoration: none;
  border-radius: 0.5rem;
  transition: background-color 0.3s ease;
}

.mobile-menu-nav a:hover,
.mobile-menu-nav a:focus {
  background-color: #EAD2BE;
}

.mobile-menu-nav a.active {
  background-color: #70533B;
  color: white;
}

/* 移动端头部隐藏效果 */
.header-mobile {
  transition: transform 0.3s ease;
}

.header-mobile.header-hidden {
  transform: translateY(-100%);
}

/* ===== 返回顶部按钮 ===== */

.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 50px;
  height: 50px;
  background-color: #70533B;
  color: white;
  border: none;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(112, 83, 59, 0.3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translateY(100px);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  z-index: 100;
}

.back-to-top.visible {
  transform: translateY(0);
  opacity: 1;
}

/* ===== 表单移动端优化 ===== */

/* 搜索框移动端样式 */
.search-container-mobile {
  position: relative;
  margin: 1rem 0;
}

.search-input-mobile {
  width: 100%;
  padding: 1rem 3rem 1rem 1rem;
  border: 1px solid #EAD2BE;
  border-radius: 2rem;
  font-size: 1rem;
  background-color: white;
}

.search-button-mobile {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  width: 2.5rem;
  height: 2.5rem;
  background: #70533B;
  border: none;
  border-radius: 50%;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* 表单输入组 */
.input-group-mobile {
  position: relative;
  margin-bottom: 1.5rem;
}

.input-label-mobile {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: #2D2D2D;
}

.input-field-mobile {
  width: 100%;
  padding: 1rem;
  border: 1px solid #EAD2BE;
  border-radius: 0.5rem;
  font-size: 1rem;
  background-color: white;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.input-field-mobile:focus {
  border-color: #70533B;
  box-shadow: 0 0 0 3px rgba(112, 83, 59, 0.1);
  outline: none;
}

.input-field-mobile.error {
  border-color: #e53e3e;
}

.input-error-mobile {
  color: #e53e3e;
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

/* ===== 移动端卡片和列表 ===== */

/* 可滑动卡片容器 */
.swipe-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
}

.swipe-container::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

.swipe-cards {
  display: flex;
  padding: 1rem 0;
  gap: 1rem;
  width: max-content;
}

.swipe-card {
  flex: 0 0 auto;
  width: 85vw;
  max-width: 320px;
  background: white;
  border-radius: 0.75rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  padding: 1.5rem;
}

@media screen and (min-width: 768px) {
  .swipe-card {
    width: 280px;
  }
}

/* 移动端列表 */
.list-mobile {
  list-style: none;
  padding: 0;
  margin: 0;
}

.list-item-mobile {
  padding: 1rem 0;
  border-bottom: 1px solid rgba(234, 210, 190, 0.3);
  display: flex;
  align-items: center;
  transition: background-color 0.2s ease;
}

.list-item-mobile:last-child {
  border-bottom: none;
}

.list-item-mobile:active {
  background-color: rgba(234, 210, 190, 0.2);
}

.list-item-icon {
  margin-right: 1rem;
  color: #70533B;
  font-size: 1.25rem;
}

.list-item-content {
  flex: 1;
}

.list-item-title {
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.list-item-desc {
  color: #6B7280;
  font-size: 0.875rem;
}

.list-item-arrow {
  color: #6B7280;
  font-size: 1rem;
}

/* ===== 移动端选项卡 ===== */

.tabs-mobile {
  display: flex;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  margin: 0 -1rem;
  padding: 0 1rem;
}

.tabs-mobile::-webkit-scrollbar {
  display: none;
}

.tab-mobile {
  flex: 0 0 auto;
  padding: 1rem 1.5rem;
  text-align: center;
  white-space: nowrap;
  color: #6B7280;
  border-bottom: 3px solid transparent;
  transition: color 0.3s ease, border-color 0.3s ease;
}

.tab-mobile.active {
  color: #70533B;
  border-bottom-color: #70533B;
}

.tab-content-mobile {
  display: none;
  padding: 1.5rem 0;
}

.tab-content-mobile.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== 移动端模态框 ===== */

.modal-mobile {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-mobile.active {
  opacity: 1;
  visibility: visible;
}

.modal-content-mobile {
  background: white;
  border-radius: 1rem 1rem 0 0;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  transform: translateY(100%);
  transition: transform 0.3s ease;
  position: absolute;
  bottom: 0;
}

.modal-mobile.active .modal-content-mobile {
  transform: translateY(0);
}

.modal-header-mobile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 1.5rem 0.5rem;
  border-bottom: 1px solid #EAD2BE;
}

.modal-title-mobile {
  font-size: 1.25rem;
  font-weight: 500;
}

.modal-close-mobile {
  width: 2rem;
  height: 2rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #6B7280;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.modal-body-mobile {
  padding: 1.5rem;
}

.modal-footer-mobile {
  padding: 1rem 1.5rem 1.5rem;
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
}

/* ===== 移动端滚动指示器 ===== */

.scroll-indicator {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #70533B;
  animation: bounce 2s infinite;
}

.scroll-indicator-text {
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
}

.scroll-indicator-icon {
  width: 1.5rem;
  height: 1.5rem;
  border: 2px solid #70533B;
  border-radius: 50%;
  position: relative;
}

.scroll-indicator-icon::after {
  content: '';
  position: absolute;
  top: 0.5rem;
  left: 50%;
  transform: translateX(-50%);
  width: 0.25rem;
  height: 0.25rem;
  background-color: #70533B;
  border-radius: 50%;
  animation: scrollDots 2s infinite;
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateX(-50%) translateY(0);
  }
  40% {
    transform: translateX(-50%) translateY(-10px);
  }
  60% {
    transform: translateX(-50%) translateY(-5px);
  }
}

@keyframes scrollDots {
  0% {
    top: 0.5rem;
    opacity: 0;
  }
  40% {
    top: 0.75rem;
    opacity: 1;
  }
  80% {
    top: 1rem;
    opacity: 0;
  }
  100% {
    top: 0.5rem;
    opacity: 0;
  }
}

/* ===== 加载状态 ===== */

.loading-mobile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.loading-spinner {
  width: 2.5rem;
  height: 2.5rem;
  border: 3px solid #EAD2BE;
  border-top: 3px solid #70533B;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loading-text {
  margin-top: 1rem;
  color: #6B7280;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ===== 空状态 ===== */

.empty-state-mobile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  text-align: center;
}

.empty-icon-mobile {
  font-size: 3rem;
  color: #EAD2BE;
  margin-bottom: 1rem;
}

.empty-title-mobile {
  font-size: 1.25rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: #2D2D2D;
}

.empty-desc-mobile {
  color: #6B7280;
  margin-bottom: 1.5rem;
}

.empty-action-mobile {
  padding: 0.75rem 1.5rem;
  background-color: #70533B;
  color: white;
  border: none;
  border-radius: 0.5rem;
  font-size: 1rem;
}

/* ===== 安全区域适配 ===== */

@supports (padding: max(0px)) {
  .safe-area-bottom {
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
  }
  
  .safe-area-top {
    padding-top: max(1rem, env(safe-area-inset-top));
  }
  
  .safe-area-left {
    padding-left: max(1rem, env(safe-area-inset-left));
  }
  
  .safe-area-right {
    padding-right: max(1rem, env(safe-area-inset-right));
  }
}

/* ===== 打印适配 ===== */

@media print {
  .mobile-menu,
  .mobile-menu-toggle,
  .mobile-menu-overlay,
  .back-to-top,
  .scroll-indicator {
    display: none !important;
  }
  
  .header-mobile {
    position: static;
    transform: none !important;
    box-shadow: none;
  }
  
  .main-content {
    padding-top: 0;
  }
}