/**
 * 响应式优化样式
 * 适配手机端、平板端、桌面端
 */

/* ========================================
   手机端（< 768px）
   ======================================== */

@media (max-width: 768px) {
    /* 全局容器 */
    .container {
        padding: 0 1rem;
    }
    
    /* 头部导航 */
    .navbar {
        padding: 0.5rem 1rem;
    }
    
    .navbar-menu {
        display: none;
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        bottom: 0;
        background: var(--bg-primary);
        flex-direction: column;
        padding: 1rem;
        z-index: 999;
        overflow-y: auto;
    }
    
    .navbar-menu.active {
        display: flex;
    }
    
    .navbar-toggle {
        display: block;
    }
    
    /* 页脚 */
    .footer {
        padding: 2rem 1rem;
    }
    
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    /* 首页英雄区 */
    .hero {
        padding: 3rem 1rem;
        text-align: center;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    /* 卡片网格 */
    .grid-4,
    .grid-3,
    .album-grid,
    .article-grid,
    .encyclopedia-grid,
    .library-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    /* 卡片 */
    .card,
    .album-card,
    .article-card,
    .encyclopedia-card,
    .library-card {
        margin-bottom: 1rem;
    }
    
    .card-cover,
    .album-cover,
    .article-cover,
    .encyclopedia-cover,
    .library-cover {
        height: 200px;
    }
    
    /* 详情页 */
    .detail-layout,
    .library-detail-layout,
    .article-detail-layout {
        flex-direction: column;
    }
    
    .detail-sidebar,
    .library-sidebar,
    .article-sidebar {
        order: -1;
        margin-bottom: 2rem;
    }
    
    /* 图片标准 */
    .image-standards {
        grid-template-columns: 1fr;
    }
    
    .image-standard-preview {
        height: 150px;
    }
    
    /* 搜索页 */
    .search-box {
        flex-direction: column;
    }
    
    .search-box input {
        width: 100%;
    }
    
    .search-filters {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    /* 表单 */
    .form-row {
        flex-direction: column;
    }
    
    .form-col {
        width: 100%;
    }
    
    /* 按钮组 */
    .btn-group {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-group .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    /* 模态框 */
    .modal-content {
        width: 95%;
        margin: 1rem auto;
        padding: 1rem;
    }
    
    /* 分页 */
    .pagination {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* ========================================
   平板端（768px - 1024px）
   ======================================== */

@media (min-width: 768px) and (max-width: 1024px) {
    /* 容器 */
    .container {
        padding: 0 2rem;
    }
    
    /* 卡片网格 */
    .grid-4,
    .album-grid,
    .library-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .grid-3,
    .article-grid,
    .encyclopedia-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* 英雄区 */
    .hero-title {
        font-size: 2.5rem;
    }
    
    /* 详情页布局 */
    .detail-layout,
    .library-detail-layout {
        flex-direction: column;
    }
    
    .detail-sidebar,
    .library-sidebar {
        order: -1;
        margin-bottom: 2rem;
    }
    
    /* 图片标准 */
    .image-standards {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ========================================
   桌面端（> 1024px）
   ======================================== */

@media (min-width: 1024px) {
    /* 容器最大宽度 */
    .container {
        max-width: 1200px;
        margin: 0 auto;
    }
    
    /* 详情页布局 */
    .detail-layout,
    .library-detail-layout,
    .article-detail-layout {
        display: flex;
        gap: 2rem;
    }
    
    .detail-main,
    .library-main,
    .article-main {
        flex: 1;
        min-width: 0;
    }
    
    .detail-sidebar,
    .library-sidebar,
    .article-sidebar {
        width: 300px;
        flex-shrink: 0;
    }
}

/* ========================================
   打印样式
   ======================================== */

@media print {
    .navbar,
    .footer,
    .btn,
    .actions,
    .comment-form,
    .pagination {
        display: none !important;
    }
    
    .container {
        max-width: 100%;
        padding: 0;
    }
    
    a {
        color: #000 !important;
        text-decoration: none !important;
    }
    
    .card,
    .article-detail,
    .library-detail {
        box-shadow: none !important;
        border: 1px solid #ddd;
    }
}

/* ========================================
   深色模式（系统级别）
   ======================================== */

@media (prefers-color-scheme: dark) {
    :root.auto-theme {
        --bg-primary: #1a1a1a;
        --bg-secondary: #2d2d2d;
        --text-primary: #ffffff;
        --text-secondary: #b0b0b0;
        --border-color: #404040;
    }
}

/* ========================================
   减少动画（用户设置）
   ======================================== */

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
