/* 移动端专用优化样式 */
@media (max-width: 768px) {
    /* 基础调整 */
    html {
        font-size: 14px;
    }
    
    /* 卡片悬停效果在移动端简化 */
    .movie-card:hover,
    .stat-card:hover,
    .year-card:hover {
        transform: none;
        box-shadow: var(--card-shadow);
    }
    
    /* 触摸友好的按钮 */
    button, 
    .btn,
    .nav-item,
    .menu-item,
    .edit-btn,
    .filter-btn {
        min-height: 44px; /* 苹果推荐的最小触摸目标尺寸 */
        min-width: 44px;
    }
    
    /* 电影卡片触摸优化 */
    .movie-card {
        cursor: pointer;
        -webkit-touch-callout: none;
        user-select: none;
    }
    
    /* 进度条触摸区域 */
    .progress-bar {
        height: 12px;
    }
    
    /* 导航栏优化 */
    .main-nav {
        padding: 10px 0;
        margin: 0 -20px;
        padding-left: 20px;
    }
    
    /* 筛选器表单优化 */
    .filter-form input,
    .filter-form select,
    .filter-form button {
        font-size: 16px; /* 防止iOS缩放 */
        padding: 16px;
    }
    
    /* 电影标题行数控制 */
    .movie-title {
        -webkit-line-clamp: 2;
        line-clamp: 2;
    }
    
    /* 底部浮动按钮优化 */
    .fab-container {
        bottom: 20px;
        right: 20px;
    }
    
    .fab {
        width: 60px;
        height: 60px;
        font-size: 24px;
    }
    
    /* 滚动条隐藏但保持可滚动 */
    .main-nav,
    .years-grid,
    .movies-grid {
        -webkit-overflow-scrolling: touch;
    }
    
    /* 长按菜单 */
    .movie-card:active {
        background-color: rgba(0, 0, 0, 0.05);
        transform: scale(0.98);
        transition: transform 0.1s;
    }
    
    /* 避免300ms点击延迟 */
    a, button, input, select, textarea, label {
        touch-action: manipulation;
    }
}

/* 平板设备优化 */
@media (min-width: 769px) and (max-width: 1024px) {
    .movies-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .years-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* 超小屏幕设备 */
@media (max-width: 360px) {
    .app-title {
        font-size: 16px;
    }
    
    .stat-card {
        padding: 12px;
    }
    
    .stat-number {
        font-size: 18px;
    }
    
    .movie-content {
        padding: 12px;
    }
    
    .movie-footer {
        padding: 10px 12px;
    }
}

/* 横屏模式优化 */
@media (max-height: 500px) and (orientation: landscape) {
    .app-header {
        position: static;
    }
    
    .stats-grid {
        grid-template-columns: repeat(6, 1fr);
    }
    
    .stat-card {
        padding: 10px;
    }
    
    .stat-icon {
        width: 30px;
        height: 30px;
        font-size: 14px;
        margin-bottom: 5px;
    }
    
    .stat-number {
        font-size: 16px;
    }
}

/* 深色模式系统偏好 */
@media (prefers-color-scheme: dark) {
    :root {
        --light-color: #2d3748;
        --dark-color: #e0e0e0;
        --gray-color: #a0aec0;
    }
    
    body:not(.light-mode) {
        background: #121212;
        color: #e0e0e0;
    }
    
    body:not(.light-mode) .app-container {
        background: #1e1e1e;
    }
    
    body:not(.light-mode) .movie-card,
    body:not(.light-mode) .stat-card,
    body:not(.light-mode) .year-card {
        background: #2d3748;
        border-color: #4a5568;
    }
}

/* 打印样式 */
@media print {
    .app-header,
    .fab-container,
    .app-footer,
    .filters-container,
    .mobile-menu-btn {
        display: none;
    }
    
    .movie-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    body {
        background: white;
        color: black;
    }
}

/* 减少运动偏好 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .movie-card {
        animation: none;
    }
    
    .progress-fill {
        transition: none;
    }
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
    .movie-card {
        border: 2px solid currentColor;
    }
    
    .progress-fill {
        background: currentColor;
    }
}