/* 移动端优化样式 - PetAge */

/* 移动端基础优化 */
@media (max-width: 768px) {
    /* 触摸友好的交互 */
    * {
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
    }
    
    /* 允许文本选择 */
    p, h1, h2, h3, h4, h5, h6, span, div {
        -webkit-user-select: text;
        user-select: text;
    }
    
    /* 输入框优化 */
    input, textarea, select {
        -webkit-user-select: text;
        user-select: text;
        font-size: 16px !important; /* 防止iOS缩放 */
    }
    
    /* 按钮触摸优化 */
    .btn, button, .nav-link, .pet-card, .feature-card, .step-card {
        min-height: 44px;
        min-width: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        touch-action: manipulation;
    }
    
    /* 导航栏移动端优化 */
    .navbar {
        height: 60px;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1000;
        backdrop-filter: blur(10px);
        background: rgba(255, 255, 255, 0.95);
    }
    
    .nav-container {
        height: 60px;
        padding: 0 1rem;
    }
    
    .nav-logo h2 {
        font-size: 1.25rem;
    }
    
    /* 汉堡菜单优化 */
    .hamburger {
        width: 30px;
        height: 30px;
        position: relative;
        cursor: pointer;
        z-index: 1001;
    }
    
    .bar {
        width: 25px;
        height: 3px;
        background: var(--primary-color);
        border-radius: 2px;
        transition: all 0.3s ease;
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
    }
    
    .bar:nth-child(1) {
        transform: translate(-50%, -8px);
    }
    
    .bar:nth-child(2) {
        transform: translate(-50%, -50%);
    }
    
    .bar:nth-child(3) {
        transform: translate(-50%, 8px);
    }
    
    .hamburger.active .bar:nth-child(1) {
        transform: translate(-50%, -50%) rotate(45deg);
    }
    
    .hamburger.active .bar:nth-child(2) {
        opacity: 0;
    }
    
    .hamburger.active .bar:nth-child(3) {
        transform: translate(-50%, -50%) rotate(-45deg);
    }
    
    /* 移动端菜单 */
    .nav-menu {
        position: fixed;
        top: 60px;
        left: -100%;
        width: 100%;
        height: calc(100vh - 60px);
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(10px);
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
        padding: 2rem 0;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .nav-menu.active {
        left: 0;
    }
    
    .nav-menu li {
        width: 100%;
        margin: 0;
        padding: 0;
    }
    
    .nav-link {
        display: block;
        padding: 1rem 2rem;
        font-size: 1.125rem;
        font-weight: 500;
        border-bottom: 1px solid var(--border-light);
        transition: all 0.3s ease;
    }
    
    .nav-link:hover,
    .nav-link.active {
        background: var(--primary-color);
        color: white;
        transform: translateX(10px);
    }
    
    /* 主内容区域调整 */
    main {
        margin-top: 60px;
        padding-top: 1rem;
    }
    
    /* 英雄区域移动端优化 */
    .hero {
        padding: 2rem 1rem;
        min-height: calc(100vh - 60px);
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        text-align: center;
    }
    
    .hero-content {
        width: 100%;
        max-width: 500px;
    }
    
    .hero-title {
        font-size: 2.25rem;
        line-height: 1.2;
        margin-bottom: 1rem;
        color: white;
        text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    }
    
    .hero-subtitle {
        font-size: 1.125rem;
        line-height: 1.6;
        margin-bottom: 2rem;
        color: white;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    }
    
    .hero-buttons {
        flex-direction: column;
        gap: 1rem;
        width: 100%;
    }
    
    .btn {
        width: 100%;
        max-width: 300px;
        padding: 1rem 2rem;
        font-size: 1.125rem;
        font-weight: 600;
        border-radius: var(--radius-lg);
        transition: all 0.3s ease;
        position: relative;
        overflow: hidden;
    }
    
    .btn:active {
        transform: scale(0.98);
    }
    
    /* 宠物卡片移动端优化 */
    .pet-illustration {
        width: 100%;
        max-width: 400px;
        margin-top: 2rem;
    }
    
    .pet-card {
        width: 100%;
        padding: 1.5rem;
        margin-bottom: 1rem;
        border-radius: var(--radius-lg);
        background: rgba(255, 255, 255, 0.1);
        backdrop-filter: blur(10px);
        border: 1px solid rgba(255, 255, 255, 0.2);
        box-shadow: var(--shadow-md);
        transition: all 0.3s ease;
        position: relative;
        overflow: hidden;
        color: white;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        min-height: 150px;
        text-align: center;
    }
    
    .pet-card:active {
        transform: scale(0.98);
        background: rgba(255, 255, 255, 0.2);
    }
    
    .pet-card::before {
        content: '';
        position: absolute;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100%;
        background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
        transition: left 0.5s ease;
    }
    
    .pet-card:active::before {
        left: 100%;
    }
    
    .pet-avatar {
        font-size: 3rem;
        margin-bottom: 1rem;
        order: 1;
    }
    
    .pet-card h3 {
        color: white;
        font-size: 1.25rem;
        font-weight: 600;
        margin-bottom: 0.5rem;
        order: 2;
    }
    
    .pet-card p {
        color: rgba(255, 255, 255, 0.9);
        font-size: 0.875rem;
        line-height: 1.4;
        order: 3;
    }
    
    /* 特色功能移动端优化 */
    .features {
        padding: 3rem 1rem;
    }
    
    .section-title {
        font-size: 2rem;
        margin-bottom: 2rem;
        text-align: center;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .feature-card {
        padding: 2rem 1.5rem;
        border-radius: var(--radius-lg);
        background: var(--bg-secondary);
        box-shadow: var(--shadow-md);
        transition: all 0.3s ease;
        text-align: center;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        min-height: 200px;
    }
    
    .feature-card:active {
        transform: scale(0.98);
    }
    
    .feature-icon {
        font-size: 3rem;
        margin-bottom: 1rem;
        order: 1;
    }
    
    .feature-card h3 {
        font-size: 1.25rem;
        margin-bottom: 1rem;
        color: var(--text-primary);
        order: 2;
    }
    
    .feature-card p {
        color: var(--text-secondary);
        line-height: 1.6;
        order: 3;
    }
    
    /* 计算步骤移动端优化 */
    .steps {
        padding: 3rem 1rem;
    }
    
    .steps-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .step-card {
        padding: 2rem 1.5rem;
        border-radius: var(--radius-lg);
        background: var(--bg-secondary);
        box-shadow: var(--shadow-md);
        transition: all 0.3s ease;
        text-align: center;
        position: relative;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        min-height: 200px;
    }
    
    .step-card:active {
        transform: scale(0.98);
    }
    
    .step-number {
        position: absolute;
        top: -15px;
        left: 50%;
        transform: translateX(-50%);
        background: var(--primary-color);
        color: white;
        width: 30px;
        height: 30px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 700;
        font-size: 1rem;
    }
    
    .step-icon {
        font-size: 2.5rem;
        margin-bottom: 1rem;
        order: 1;
    }
    
    .step-card h3 {
        font-size: 1.125rem;
        margin-bottom: 0.75rem;
        color: var(--text-primary);
        order: 2;
    }
    
    .step-card p {
        color: var(--text-secondary);
        line-height: 1.6;
        order: 3;
    }
    
    /* 用户反馈移动端优化 */
    .testimonials {
        padding: 3rem 1rem;
    }
    
    .testimonials-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .testimonial-card {
        padding: 2rem 1.5rem;
        border-radius: var(--radius-lg);
        background: var(--bg-secondary);
        box-shadow: var(--shadow-md);
        transition: all 0.3s ease;
        text-align: center;
    }
    
    .testimonial-card:active {
        transform: scale(0.98);
    }
    
    .testimonial-avatar {
        font-size: 2.5rem;
        margin-bottom: 1rem;
    }
    
    .testimonial-content p {
        font-size: 1rem;
        line-height: 1.6;
        color: var(--text-secondary);
        margin-bottom: 1rem;
        font-style: italic;
    }
    
    .testimonial-author strong {
        color: var(--text-primary);
        font-weight: 600;
        display: block;
        margin-bottom: 0.25rem;
    }
    
    .testimonial-author span {
        color: var(--text-secondary);
        font-size: 0.875rem;
    }
    
    .testimonial-rating {
        color: var(--accent-color);
        font-size: 1rem;
        margin-top: 0.5rem;
    }
    
    /* 统计数据移动端优化 */
    .stats {
        padding: 3rem 1rem;
    }
    
    .stats-container {
        flex-direction: column;
        gap: 2rem;
        text-align: center;
    }
    
    .stat-item {
        padding: 1.5rem;
        background: var(--bg-secondary);
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow-md);
    }
    
    .stat-item h3 {
        font-size: 2.5rem;
        color: var(--primary-color);
        margin-bottom: 0.5rem;
    }
    
    .stat-item p {
        color: var(--text-secondary);
        font-size: 1rem;
    }
    
    /* 页脚移动端优化 */
    .footer {
        padding: 3rem 1rem 1rem;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }
    
    .footer-section h3,
    .footer-section h4 {
        margin-bottom: 1rem;
        color: var(--text-primary);
    }
    
    .footer-section p {
        color: var(--text-secondary);
        line-height: 1.6;
        margin-bottom: 1rem;
    }
    
    .footer-section ul {
        list-style: none;
    }
    
    .footer-section li {
        margin-bottom: 0.5rem;
    }
    
    .footer-section a {
        color: var(--text-secondary);
        text-decoration: none;
        transition: color 0.3s ease;
    }
    
    .footer-section a:hover {
        color: var(--primary-color);
    }
    
    .footer-bottom {
        margin-top: 2rem;
        padding-top: 1rem;
        border-top: 1px solid var(--border-color);
        text-align: center;
        color: var(--text-secondary);
    }
    
    /* 移动端历史记录卡片优化 */
    .history-item {
        flex-direction: row;
        align-items: center;
        gap: 0.75rem;
        padding: 0.75rem;
        min-height: 60px;
    }
    
    .history-pet-info {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        flex: 1;
    }
    
    .history-icon {
        font-size: 1.25rem;
        width: 35px;
        height: 35px;
        flex-shrink: 0;
    }
    
    .history-details {
        flex: 1;
        min-width: 0;
    }
    
    .history-age {
        font-size: 0.875rem;
        margin-bottom: 0.125rem;
    }
    
    .history-time {
        font-size: 0.75rem;
    }
    
    .history-redo {
        background: var(--primary-color);
        color: white;
        border: none;
        padding: 0.375rem 0.75rem;
        border-radius: var(--radius-sm);
        font-size: 0.75rem;
        font-weight: 500;
        cursor: pointer;
        transition: background-color 0.3s ease;
        flex-shrink: 0;
        white-space: nowrap;
    }
    
    .history-redo:hover {
        background: var(--primary-dark);
    }
}

/* 小屏幕手机优化 */
@media (max-width: 480px) {
    .nav-container {
        padding: 0 0.75rem;
    }
    
    .hero {
        padding: 1.5rem 0.75rem;
    }
    
    .hero-title {
        font-size: 2rem;
        color: white;
        text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    }
    
    .hero-subtitle {
        font-size: 1rem;
        color: white;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    }
    
    .btn {
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }
    
    .pet-card {
        padding: 1.25rem;
        background: rgba(255, 255, 255, 0.1);
        backdrop-filter: blur(10px);
        border: 1px solid rgba(255, 255, 255, 0.2);
        color: white;
        min-height: 120px;
    }
    
    .feature-card,
    .step-card,
    .testimonial-card {
        padding: 1.5rem 1rem;
    }
    
    .section-title {
        font-size: 1.75rem;
    }
    
    .stats-container {
        gap: 1.5rem;
    }
    
    .stat-item h3 {
        font-size: 2rem;
    }
}

/* 超小屏幕优化 */
@media (max-width: 360px) {
    .hero-title {
        font-size: 1.75rem;
        color: white;
        text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    }
    
    .hero-subtitle {
        font-size: 0.875rem;
        color: white;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    }
    
    .btn {
        padding: 0.75rem 1.25rem;
        font-size: 0.875rem;
    }
    
    .pet-card,
    .feature-card,
    .step-card,
    .testimonial-card {
        padding: 1rem 0.75rem;
    }
    
    .pet-card {
        background: rgba(255, 255, 255, 0.1);
        backdrop-filter: blur(10px);
        border: 1px solid rgba(255, 255, 255, 0.2);
        color: white;
        min-height: 100px;
    }
    
    .feature-card,
    .step-card {
        min-height: 150px;
    }
    
    .section-title {
        font-size: 1.5rem;
    }
    
    .stat-item h3 {
        font-size: 1.75rem;
    }
}

/* 横屏模式优化 */
@media (max-width: 768px) and (orientation: landscape) {
    .hero {
        min-height: auto;
        padding: 1rem;
    }
    
    .nav-menu {
        height: calc(100vh - 60px);
        max-height: 400px;
    }
    
    .hero-buttons {
        flex-direction: row;
        justify-content: center;
        gap: 1rem;
    }
    
    .btn {
        width: auto;
        min-width: 150px;
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    .btn:hover,
    .pet-card:hover,
    .feature-card:hover,
    .step-card:hover,
    .testimonial-card:hover,
    .nav-link:hover {
        transform: none;
    }
    
    .btn:active,
    .pet-card:active,
    .feature-card:active,
    .step-card:active,
    .testimonial-card:active {
        transform: scale(0.98);
    }
}

/* 性能优化 */
@media (max-width: 768px) {
    /* 减少动画复杂度 */
    * {
        animation-duration: 0.2s !important;
        transition-duration: 0.2s !important;
    }
    
    /* 优化滚动性能 */
    .nav-menu,
    main {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
    
    /* 减少阴影复杂度 */
    .feature-card,
    .step-card,
    .testimonial-card,
    .pet-card {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
}

/* 无障碍优化 */
@media (max-width: 768px) {
    /* 增加焦点可见性 */
    .btn:focus,
    .nav-link:focus,
    .pet-card:focus {
        outline: 2px solid var(--primary-color);
        outline-offset: 2px;
    }
    
    /* 增加对比度 */
    .text-secondary {
        color: #4b5563 !important;
    }
    
    /* 增加字体大小 */
    .nav-link {
        font-size: 1.125rem;
    }
    
    .btn {
        font-size: 1rem;
    }
} 