/* 移动端优化样式 */

/* 基础响应式设置 */
@media (max-width: 768px) {
  /* 容器和布局优化 */
  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  
  .max-w-7xl {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  
  /* 文字大小优化 */
  .text-6xl {
    font-size: 2.5rem;
    line-height: 1.1;
  }
  
  .text-8xl {
    font-size: 3rem;
    line-height: 1.1;
  }
  
  .text-5xl {
    font-size: 2rem;
    line-height: 1.2;
  }
  
  .text-4xl {
    font-size: 1.75rem;
    line-height: 1.2;
  }
  
  .text-3xl {
    font-size: 1.5rem;
    line-height: 1.3;
  }
  
  .text-2xl {
    font-size: 1.25rem;
    line-height: 1.3;
  }
  
  .text-xl {
    font-size: 1.125rem;
    line-height: 1.4;
  }
  
  /* 按钮优化 */
  .btn-mobile {
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
  }
  
  /* 卡片网格优化 */
  .grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .md\:grid-cols-2 {
    grid-template-columns: 1fr;
  }
  
  .lg\:grid-cols-3 {
    grid-template-columns: 1fr;
  }
  
  .lg\:grid-cols-4 {
    grid-template-columns: 1fr;
  }
  
  /* 间距优化 */
  .py-12 {
    padding-top: 2rem;
    padding-bottom: 2rem;
  }
  
  .py-16 {
    padding-top: 3rem;
    padding-bottom: 3rem;
  }
  
  .py-20 {
    padding-top: 4rem;
    padding-bottom: 4rem;
  }
  
  .mb-16 {
    margin-bottom: 2rem;
  }
  
  .mb-12 {
    margin-bottom: 1.5rem;
  }
  
  .mb-8 {
    margin-bottom: 1rem;
  }
  
  /* 导航优化 */
  .dot-nav {
    display: none !important;
  }
  
  /* 移动端导航菜单 */
  .mobile-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid #e5e7eb;
    padding: 0.5rem;
    z-index: 1000;
    display: flex;
    justify-content: space-around;
    align-items: center;
  }
  
  .mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem;
    text-decoration: none;
    color: #6b7280;
    font-size: 0.75rem;
    transition: all 0.3s ease;
    min-width: 60px;
  }
  
  .mobile-nav-item.active {
    color: #3b82f6;
  }
  
  .mobile-nav-item i {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
  }
  
  /* 返回顶部按钮移动端优化 */
  #backToTop {
    bottom: 80px;
    right: 1rem;
    width: 48px;
    height: 48px;
  }
  
  /* 表单优化 */
  input, textarea, select {
    font-size: 16px; /* 防止iOS缩放 */
    min-height: 44px;
  }
  
  /* 触摸优化 */
  .touch-target {
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* 小屏幕优化 */
@media (max-width: 480px) {
  .container {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
  
  .text-6xl, .text-8xl {
    font-size: 2rem;
    line-height: 1.1;
  }
  
  .text-5xl {
    font-size: 1.75rem;
  }
  
  .text-4xl {
    font-size: 1.5rem;
  }
  
  .text-3xl {
    font-size: 1.25rem;
  }
  
  .px-8 {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  
  .px-10 {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  
  .py-5 {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
  }
  
  /* 按钮组优化 */
  .flex-wrap {
    flex-direction: column;
    align-items: stretch;
  }
  
  .flex-wrap > * {
    width: 100%;
    margin-bottom: 0.75rem;
  }
  
  .flex-wrap > *:last-child {
    margin-bottom: 0;
  }
}

/* 横屏模式优化 */
@media (max-height: 500px) and (orientation: landscape) {
  .min-h-screen {
    min-height: auto;
    padding-top: 2rem;
    padding-bottom: 2rem;
  }
  
  .py-12 {
    padding-top: 1rem;
    padding-bottom: 1rem;
  }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
  .hover\:scale-105:hover {
    transform: none;
  }
  
  .hover\:-translate-y-2:hover {
    transform: none;
  }
  
  .card-hover:hover {
    transform: none;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
  }
  
  /* 移除悬停效果，改为点击效果 */
  .touch-active:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
  }
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
  .bg-white\/80 {
    background-color: white;
  }
  
  .border-white\/50 {
    border-color: #d1d5db;
  }
  
  .text-slate-600 {
    color: #374151;
  }
}

/* 减少动画偏好支持 */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .fade {
    opacity: 1;
    transform: none;
  }
  
  .split-char {
    opacity: 1;
    transform: none;
  }
}

/* 暗色模式支持 */
@media (prefers-color-scheme: dark) {
  .dark-mode-support {
    background-color: #1f2937;
    color: #f9fafb;
  }
  
  .dark-mode-support .bg-white {
    background-color: #374151;
  }
  
  .dark-mode-support .text-slate-800 {
    color: #f9fafb;
  }
  
  .dark-mode-support .text-slate-600 {
    color: #d1d5db;
  }
}

/* 知识点卡片移动端优化 */
@media (max-width: 768px) {
  .knowledge-point {
    padding: 0.75rem;
    font-size: 0.9rem;
    line-height: 1.5;
  }
  
  .knowledge-point-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  
  .subject-header {
    padding: 1rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  
  .subject-icon {
    font-size: 1.5rem;
  }
  
  .subject-name {
    font-size: 1.25rem;
  }
  
  /* 浮动导航移动端优化 */
  .floating-nav {
    display: none;
  }
  
  /* 进度条移动端优化 */
  .progress-container {
    padding: 0.5rem;
  }
  
  .progress-bar {
    height: 6px;
  }
}

/* 表格移动端优化 */
@media (max-width: 768px) {
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  table {
    min-width: 600px;
  }
  
  th, td {
    padding: 0.5rem;
    font-size: 0.875rem;
  }
}

/* 模态框移动端优化 */
@media (max-width: 768px) {
  .modal {
    margin: 1rem;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
  }
  
  .modal-content {
    padding: 1rem;
  }
  
  .modal-header {
    padding: 1rem 1rem 0.5rem;
  }
  
  .modal-footer {
    padding: 0.5rem 1rem 1rem;
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .modal-footer button {
    width: 100%;
  }
}

/* 游戏界面移动端优化 */
@media (max-width: 768px) {
  .game-container {
    padding: 1rem;
    margin: 0.5rem;
  }
  
  .game-board {
    max-width: 100%;
    aspect-ratio: 1;
  }
  
  .game-tile {
    font-size: 1.5rem;
    border-radius: 0.5rem;
  }
  
  .game-controls {
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
  }
  
  .game-score {
    font-size: 1rem;
    padding: 0.5rem 1rem;
  }
}

/* 聊天界面移动端优化 */
@media (max-width: 768px) {
  .chat-container {
    height: calc(100vh - 60px);
    margin-bottom: 60px;
  }
  
  .chat-messages {
    padding: 1rem;
    max-height: calc(100vh - 200px);
  }
  
  .chat-input-container {
    padding: 1rem;
    position: fixed;
    bottom: 60px;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #e5e7eb;
  }
  
  .chat-input {
    font-size: 16px;
    padding: 0.75rem;
  }
  
  .chat-message {
    margin-bottom: 1rem;
    padding: 0.75rem;
    border-radius: 1rem;
  }
}

/* PDF查看器移动端优化 */
@media (max-width: 768px) {
  .pdf-viewer {
    width: 100%;
    height: calc(100vh - 120px);
  }
  
  .pdf-controls {
    padding: 0.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  
  .pdf-page-info {
    font-size: 0.875rem;
    order: -1;
    width: 100%;
    text-align: center;
  }
}

/* 搜索界面移动端优化 */
@media (max-width: 768px) {
  .search-container {
    padding: 1rem;
  }
  
  .search-input {
    font-size: 16px;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
  }
  
  .search-results {
    margin-top: 1rem;
  }
  
  .search-result-item {
    padding: 1rem;
    margin-bottom: 0.75rem;
    border-radius: 0.75rem;
  }
  
  .search-filters {
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
  }
  
  .search-filter {
    width: 100%;
  }
}

/* 加载动画移动端优化 */
@media (max-width: 768px) {
  .loading-spinner {
    width: 2rem;
    height: 2rem;
  }
  
  .loading-text {
    font-size: 0.875rem;
    margin-top: 0.5rem;
  }
}

/* 工具提示移动端优化 */
@media (max-width: 768px) {
  .tooltip {
    display: none;
  }
  
  .tooltip-mobile {
    position: fixed;
    bottom: 100px;
    left: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    text-align: center;
    z-index: 1001;
  }
}

/* 性能优化 */
@media (max-width: 768px) {
  /* 减少阴影和模糊效果 */
  .backdrop-blur-sm {
    backdrop-filter: none;
    background-color: rgba(255, 255, 255, 0.95);
  }
  
  .shadow-xl {
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
  }
  
  .shadow-2xl {
    box-shadow: 0 15px 30px -5px rgba(0, 0, 0, 0.15);
  }
  
  /* 简化渐变 */
  .bg-gradient-to-br {
    background: #f8fafc;
  }
  
  .bg-gradient-to-r {
    background: var(--gradient-fallback, #3b82f6);
  }
}

/* 可访问性增强 */
@media (max-width: 768px) {
  /* 焦点指示器 */
  button:focus,
  a:focus,
  input:focus,
  textarea:focus,
  select:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
  }
  
  /* 跳过链接 */
  .skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #3b82f6;
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 1000;
  }
  
  .skip-link:focus {
    top: 6px;
  }
}

/* 打印样式 */
@media print {
  .no-print {
    display: none !important;
  }
  
  .print-break {
    page-break-before: always;
  }
  
  .print-avoid-break {
    page-break-inside: avoid;
  }
}