/* 响应式布局 */

@media (max-width: 1200px) {
    :root {
        --container-max: 100%;
        --container-padding: 1.5rem;
    }

    .featured-card {
        flex: 0 0 calc(33.333% - 1rem);
    }
}

@media (max-width: 992px) {
    .featured-card {
        flex: 0 0 calc(50% - 0.75rem);
        min-width: 260px;
    }

    .tool-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .tool-header {
        flex-direction: column;
    }

    .tool-header-icon {
        width: 64px;
        height: 64px;
    }
}

@media (max-width: 768px) {
    :root {
        --container-padding: 1rem;
    }

    .section {
        padding: 2rem 0;
    }

    .section-title {
        font-size: 1.5rem;
    }

    /* 工具网格 */
    .tool-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    /* 卡片样式 */
    .card {
        padding: 1rem;
    }

    .card-icon {
        width: 40px;
        height: 40px;
    }

    .card-title {
        font-size: 1rem;
    }

    /* 分类导航 */
    .category-nav {
        gap: 0.5rem;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 1rem;
        -webkit-overflow-scrolling: touch;
    }

    .category-btn {
        flex-shrink: 0;
        padding: 0.5rem 0.875rem;
        font-size: 0.8125rem;
    }

    /* 轮播 */
    .featured-card {
        flex: 0 0 calc(100% - 2rem);
        min-width: auto;
    }

    .carousel-nav {
        display: none;
    }

    /* 搜索框 */
    .search-box {
        order: 2;
        max-width: 100%;
        flex-basis: 100%;
        margin-top: 0.75rem;
    }

    /* 头部布局 */
    .header-inner {
        flex-wrap: wrap;
    }

    .main-nav {
        display: none;
        width: 100%;
        order: 3;
        margin-top: 1rem;
    }

    .main-nav.active {
        display: block;
    }

    .main-nav ul {
        flex-direction: column;
        gap: 0;
    }

    .main-nav a {
        display: block;
        padding: 0.75rem 0;
        border-bottom: 1px solid var(--color-border);
    }

    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        padding: 0;
        background: var(--color-bg-secondary);
        border: 1px solid var(--color-border);
        border-radius: var(--radius-md);
        color: var(--color-text);
        cursor: pointer;
    }

    /* 筛选栏 */
    .filter-bar {
        flex-direction: column;
        gap: 0.75rem;
    }

    .filter-group {
        width: 100%;
    }

    .filter-select {
        flex: 1;
        width: 100%;
    }

    /* 侧边栏 */
    .sidebar {
        margin-top: 2rem;
    }

    /* 分页 */
    .pagination {
        flex-wrap: wrap;
    }

    .page-numbers {
        flex-wrap: wrap;
        justify-content: center;
    }

    /* 优缺点 */
    .pros-cons {
        grid-template-columns: 1fr;
    }

    /* 工具详情 */
    .tool-header-title {
        font-size: 1.5rem;
    }

    .tool-header-actions {
        flex-direction: column;
    }

    .tool-header-actions .btn {
        width: 100%;
    }

    /* 文章卡片 */
    .post-card {
        flex-direction: column;
    }

    .post-card-thumbnail {
        width: 100%;
        height: 160px;
    }

    /* 工具评分 */
    .rating {
        flex-wrap: wrap;
    }

    /* 页面标题 */
    .page-header-title {
        font-size: 1.5rem;
    }

    /* 用户中心 */
    .user-center-nav {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .user-center-nav a {
        flex-shrink: 0;
    }

    /* 悬浮按钮 */
    .float-consult-btn {
        width: 48px;
        height: 48px;
        right: 1rem;
        bottom: 1rem;
    }
}

@media (max-width: 480px) {
    .tool-grid {
        grid-template-columns: 1fr;
    }

    .section-title {
        font-size: 1.25rem;
    }

    .card {
        padding: 0.875rem;
    }

    .card-icon {
        width: 36px;
        height: 36px;
    }

    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.8125rem;
    }

    /* 工具详情页按钮 */
    .tool-header-actions .btn {
        padding: 0.75rem 1rem;
    }

    /* 优缺点列表 */
    .pros-list,
    .cons-list {
        padding: 1rem;
    }

    .pros-title,
    .cons-title {
        font-size: 0.9375rem;
    }

    /* 分页 */
    .pagination a,
    .pagination span {
        min-width: 36px;
        height: 36px;
        font-size: 0.8125rem;
    }

    /* 底部版权 */
    .site-footer {
        padding: 1.5rem 0;
        font-size: 0.8125rem;
    }

    /* 广告位 */
    .ad-slot {
        margin: 1rem 0;
    }
}

/* 平板横屏 */
@media (max-width: 1024px) and (orientation: landscape) {
    .tool-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .featured-card {
        flex: 0 0 calc(50% - 0.75rem);
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    /* 禁用hover效果 */
    .card:hover {
        transform: none;
    }

    .featured-card:hover {
        transform: none;
    }

    .post-card:hover {
        border-color: var(--color-border);
        box-shadow: none;
    }

    /* 启用触摸反馈 */
    .btn:active,
    .category-btn:active,
    .favorite-btn:active {
        opacity: 0.8;
    }
}

/* 打印样式 */
@media print {
    .site-header,
    .float-consult-btn,
    .ad-slot,
    .pagination,
    .sidebar,
    .breadcrumb {
        display: none !important;
    }

    .tool-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    body {
        font-size: 12pt;
        line-height: 1.5;
        color: #000;
        background: #fff;
    }

    a {
        color: #000;
        text-decoration: underline;
    }
}
