/* 统计页面响应式样式 */

/* 超宽屏 (1600px 以上) */
@media (min-width: 1600px) {
  .main-content {
    max-width: 2000px;
    padding: 15px;
  }
  
  .chart-container {
    height: 380px;
  }
}

/* 大屏幕 (1200px 以上) */
@media (min-width: 1200px) {
  .main-content {
    max-width: 1800px;
  }
  
  .stats-overview {
    grid-template-columns: repeat(4, 1fr);
  }
  
  .charts-row {
    grid-template-columns: repeat(3, 1fr) !important;
  }
  
  .chart-container {
    height: 350px;
  }
}

/* 中等屏幕 (768px - 1199px) */
@media (min-width: 768px) and (max-width: 1199px) {
  .main-content {
    max-width: 100%;
    padding: 15px;
  }
  
  .stats-overview {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
  }
  
  .charts-row {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 15px;
  }
  
  .chart-container {
    height: 320px;
  }
}

/* 平板 (768px - 1023px) */
@media (max-width: 1023px) {
  .stats-overview {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
  }
  
  .charts-row {
    grid-template-columns: repeat(1, 1fr) !important;
    gap: 15px;
  }
  
  .chart-container {
    height: 300px;
  }
  
  .overview-card {
    padding: 20px;
  }
  
  .card-icon {
    font-size: 2rem;
    width: 50px;
    height: 50px;
  }
  
  .card-value {
    font-size: 1.8rem;
  }
}

/* 手机 (480px - 767px) */
@media (max-width: 767px) {
  .main-content {
    padding: 10px;
  }
  
  .stats-overview {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  
  .overview-card {
    padding: 15px;
    gap: 15px;
  }
  
  .card-icon {
    font-size: 1.8rem;
    width: 45px;
    height: 45px;
  }
  
  .card-content h3 {
    font-size: 1rem;
  }
  
  .card-value {
    font-size: 1.6rem;
  }
  
  .card-description {
    font-size: 0.8rem;
  }
  
  .chart-card {
    padding: 20px;
  }
  
  .chart-card h3 {
    font-size: 1.2rem;
    margin-bottom: 15px;
  }
  
  .chart-container {
    height: 280px;
  }
  
  .stats-tabs {
    gap: 8px;
  }
  
  .tab-btn {
    padding: 10px 16px;
    font-size: 0.9rem;
  }
  
  .tab-content {
    padding: 20px;
  }
  
  .export-buttons {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  
  .export-btn {
    padding: 12px;
  }
  
  .export-btn span:first-child {
    font-size: 1.3rem;
  }
  
  .export-btn span:last-child {
    font-size: 0.8rem;
  }
}

/* 小手机 (480px 以下) */
@media (max-width: 479px) {
  .main-content {
    padding: 8px;
  }
  
  .stats-overview {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  
  .overview-card {
    padding: 12px;
    gap: 12px;
  }
  
  .card-icon {
    font-size: 1.6rem;
    width: 40px;
    height: 40px;
  }
  
  .card-content h3 {
    font-size: 0.9rem;
  }
  
  .card-value {
    font-size: 1.4rem;
  }
  
  .card-description {
    font-size: 0.75rem;
  }
  
  .chart-card {
    padding: 15px;
  }
  
  .chart-card h3 {
    font-size: 1.1rem;
    margin-bottom: 12px;
  }
  
  .chart-container {
    height: 250px;
  }
  
  .stats-tabs {
    gap: 6px;
  }
  
  .tab-btn {
    padding: 8px 12px;
    font-size: 0.85rem;
  }
  
  .tab-content {
    padding: 15px;
  }
  
  .export-buttons {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  
  .export-btn {
    padding: 10px;
    flex-direction: row;
    justify-content: center;
  }
  
  .export-btn span:first-child {
    font-size: 1.2rem;
  }
  
  .export-btn span:last-child {
    font-size: 0.8rem;
  }
}

/* 超小屏幕 (320px 以下) */
@media (max-width: 319px) {
  .main-content {
    padding: 5px;
  }
  
  .stats-overview {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  
  .overview-card {
    padding: 10px;
    gap: 10px;
  }
  
  .card-icon {
    font-size: 1.4rem;
    width: 35px;
    height: 35px;
  }
  
  .card-content h3 {
    font-size: 0.8rem;
  }
  
  .card-value {
    font-size: 1.2rem;
  }
  
  .card-description {
    font-size: 0.7rem;
  }
  
  .chart-card {
    padding: 12px;
  }
  
  .chart-card h3 {
    font-size: 1rem;
    margin-bottom: 10px;
  }
  
  .chart-container {
    height: 220px;
  }
  
  .stats-tabs {
    gap: 4px;
  }
  
  .tab-btn {
    padding: 6px 10px;
    font-size: 0.8rem;
  }
  
  .tab-content {
    padding: 12px;
  }
}

/* 横屏模式优化 */
@media (orientation: landscape) and (max-height: 600px) {
  /* 移除 header 覆盖，继承全局样式 */
  /* .statistics-page header { padding: 20px 0; } */
  
  /* 移除标题与副标题字号覆盖，继承全局样式 */
  /* .statistics-page header h1 { font-size: 2rem; margin-bottom: 10px; } */
  /* #typing-text { font-size: 1.1rem; } */

  .overview-section {
    margin-bottom: 20px;
  }
  
  .charts-section {
    margin-bottom: 20px;
  }
  
  .detailed-stats-section {
    margin-bottom: 20px;
  }
  
  .export-section {
    margin-bottom: 20px;
  }
}

/* 侧边栏响应式样式 */
@media (max-width: 768px) {
  .sidebar-nav {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    top: auto !important;
    left: auto !important;
    transform: none !important;
    z-index: 9999 !important;
    background: #ffffff !important;
    border-radius: 12px !important;
    padding: 15px 10px !important;
    box-shadow: 
      0 8px 32px rgba(0, 0, 0, 0.12),
      0 4px 16px rgba(0, 0, 0, 0.08) !important;
    border: 1px solid #f0f0f0 !important;
    backdrop-filter: blur(10px) !important;
    cursor: default !important;
    user-select: auto !important;
    transition: box-shadow 0.3s ease !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    max-width: calc(100vw - 40px) !important;
    box-sizing: border-box !important;
    /* 确保侧边栏固定在屏幕右下角，不受页面滚动影响 */
    width: auto !important;
    min-width: 80px !important;
    max-width: 120px !important;
    /* 防止被页面内容遮挡 */
    pointer-events: auto !important;
    /* 确保在视口坐标系中定位 */
    position: fixed !important;
    transform: translateZ(0) !important;
  }
  
  .nav-buttons {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    pointer-events: auto !important;
  }
  
  .nav-btn {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 4px !important;
    padding: 8px 10px !important;
    background: #ffffff !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 8px !important;
    color: #666666 !important;
    text-decoration: none !important;
    font-size: 0.7rem !important;
    font-weight: 500 !important;
    transition: all 0.3s ease !important;
    min-width: 60px !important;
    max-width: 80px !important;
    font-family: 'Noto Serif SC', serif !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
    cursor: pointer !important;
    pointer-events: auto !important;
    user-select: auto !important;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1) !important;
  }
  
  .nav-btn:hover {
    background: #f8f9fa !important;
    border-color: #3498db !important;
    color: #3498db !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.2) !important;
  }
  
  .nav-btn:active {
    transform: translateY(0) !important;
    box-shadow: 0 2px 6px rgba(52, 152, 219, 0.3) !important;
  }
  
  .nav-btn span:first-child {
    font-size: 1.1rem !important;
    margin-bottom: 2px !important;
  }
  
  .nav-btn span:last-child {
    font-size: 0.65rem !important;
    font-weight: 500 !important;
    text-align: center !important;
    line-height: 1.2 !important;
  }
}

@media (max-width: 480px) {
  .sidebar-nav {
    bottom: 15px !important;
    right: 15px !important;
    padding: 12px 8px !important;
    max-width: calc(100vw - 30px) !important;
    min-width: 70px !important;
    max-width: 100px !important;
    /* 确保在小屏幕上也能正确固定在屏幕右下角 */
    position: fixed !important;
    transform: translateZ(0) !important;
  }
  
  .nav-btn {
    padding: 6px 8px !important;
    min-width: 50px !important;
    max-width: 70px !important;
    font-size: 0.65rem !important;
  }
  
  .nav-btn span:first-child {
    font-size: 1rem !important;
  }
  
  .nav-btn span:last-child {
    font-size: 0.6rem !important;
  }
}

/* 小屏幕下的 header 字号（与 svg-icons 一致） */
@media (max-width: 480px) {
  .statistics-page header .header-content h1 { font-size: 2.0rem; }
  .statistics-page #typing-text { font-size: 1.0rem; }
}

/* 打印样式 */
@media print {
  .statistics-page {
    background: white;
  }
  
  .overview-card,
  .chart-card,
  .tab-content,
  .export-card {
    background: white;
    box-shadow: none;
    border: 1px solid #ddd;
  }
  
  .chart-container {
    height: 300px;
  }
  
  .export-section {
    display: none;
  }
  
  .stats-tabs {
    display: none;
  }
  
  .tab-content {
    display: block !important;
    margin-bottom: 20px;
  }
  
  /* 打印时隐藏侧边栏 */
  .sidebar-nav {
    display: none !important;
  }
} 