/* 平板设备 (768px - 1024px) */
@media (max-width: 1024px) {
    .container {
        padding: 0 15px;
    }
    
    .software-grid {
        -ms-grid-columns: (minmax(280px, 1fr))[auto-fill];
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 1.5rem;
    }
    
    .banner h2 {
        font-size: 2rem;
    }
    
    .banner p {
        font-size: 1.1rem;
    }
    
    .footer-content {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 1.5rem;
    }
}

/* 大屏手机 (576px - 768px) */
@media (max-width: 768px) {
    .header .container {
        -webkit-box-orient: vertical;
        -webkit-box-direction: normal;
        -ms-flex-direction: column;
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav ul {
        gap: 1rem;
    }
    
    .banner {
        padding: 3rem 0;
    }
    
    .banner h2 {
        font-size: 1.8rem;
    }
    
    .banner p {
        font-size: 1rem;
    }
    
    /* 软件列表布局适配 */
    .software-layout {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .sidebar {
        position: static;
        order: 2;
    }
    
    .software-content {
        order: 1;
    }
    
    .software-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1rem;
    }
    
    .news-item {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 1.5rem;
    }
    
    .news-image {
        height: 250px;
    }
    
    .news-meta {
        gap: 1rem;
    }
    
    .news-title a {
        font-size: 1.2rem;
    }
    
    .news-excerpt {
        font-size: 0.95rem;
    }
    
    .detail-meta {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

/* 小屏手机 (小于576px) */
@media (max-width: 576px) {
    .container {
        padding: 0 10px;
    }
    
    .header {
        padding: 0.5rem 0;
    }
    
    .logo h1 {
        font-size: 1.5rem;
    }
    
    .nav ul {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
    }
    
    .nav a {
        padding: 0.25rem 0.5rem;
        font-size: 0.9rem;
    }
    
    .banner {
        padding: 2rem 0;
        margin-bottom: 2rem;
    }
    
    .banner h2 {
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
    }
    
    .banner p {
        font-size: 0.9rem;
    }
    
    .section-title {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }
    
    /* 软件列表布局适配 */
    .software-layout {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .sidebar {
        position: static;
        order: 2;
    }
    
    .software-content {
        order: 1;
        padding: 1rem;
    }
    
    .software-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .software-info {
        padding: 1rem;
    }
    
    .software-meta {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .news-item {
        padding: 1rem;
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .news-image {
        height: 200px;
    }
    
    .news-meta {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .news-date, .news-author, .news-views {
        align-self: flex-start;
    }
    
    .news-title a {
        font-size: 1.1rem;
    }
    
    .news-excerpt {
        font-size: 0.9rem;
        -webkit-line-clamp: 2;
    }
    
    .read-more {
        align-self: stretch;
        text-align: center;
        padding: 0.5rem 1rem;
    }
    
    .detail-header {
        padding: 1rem;
    }
    
    .detail-title {
        font-size: 1.5rem;
    }
    
    .pagination {
        flex-wrap: wrap;
        gap: 0.25rem;
    }
    
    .page-link {
        padding: 0.25rem 0.5rem;
        font-size: 0.9rem;
    }
    
    .table {
        font-size: 0.9rem;
    }
    
    .table th,
    .table td {
        padding: 0.5rem;
    }
    
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
}

/* 超小屏设备 (小于400px) */
@media (max-width: 400px) {
    .container {
        padding: 0 5px;
    }
    
    .banner h2 {
        font-size: 1.3rem;
    }
    
    .banner p {
        font-size: 0.8rem;
    }
    
    .section-title {
        font-size: 1.3rem;
    }
    
    /* 软件列表超小屏适配 */
    .software-layout {
        gap: 0.5rem;
    }
    
    .software-content {
        padding: 0.5rem;
    }
    
    .software-grid {
        gap: 0.75rem;
    }
    
    .software-item {
        border-radius: 8px;
    }
    
    .software-image {
        height: 150px;
    }
    
    .software-info {
        padding: 0.75rem;
    }
    
    .software-info h3 {
        font-size: 1.1rem;
        margin-bottom: 0.75rem;
    }
    
    .software-info h3 a {
        font-size: 1rem;
    }
    
    .software-desc {
        font-size: 0.9rem;
        margin-bottom: 1rem;
        -webkit-line-clamp: 2;
    }
    
    .software-category {
        font-size: 0.7rem;
        padding: 0.3rem 0.6rem;
        margin-bottom: 0.75rem;
    }
    
    .news-content h3 {
        font-size: 1.1rem;
    }
    
    .detail-title {
        font-size: 1.3rem;
    }
}

/* 横屏手机优化 */
@media (max-height: 500px) and (orientation: landscape) {
    .header {
        position: static;
    }
    
    .banner {
        padding: 1.5rem 0;
    }
    
    .main {
        min-height: auto;
        padding: 1rem 0;
    }
}

/* 高DPI屏幕优化 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .software-image img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* 打印样式 */
@media print {
    .header,
    .footer,
    .nav,
    .download-btn,
    .pagination {
        display: none;
    }
    
    body {
        background: white;
        color: #fff;
        font-size: 12pt;
        line-height: 1.4;
    }
    
    .container {
        max-width: none;
        margin: 0;
        padding: 0;
    }
    
    .software-item {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
        margin-bottom: 1rem;
    }
    
    a {
        color: black;
        text-decoration: underline;
    }
    
    a[href]:after {
        content: " (" attr(href) ")";
        font-size: 10pt;
        color: #666;
    }
}

/* 减少动画偏好设置 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .software-item:hover {
        transform: none;
    }
    
    .software-item:hover .software-image img {
        transform: none;
    }
}

/* 暗色模式支持 */
@media (prefers-color-scheme: dark) {
    :root {
        --text-color: #e0e0e0;
        --text-light: #a0a0a0;
        --bg-color: #1a1a1a;
        --bg-light: #2a2a2a;
        --border-color: #404040;
        --shadow: 0 2px 10px rgba(0,0,0,0.3);
    }
    
    body {
        background-color: #fff;
        color:#333;
    }
    
    .software-item,
    .news-list,
    .detail-header {
        background: #fff;
    }
    
    .table th {
        background: #2a2a2a;
    }
    
    .form-control {
        background: var(--bg-light);
        border-color: #404040;
        color: var(--text-color);
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    .software-item:hover {
        transform: none;
    }
    
    .nav a:hover {
        background: transparent;
    }
    
    .software-item:active {
        transform: scale(0.98);
    }
    
    .nav a:active {
        background: var(--primary-color);
    }
}

/* 打印样式 */
@media print {
    .header,
    .footer,
    .nav,
    .banner {
        display: none;
    }
    
    .main {
        min-height: auto;
        padding: 0;
    }
    
    .container {
        max-width: none;
        padding: 0;
    }
    
    body {
        background: white;
        color: #fff;
        font-size: 12pt;
        line-height: 1.4;
    }
    
    a {
        color: black;
        text-decoration: underline;
    }
    
    .software-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .software-item {
        box-shadow: none;
        border: 1px solid #ccc;
        page-break-inside: avoid;
    }
}

/* 高分辨率屏幕优化 */
@media (min-resolution: 192dpi) {
    .software-image img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* 横屏模式优化 */
@media (max-height: 500px) and (orientation: landscape) {
    .header {
        position: static;
    }
    
    .main {
        min-height: auto;
    }
    
    .banner {
        padding: 2rem 0;
    }
}

/* 减少动画（用户偏好） */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .software-item:hover {
        transform: none;
    }
    
    .software-image img {
        transition: none;
    }
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #0000ff;
        --secondary-color: #000000;
        --text-color: #000000;
        --border-color: #000000;
    }
    
    .software-item {
        border: 2px solid var(--border-color);
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    :root {
        --text-color: #e0e0e0;
        --text-light: #b0b0b0;
        --bg-color: #1a1a1a;
        --bg-light: #2a2a2a;
        --border-color: #404040;
    }
    
    .software-item,
    .news-list {
        background: #fff;
    }
}