/* ==================== 移动端专属优化 ==================== */

/* 移动端动画定义 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { 
        opacity: 0;
        transform: translateY(30px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUpFromCenter {
    from { 
        opacity: 0;
        transform: scale(0.95);
    }
    to { 
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideDown {
    from { 
        opacity: 0;
        transform: translateY(-30px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* 移动端触摸反馈 */
.touch-feedback {
    position: relative;
    overflow: hidden;
}

.touch-feedback::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease;
}

.touch-feedback.active::after {
    width: 200px;
    height: 200px;
    opacity: 0;
}

/* 移动端手势支持 */
.swipe-container {
    touch-action: pan-x;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
}

.swipe-item {
    scroll-snap-align: start;
    flex-shrink: 0;
}

/* 移动端专用消息提示 */
.mobile-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 20px;
    border-radius: 25px;
    font-size: 14px;
    z-index: 10001;
    animation: fadeIn 0.3s ease;
    max-width: 80%;
    text-align: center;
}

/* 移动端加载状态 */
.mobile-loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 10002;
}

.mobile-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 移动端输入优化 */
.mobile-input-group {
    position: relative;
    margin-bottom: 20px;
}

.mobile-input-group input {
    width: 100%;
    padding: 15px;
    font-size: 16px;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    background: white;
    transition: all 0.3s ease;
}

.mobile-input-group input:focus {
    border-color: #667eea;
    outline: none;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}

/* 移动端虚拟键盘适配 */
@media (max-width: 768px) and (max-height: 600px) {
    .login-card {
        margin: 10px auto;
        padding: 15px;
    }
    
    .modal-content {
        height: 100vh;
        overflow-y: auto;
    }
}

/* 移动端页面切换动画 */
.page-transition-enter {
    opacity: 0;
    transform: translateX(100%);
}

.page-transition-enter-active {
    opacity: 1;
    transform: translateX(0);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.page-transition-exit {
    opacity: 1;
    transform: translateX(0);
}

.page-transition-exit-active {
    opacity: 0;
    transform: translateX(-100%);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* 移动端文件上传优化 */
.mobile-upload-area {
    border: 3px dashed #667eea;
    border-radius: 15px;
    padding: 40px 20px;
    text-align: center;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    transition: all 0.3s ease;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.mobile-upload-area.active {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.15) 100%);
    border-color: #764ba2;
    transform: scale(1.02);
}

.mobile-upload-icon {
    font-size: 48px;
    color: #667eea;
    margin-bottom: 10px;
}

.mobile-upload-text {
    font-size: 16px;
    color: #333;
    font-weight: 500;
    margin-bottom: 5px;
}

.mobile-upload-hint {
    font-size: 14px;
    color: #666;
    opacity: 0.8;
}

/* 移动端长按效果 */
.long-press {
    position: relative;
}

.long-press.active {
    transform: scale(0.95);
    opacity: 0.8;
}

/* 移动端震动反馈效果 */
.shake-effect {
    animation: shake 0.5s ease-in-out;
}

/* 移动端下拉刷新样式 */
.pull-to-refresh {
    position: relative;
    padding-top: 60px;
    margin-top: -60px;
    transition: margin-top 0.3s ease;
}

.pull-to-refresh.pulling {
    margin-top: 0;
}

.refresh-indicator {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: #667eea;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.refresh-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* 移动端底部安全区域适配 */
@supports (padding: max(0px)) {
    .mobile-safe-bottom {
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }
    
    .mobile-modal-footer {
        padding-bottom: max(15px, env(safe-area-inset-bottom));
    }
}

/* 移动端状态栏适配 */
@supports (padding-top: env(safe-area-inset-top)) {
    .mobile-header {
        padding-top: max(10px, env(safe-area-inset-top));
    }
}

/* 移动端性能优化 */
.mobile-optimized {
    will-change: transform;
    backface-visibility: hidden;
    perspective: 1000px;
}

.mobile-optimized img {
    content-visibility: auto;
    contain-intrinsic-size: 400px 300px;
}

/* 移动端夜间模式适配 */
@media (prefers-color-scheme: dark) {
    .mobile-upload-area {
        background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
        border-color: rgba(102, 126, 234, 0.3);
    }
    
    .mobile-toast {
        background: rgba(255, 255, 255, 0.9);
        color: #333;
    }
}

/* 移动端减少动画模式 */
@media (prefers-reduced-motion: reduce) {
    .mobile-optimized,
    .mobile-upload-area,
    .modal-content {
        animation: none;
        transition: none;
    }
}