/* 响应式样式 */

/* 桌面设备 (> 1024px) - 默认样式已在其他文件中定义 */
@media (min-width: 1025px) {
    .container {
        max-width: 1200px;
    }
    
    /* 桌面优化的多列布局 */
    .pet-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
    
    .news-grid {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    }
}

/* 平板设备 (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
    .nav-container {
        padding: 1rem 1.5rem;
    }

    #app-content {
        padding: 0 1.5rem;
        max-width: 960px;
    }

    .container {
        max-width: 960px;
        padding: 0 1.5rem;
    }

    /* 平板布局调整 */
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .pet-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .news-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* 平板按钮优化 */
    .btn {
        min-height: 44px;
        padding: 0.875rem 1.75rem;
    }
    
    /* 平板表单优化 */
    .form-input,
    .form-textarea,
    .form-select {
        min-height: 44px;
        font-size: 1rem;
    }
    
    /* 卡片间距调整 */
    .card {
        padding: 1.25rem;
    }
}

/* 移动设备 (< 768px) */
@media (max-width: 767px) {
    /* 导航栏移动优化 */
    .nav-container {
        padding: 1rem;
        flex-wrap: wrap;
    }

    .logo {
        font-size: 1.25rem;
    }

    .hamburger {
        display: flex;
        min-width: 44px;
        min-height: 44px;
        justify-content: center;
        align-items: center;
    }

    .nav-menu {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: #1d4dd6;
        flex-direction: column;
        gap: 0;
        box-shadow: var(--shadow);
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }

    .nav-menu.active {
        max-height: 500px;
    }

    .nav-menu li {
        border-bottom: 1px solid var(--border-color);
    }

    .nav-menu a {
        display: block;
        padding: 1rem;
        border-radius: 0;
        min-height: 44px;
        display: flex;
        align-items: center;
        color: #ffffff;
    }

    /* 内容区域移动优化 */
    #app-content {
        padding: 0 1rem;
        margin: 1rem auto;
    }

    .container {
        padding: 0 1rem;
    }

    /* 单列布局 */
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }
    
    .pet-grid {
        grid-template-columns: 1fr;
    }
    
    .news-grid {
        grid-template-columns: 1fr;
    }

    /* 标题大小调整 */
    .section-title {
        font-size: 1.5rem;
    }

    /* 卡片移动优化 */
    .card {
        padding: 1rem;
        border-radius: var(--border-radius);
        box-shadow: var(--shadow);
    }

    /* 按钮移动优化 - 增大触摸区域 */
    .btn {
        width: 100%;
        padding: 1rem;
        min-height: 48px;
        font-size: 1rem;
        border-radius: var(--border-radius);
    }
    
    .button-group {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .button-group .btn {
        width: 100%;
    }

    /* Toast 移动优化 */
    #toast-container {
        right: 10px;
        left: 10px;
        top: 70px;
    }

    .toast {
        min-width: auto;
        width: 100%;
    }

    /* 表单移动优化 - 增大触摸区域 */
    .form-input,
    .form-textarea,
    .form-select {
        min-height: 48px;
        padding: 0.875rem;
        font-size: 16px; /* 防止 iOS 自动缩放 */
        border-radius: var(--border-radius);
    }
    
    .form-control {
        min-height: 48px;
        padding: 0.875rem;
        font-size: 16px;
        border-radius: var(--border-radius);
    }

    /* 列表项移动优化 */
    .list-item {
        padding: 1.25rem 1rem;
        min-height: 48px;
    }
    
    /* 图片移动优化 */
    .img-thumbnail {
        width: 80px;
        height: 80px;
    }
    
    /* 宠物详情移动布局 */
    .pet-detail {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .pet-detail-photo {
        max-height: 300px;
        object-fit: cover;
    }
    
    /* 文章内容移动优化 */
    .article-title {
        font-size: 1.5rem;
        line-height: 1.3;
    }
    
    .article-content {
        font-size: 1rem;
        line-height: 1.7;
    }
    
    .article-image {
        max-height: 250px;
    }
    
    /* 徽章移动优化 */
    .badge {
        padding: 0.375rem 0.875rem;
        font-size: 0.875rem;
        border-radius: 12px;
    }
    
    /* 照片预览移动优化 */
    .preview-image {
        max-width: 100%;
        max-height: 250px;
    }
}

/* 小屏幕移动设备 (< 480px) */
@media (max-width: 480px) {
    /* 导航栏小屏优化 */
    .nav-container {
        padding: 0.75rem;
    }

    .logo {
        font-size: 1.1rem;
    }

    /* 内容区域小屏优化 */
    #app-content {
        margin: 0.5rem auto;
        padding: 0 0.75rem;
    }

    .container {
        padding: 0 0.75rem;
    }

    /* 标题小屏优化 */
    .section-title {
        font-size: 1.25rem;
    }

    /* 卡片小屏优化 */
    .card {
        padding: 0.75rem;
        margin-bottom: 1rem;
    }
    
    .card-header {
        font-size: 1.1rem;
    }

    /* 表单小屏优化 */
    .form-group {
        margin-bottom: 1rem;
    }
    
    .form-label {
        font-size: 0.9rem;
    }
    
    /* 按钮小屏优化 */
    .btn {
        padding: 0.875rem;
        font-size: 0.95rem;
    }
    
    /* 网格间距调整 */
    .grid {
        gap: 1rem;
    }
    
    .pet-grid,
    .news-grid,
    .blog-list {
        gap: 1rem;
    }
    
    /* 图片小屏优化 */
    .pet-photo,
    .news-image {
        height: 180px;
    }
    
    .img-thumbnail {
        width: 60px;
        height: 60px;
    }
}

/* 横屏移动设备优化 */
@media (max-width: 767px) and (orientation: landscape) {
    #app-content {
        margin: 0.5rem auto;
    }
    
    .nav-menu.active {
        max-height: 300px;
        overflow-y: auto;
    }
    
    .pet-photo,
    .news-image {
        height: 150px;
    }
}

/* 打印样式 */
@media print {
    .nav-menu,
    .hamburger,
    #toast-container,
    .btn {
        display: none;
    }
    
    #app-content {
        max-width: 100%;
        padding: 0;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid var(--border-color);
        page-break-inside: avoid;
    }
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    .btn {
        border: 2px solid currentColor;
    }
    
    .card {
        border: 2px solid var(--border-color);
    }
}

/* 减少动画模式支持 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
