/* 响应式设计样式 */

/* 大屏幕设备 (1200px+) */
@media (min-width: 1200px) {
    .container {
        max-width: 1200px;
    }
    
    .hero-content h2 {
        font-size: 3rem;
    }
    
    .materials-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* 中等屏幕设备 (768px - 1199px) */
@media (min-width: 768px) and (max-width: 1199px) {
    .container {
        max-width: 960px;
    }
    
    .materials-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .analysis-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 小屏幕设备 (480px - 767px) */
@media (min-width: 480px) and (max-width: 767px) {
    .container {
        padding: 0 15px;
    }

    .header-content {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .nav-list {
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem;
    }

    .hero-content {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .hero-text {
        margin-bottom: 2rem;
    }

    .hero-content h2 {
        font-size: 2rem;
    }

    .hero-content p {
        font-size: 1rem;
    }

    .search-box {
        flex-direction: column;
        gap: 1rem;
        margin: 0 auto;
    }

    .hero-stats {
        display: none;
    }

    .material-cards {
        grid-template-columns: 1fr;
    }

    .materials-grid {
        grid-template-columns: 1fr;
    }

    .time-range-selector {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .time-btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }

    .analysis-stats {
        grid-template-columns: 1fr;
    }

    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .modal-content {
        width: 95%;
        padding: 1.5rem;
        margin: 10% auto;
    }

    .back-to-top {
        width: 45px;
        height: 45px;
        bottom: 25px;
        right: 25px;
        font-size: 1.3rem;
    }

    .toast {
        max-width: 350px;
        left: 20px;
        right: 20px;
    }
}

/* 超小屏幕设备 (320px - 479px) */
@media (max-width: 479px) {
    .container {
        padding: 0 10px;
    }

    .logo h1 a {
        font-size: 1.5rem;
    }

    .logo p {
        font-size: 0.8rem;
    }

    .nav-list {
        flex-direction: column;
        gap: 0.5rem;
    }

    .hero {
        padding: 2rem 0;
    }

    .hero-content {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .hero-text {
        margin-bottom: 1.5rem;
    }

    .hero-stats {
        display: none;
    }

    .hero-content h2 {
        font-size: 1.6rem;
        line-height: 1.3;
    }

    .hero-content p {
        font-size: 0.9rem;
    }

    .search-box input {
        padding: 0.8rem 1rem;
    }

    .search-box button {
        padding: 0.8rem 1.5rem;
    }

    .featured-materials,
    .materials-section {
        padding: 2rem 0;
    }

    .featured-materials h2,
    .materials-section h2 {
        font-size: 1.4rem;
        margin-bottom: 2rem;
    }

    .section-header p {
        font-size: 0.9rem;
    }

    .material-card,
    .material-category {
        padding: 1rem;
    }

    .material-card h3 {
        font-size: 1.1rem;
    }

    .material-card .price {
        font-size: 1.4rem;
    }

    .material-category h3 {
        font-size: 1.1rem;
    }

    .time-range-selector {
        gap: 0.3rem;
    }

    .time-btn {
        padding: 0.5rem 0.8rem;
        font-size: 0.8rem;
    }

    .chart-container {
        padding: 1rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-card .value {
        font-size: 1.2rem;
    }

    .footer {
        padding: 2rem 0 1rem;
    }

    .footer-section h3 {
        font-size: 1rem;
    }

    .footer-section p {
        font-size: 0.9rem;
    }

    .modal-content {
        width: 98%;
        padding: 1rem;
        margin: 5% auto;
    }

    .back-to-top {
        width: 40px;
        height: 40px;
        bottom: 20px;
        right: 20px;
        font-size: 1.2rem;
    }

    .toast {
        max-width: 300px;
        left: 10px;
        right: 10px;
        padding: 1rem;
    }

    .toast-icon {
        font-size: 1.3rem;
    }

    .toast-message {
        font-size: 0.9rem;
    }
}

/* 打印样式 */
@media print {
    .header,
    .nav,
    .hero,
    .footer {
        display: none;
    }
    
    .materials-section {
        background: white !important;
        box-shadow: none !important;
    }
    
    .material-card,
    .material-category {
        box-shadow: none !important;
        border: 1px solid #ddd;
    }
    
    .chart-container {
        page-break-inside: avoid;
    }
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
    .material-card,
    .material-category,
    .modal-content {
        border: 2px solid #000;
    }
    
    .nav-list a:hover {
        background: #000;
        color: #fff;
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #1a1a1a;
        color: #e0e0e0;
    }
    
    .header {
        background: #2d2d2d;
        box-shadow: 0 2px 10px rgba(255,255,255,0.1);
    }
    
    .logo h1 a {
        color: #e0e0e0;
    }
    
    .logo p {
        color: #a0a0a0;
    }
    
    .nav-list a {
        color: #e0e0e0;
    }
    
    .nav-list a:hover {
        color: #3498db;
    }
    
    .hero {
        background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    }
    
    .featured-materials,
    .materials-section,
    .analysis-section {
        background: #2d2d2d;
    }
    
    .material-card,
    .material-category,
    .chart-container,
    .stat-card,
    .modal-content {
        background: #1a1a1a;
        color: #e0e0e0;
    }
    
    .material-list a:hover {
        background: #3d3d3d;
    }
    
    .time-btn {
        background: #2d2d2d;
        color: #e0e0e0;
        border-color: #3498db;
    }
    
    .time-btn:hover,
    .time-btn.active {
        background: #3498db;
        color: #fff;
    }
}

/* 减少动画效果（针对用户偏好） */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    @keyframes modalSlideIn {
        from { opacity: 0; }
        to { opacity: 1; }
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    .nav-list a,
    .material-list a,
    .material-card {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    .search-box button,
    .time-btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .close {
        font-size: 2.5rem;
        padding: 0.5rem;
    }
}

/* 横屏模式优化 */
@media (orientation: landscape) and (max-height: 600px) {
    .hero {
        padding: 2rem 0;
    }
    
    .hero-content h2 {
        font-size: 2rem;
        margin-bottom: 0.5rem;
    }
    
    .hero-content p {
        margin-bottom: 1rem;
    }
    
    .modal-content {
        margin: 2% auto;
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* 大字体支持 */
@media (min-resolution: 120dpi) {
    body {
        font-size: 18px;
    }
    
    .logo h1 a {
        font-size: 2rem;
    }
    
    .hero-content h2 {
        font-size: 2.8rem;
    }
}