/**
 * 尘渊文化 - 移动端深度优化样式
 * Mobile-First Design + Touch Optimizations
 * @version 3.0.0
 */

/* ========== CSS自定义属性 - 移动端专属 ========== */
:root {
  /* 触摸反馈颜色 */
  --touch-ripple-color: rgba(144, 202, 249, 0.3);
  --touch-active-bg: rgba(144, 202, 249, 0.1);
  
  /* 移动端间距 */
  --mobile-gap-xs: 8px;
  --mobile-gap-sm: 12px;
  --mobile-gap-md: 16px;
  --mobile-gap-lg: 24px;
  
  /* 安全区域 */
  --safe-area-top: env(safe-area-inset-top);
  --safe-area-bottom: env(safe-area-inset-bottom);
  --safe-area-left: env(safe-area-inset-left);
  --safe-area-right: env(safe-area-inset-right);
  
  /* 底部导航高度 */
  --bottom-nav-height: 64px;
  
  /* 触摸目标最小尺寸 */
  --touch-target-min: 44px;
  --touch-target-comfortable: 48px;
}

/* ========== 基础移动端优化 ========== */
@media (max-width: 768px) {
  html {
    font-size: 16px;
    /* 禁用文本缩放 */
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }
  
  body {
    /* 优化移动端滚动 */
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: none;
    /* 防止水平滚动 */
    overflow-x: hidden;
    /* 底部留白给底部导航 */
    padding-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
  }
  
  /* 禁用双击缩放 */
  * {
    touch-action: manipulation;
  }
}

/* ========== 底部导航栏 ========== */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
  background: rgba(10, 10, 10, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--md-sys-color-outline-variant);
  z-index: 1000;
  padding-bottom: env(safe-area-inset-bottom);
}

@media (max-width: 768px) {
  .bottom-nav {
    display: flex;
    justify-content: space-around;
    align-items: center;
  }
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  height: var(--bottom-nav-height);
  color: var(--md-sys-color-on-surface-variant);
  text-decoration: none;
  font-size: 0.6875rem;
  font-weight: 500;
  gap: 4px;
  position: relative;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.bottom-nav-item::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 56px;
  height: 32px;
  background: var(--touch-ripple-color);
  border-radius: 16px;
  transform: translate(-50%, -50%) scale(0);
  opacity: 0;
  transition: all 0.3s ease;
}

.bottom-nav-item:active::before {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

.bottom-nav-item-icon {
  font-size: 1.5rem;
  line-height: 1;
  transition: transform 0.2s ease;
}

.bottom-nav-item-label {
  line-height: 1;
}

.bottom-nav-item.active {
  color: var(--md-sys-color-primary);
}

.bottom-nav-item.active .bottom-nav-item-icon {
  transform: translateY(-2px);
}

.bottom-nav-item.active::after {
  content: '';
  position: absolute;
  bottom: 6px;
  width: 20px;
  height: 3px;
  background: var(--md-sys-color-primary);
  border-radius: 2px;
}

/* ========== 触摸反馈效果 ========== */
.touch-feedback {
  position: relative;
  overflow: hidden;
}

.touch-feedback::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, var(--touch-ripple-color) 0%, transparent 70%);
  transform: translate(-50%, -50%) scale(0);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  pointer-events: none;
}

.touch-feedback:active::after {
  transform: translate(-50%, -50%) scale(2);
  opacity: 1;
  transition: transform 0.1s ease, opacity 0.1s ease;
}

/* 按钮触摸反馈 */
.mui-btn, .case-link, .contact-card {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.mui-btn:active,
.case-link:active,
.contact-card:active {
  transform: scale(0.96);
}

/* 卡片触摸反馈 */
.case-card, .qual-card, .arch-card, .contact-card {
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s ease, box-shadow 0.3s ease;
}

.case-card:active,
.qual-card:active,
.arch-card:active,
.contact-card:active {
  transform: scale(0.98);
}

/* ========== 移动端导航优化 ========== */
@media (max-width: 768px) {
  .mui-appbar {
    height: 56px;
    padding: 0 16px;
  }
  
  .mui-brand-icon {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }
  
  .mui-brand-text {
    font-size: 1.125rem;
  }
  
  .mui-nav {
    display: none;
  }
  
  /* 汉堡菜单按钮 */
  .mobile-menu-toggle {
    display: flex;
    width: 48px;
    height: 48px;
    justify-content: center;
    align-items: center;
    background: transparent;
    border: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    border-radius: 50%;
    transition: background 0.2s ease;
  }
  
  .mobile-menu-toggle:active {
    background: var(--touch-active-bg);
  }
  
  .hamburger-line {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--md-sys-color-on-surface);
    margin: 3px 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 2px;
  }
  
  /* 全屏菜单 */
  .mobile-menu-panel {
    width: 100%;
    max-width: 100%;
    background: rgba(10, 10, 10, 0.98);
  }
  
  .mobile-nav-item {
    padding: 18px 24px;
    font-size: 1.125rem;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    display: flex;
    align-items: center;
    gap: 16px;
  }
  
  .mobile-nav-item::before {
    content: attr(data-icon);
    font-size: 1.25rem;
    opacity: 0.7;
  }
  
  .mobile-nav-item-primary {
    margin: 24px;
    border-radius: var(--radius-lg);
    justify-content: center;
    border: none;
  }
}

/* ========== Hero区域移动端优化 ========== */
@media (max-width: 768px) {
  .hero-enterprise {
    min-height: 100svh;
    padding: 80px 16px 40px;
    padding-top: calc(56px + 24px);
  }
  
  .hero-title-enterprise {
    font-size: clamp(1.75rem, 8vw, 2.5rem);
    letter-spacing: -0.5px;
    line-height: 1.3;
  }
  
  .hero-subtitle-enterprise {
    font-size: 1rem;
    line-height: 1.7;
    margin-bottom: 32px;
  }
  
  .hero-badge-enterprise {
    padding: 8px 16px;
    font-size: 0.8125rem;
    margin-bottom: 24px;
  }
  
  .hero-actions {
    flex-direction: column;
    width: 100%;
  }
  
  .hero-actions .mui-btn {
    width: 100%;
    justify-content: center;
    padding: 14px 24px;
    font-size: 0.9375rem;
  }
}

/* ========== 内容区域移动端优化 ========== */
@media (max-width: 768px) {
  .mui-container {
    padding: 0 16px;
  }
  
  /* 资质卡片 */
  .qualifications-section {
    padding: 60px 0;
  }
  
  .qual-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 32px;
  }
  
  .qual-card {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    text-align: left;
  }
  
  .qual-icon {
    width: 48px;
    height: 48px;
    font-size: 1.5rem;
    margin: 0;
    flex-shrink: 0;
  }
  
  .qual-title {
    font-size: 0.9375rem;
    margin: 0;
  }
  
  /* 技术架构 */
  .tech-arch-section {
    padding: 60px 0;
  }
  
  .arch-grid {
    grid-template-columns: 1fr;
    gap: 16px;
    margin-top: 32px;
  }
  
  .arch-card {
    padding: 24px 20px;
  }
  
  .arch-number {
    font-size: 2rem;
  }
  
  .arch-title {
    font-size: 1.125rem;
  }
  
  .arch-desc {
    font-size: 0.875rem;
    line-height: 1.7;
  }
  
  /* 服务表格 */
  .services-section {
    padding: 60px 0;
  }
  
  .service-table {
    display: block;
    margin-top: 32px;
    border-radius: var(--radius-lg);
  }
  
  .service-table thead {
    display: none;
  }
  
  .service-table tbody,
  .service-table tr,
  .service-table td {
    display: block;
    width: 100%;
  }
  
  .service-table tr {
    margin-bottom: 16px;
    background: var(--md-sys-color-surface-container);
    border-radius: var(--radius-md);
    padding: 20px;
    border: 1px solid var(--md-sys-color-outline-variant);
  }
  
  .service-table td {
    padding: 0;
    border: none;
    margin-bottom: 8px;
  }
  
  .service-table td:last-child {
    margin-bottom: 0;
    padding-top: 8px;
    border-top: 1px solid var(--md-sys-color-outline-variant);
    font-size: 0.8125rem;
    color: var(--md-sys-color-primary);
  }
  
  .service-table td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: 4px;
  }
  
  /* 案例网格 */
  .cases-section {
    padding: 60px 0;
  }
  
  .cases-grid {
    grid-template-columns: 1fr;
    gap: 16px;
    margin-top: 32px;
  }
  
  .case-card {
    padding: 20px;
  }
  
  .case-tag {
    font-size: 0.6875rem;
    padding: 4px 10px;
  }
  
  .case-title {
    font-size: 1rem;
  }
  
  .case-desc {
    font-size: 0.875rem;
    line-height: 1.6;
  }
  
  /* 联系卡片 */
  .contact-section {
    padding: 60px 0;
  }
  
  .contact-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 32px;
  }
  
  .contact-card {
    padding: 20px 12px;
  }
  
  .contact-icon {
    width: 44px;
    height: 44px;
    font-size: 1.25rem;
    margin-bottom: 12px;
  }
  
  .contact-label {
    font-size: 0.75rem;
    margin-bottom: 4px;
  }
  
  .contact-value {
    font-size: 0.8125rem;
    word-break: break-all;
  }
  
  /* Footer */
  footer {
    padding: 40px 0 100px !important;
  }
  
  footer .mui-container > div {
    flex-direction: column;
    text-align: center;
    gap: 16px;
  }
}

@media (max-width: 375px) {
  .contact-grid {
    grid-template-columns: 1fr;
  }
}

/* ========== 标题移动端适配 ========== */
@media (max-width: 768px) {
  .mui-headline-small {
    font-size: 1.5rem;
  }
  
  .mui-body-large {
    font-size: 0.9375rem;
  }
  
  .section-tag {
    font-size: 0.6875rem;
    padding: 6px 14px;
  }
}

/* ========== 滚动显示动画移动端优化 ========== */
@media (max-width: 768px) {
  .reveal,
  .reveal-left,
  .reveal-right,
  .reveal-scale {
    opacity: 1;
    transform: none;
  }
  
  /* 简单的淡入动画替代 */
  .reveal.animate-mobile {
    animation: fadeInMobile 0.4s ease-out;
  }
  
  @keyframes fadeInMobile {
    from {
      opacity: 0;
      transform: translateY(10px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}

/* ========== 手势滑动指示器 ========== */
.swipe-hint {
  display: none;
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  animation: swipeHint 2s ease-in-out infinite;
}

@media (max-width: 768px) {
  .swipe-hint {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.75rem;
  }
  
  .swipe-hint-icon {
    width: 40px;
    height: 40px;
    border: 2px solid var(--md-sys-color-outline);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
  }
}

@keyframes swipeHint {
  0%, 100% {
    transform: translateX(-50%) translateX(-5px);
    opacity: 0.5;
  }
  50% {
    transform: translateX(-50%) translateX(5px);
    opacity: 1;
  }
}

/* ========== 快速操作按钮（FAB） ========== */
.fab-container {
  display: none;
  position: fixed;
  bottom: calc(var(--bottom-nav-height) + 16px + env(safe-area-inset-bottom));
  right: 16px;
  z-index: 999;
  flex-direction: column;
  gap: 12px;
}

@media (max-width: 768px) {
  .fab-container {
    display: flex;
  }
}

.fab {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.fab:active {
  transform: scale(0.92);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.fab-secondary {
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
}

/* ========== 触摸滑动优化 ========== */
.swipe-container {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.swipe-container::-webkit-scrollbar {
  display: none;
}

.swipe-item {
  scroll-snap-align: start;
  flex-shrink: 0;
}

/* ========== 输入框移动端优化 ========== */
@media (max-width: 768px) {
  input,
  textarea,
  select {
    font-size: 16px !important;
    /* 防止iOS缩放 */
  }
  
  input:focus,
  textarea:focus,
  select:focus {
    /* 优化焦点状态 */
    outline: none;
    box-shadow: 0 0 0 2px var(--md-sys-color-primary);
  }
}

/* ========== 加载状态移动端优化 ========== */
@media (max-width: 768px) {
  .page-loader .loader {
    width: 40px;
    height: 40px;
    border-width: 2px;
  }
  
  .skeleton {
    background-size: 300% 100%;
  }
}

/* ========== 模态框/弹窗移动端优化 ========== */
@media (max-width: 768px) {
  .modal-content,
  .mobile-menu-panel {
    margin: 0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-height: 90vh;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  .mobile-menu.active .mobile-menu-panel {
    transform: translateY(0);
  }
  
  /* 底部滑动手柄 */
  .bottom-sheet-handle {
    width: 36px;
    height: 4px;
    background: var(--md-sys-color-outline);
    border-radius: 2px;
    margin: 12px auto;
  }
}

/* ========== 横屏模式优化 ========== */
@media (max-height: 500px) and (orientation: landscape) {
  .hero-enterprise {
    min-height: auto;
    padding: 100px 16px 60px;
  }
  
  .bottom-nav {
    display: none;
  }
  
  body {
    padding-bottom: 0;
  }
  
  .qual-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .contact-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ========== 暗黑模式适配 ========== */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
  }
}

/* ========== 减少动画偏好 ========== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  
  .swipe-hint {
    display: none;
  }
}

/* ========== 高对比度模式 ========== */
@media (prefers-contrast: high) {
  .bottom-nav-item.active::after {
    height: 4px;
  }
  
  .touch-feedback::after {
    background: var(--md-sys-color-primary);
    opacity: 0.5;
  }
}

/* ========== 打印样式 ========== */
@media print {
  .bottom-nav,
  .fab-container,
  .mobile-menu-toggle,
  .swipe-hint {
    display: none !important;
  }
  
  body {
    padding-bottom: 0;
  }
}
