/* Mobile Enhancements - 额外的移动端增强样式 */

/* ===== 触摸反馈样式 ===== */
.touch-active {
    transform: scale(0.95) !important;
    transition: transform 0.1s ease !important;
}

.nav-clicked {
    background-color: rgba(236, 72, 153, 0.1) !important;
    transform: scale(0.98) !important;
}

/* ===== 输入框优化样式 ===== */
.input-focused {
    border-color: #ec4899 !important;
    box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.1) !important;
    transform: scale(1.02) !important;
}

.searching {
    background-color: rgba(236, 72, 153, 0.1) !important;
    border-color: #ec4899 !important;
}

.search-error {
    border-color: #ef4444 !important;
    background-color: rgba(239, 68, 68, 0.05) !important;
    animation: shake 0.5s ease-in-out !important;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* ===== 状态消息样式 ===== */
.status-message {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    z-index: 1000;
    animation: slideDown 0.3s ease-out;
}

.status-success {
    background-color: #10b981;
    color: white;
}

.status-warning {
    background-color: #ec4899;
    color: white;
}

.status-error {
    background-color: #ef4444;
    color: white;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* ===== 刷新指示器样式 ===== */
.refresh-indicator {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 8px;
}

.refresh-indicator i {
    animation: spin 1s linear infinite;
}

/* ===== 横屏模式样式 ===== */
.landscape-mode .py-16 {
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
}

.landscape-mode .py-12 {
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
}

.landscape-mode .py-8 {
    padding-top: 0.25rem !important;
    padding-bottom: 0.25rem !important;
}

.landscape-mode .hero-search-hint {
    display: none !important;
}

.landscape-mode .level-card .bg-gray-100 {
    height: 100px !important;
}

.landscape-mode .level-text-content {
    padding: 0.5rem !important;
}

.landscape-mode .level-title {
    font-size: 0.75rem !important;
    line-height: 1.2 !important;
}

/* ===== 加载状态优化 ===== */
@media screen and (max-width: 768px) {
    .loading-spinner {
        width: 16px !important;
        height: 16px !important;
        border-width: 2px !important;
    }
    
    .loading-overlay {
        background-color: rgba(255, 255, 255, 0.95) !important;
    }
    
    .loading-overlay .bg-white {
        padding: 1rem !important;
        border-radius: 12px !important;
    }
}

/* ===== 导航栏优化 ===== */
@media screen and (max-width: 768px) {
    nav {
        transition: transform 0.3s ease !important;
    }
    
    nav[style*="translateY(-100%)"] {
        transform: translateY(-100%) !important;
    }
    
    /* 移动端菜单动画 */
    .mobile-menu {
        transition: all 0.3s ease !important;
        transform: translateY(-100%);
        opacity: 0;
        display: none;
    }
    
    .mobile-menu.active {
        transform: translateY(0);
        opacity: 1;
        display: block;
    }
    
    /* 菜单按钮动画 */
    #mobile-menu-button i {
        transition: transform 0.3s ease !important;
    }
    
    #mobile-menu-button i.fa-times {
        transform: rotate(90deg) !important;
    }
}

/* ===== 等级卡片增强 ===== */
@media screen and (max-width: 768px) {
    .level-card {
        transition: all 0.2s ease !important;
    }
    
    .level-card:active {
        transform: scale(0.98) !important;
    }
    
    /* 等级卡片加载状态 */
    .level-card.loading {
        opacity: 0.7;
        pointer-events: none;
    }
    
    .level-card.loading::after {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 20px;
        height: 20px;
        border: 2px solid #f3f4f6;
        border-top: 2px solid #ec4899;
        border-radius: 50%;
        animation: spin 1s linear infinite;
    }
}

/* ===== 搜索框增强 ===== */
@media screen and (max-width: 768px) {
    .hero-search-box {
        transition: all 0.3s ease !important;
    }
    
    .hero-search-box:focus-within {
        transform: translateY(-2px) !important;
        box-shadow: 0 8px 25px rgba(240, 136, 10, 0.15) !important;
    }
    
    .hero-search-btn {
        transition: all 0.2s ease !important;
    }
    
    .hero-search-btn:active {
        transform: scale(0.95) !important;
    }
}

/* ===== 标签页增强 ===== */
@media screen and (max-width: 768px) {
    .level-tab-btn {
        transition: all 0.2s ease !important;
        position: relative;
        overflow: hidden;
    }
    
    .level-tab-btn::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;
    }
    
    .level-tab-btn:active::before {
        left: 100%;
    }
    
    .level-tab-btn:active {
        transform: scale(0.95) !important;
    }
}

/* ===== 分页增强 ===== */
@media screen and (max-width: 768px) {
    nav.flex.items-center.space-x-1 a,
    nav.flex.items-center.space-x-1 span {
        transition: all 0.2s ease !important;
        min-width: 36px !important;
        min-height: 36px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    nav.flex.items-center.space-x-1 a:active,
    nav.flex.items-center.space-x-1 span:active {
        transform: scale(0.9) !important;
    }
}

/* ===== 返回顶部按钮增强 ===== */
@media screen and (max-width: 768px) {
    #back-to-top {
        transition: all 0.3s ease !important;
        box-shadow: 0 4px 12px rgba(240, 136, 10, 0.3) !important;
    }
    
    #back-to-top:active {
        transform: scale(0.9) !important;
    }
    
    #back-to-top:hover {
        transform: translateY(-2px) !important;
        box-shadow: 0 6px 20px rgba(240, 136, 10, 0.4) !important;
    }
}

/* ===== 工具提示增强 ===== */
@media screen and (max-width: 768px) {
    .tooltip {
        font-size: 12px !important;
        padding: 6px 10px !important;
        border-radius: 6px !important;
        max-width: 200px !important;
        word-wrap: break-word !important;
    }
}

/* ===== 深色模式增强 ===== */
@media (prefers-color-scheme: dark) {
    @media screen and (max-width: 768px) {
        .status-message {
            background-color: rgba(0, 0, 0, 0.9) !important;
            color: white !important;
        }
        
        .refresh-indicator {
            background-color: rgba(0, 0, 0, 0.9) !important;
        }
        
        .input-focused {
            background-color: rgba(31, 41, 55, 0.8) !important;
            border-color: #f59e0b !important;
        }
        
        .searching {
            background-color: rgba(245, 158, 11, 0.1) !important;
        }
    }
}

/* ===== 减少动画偏好 ===== */
@media (prefers-reduced-motion: reduce) {
    @media screen and (max-width: 768px) {
        .touch-active,
        .nav-clicked,
        .input-focused,
        .level-card:active,
        .hero-search-btn:active,
        .level-tab-btn:active,
        #back-to-top:active {
            transform: none !important;
            transition: none !important;
        }
        
        .mobile-menu,
        .hero-search-box,
        nav {
            transition: none !important;
        }
        
        .level-card::before,
        .level-tab-btn::before {
            display: none !important;
        }
    }
}

/* ===== 高对比度模式 ===== */
@media (prefers-contrast: high) {
    @media screen and (max-width: 768px) {
        .level-card {
            border: 2px solid #000 !important;
        }
        
        .level-badge {
            border: 1px solid #000 !important;
        }
        
        .hero-search-box {
            border: 2px solid #000 !important;
        }
        
        .level-tab-btn {
            border: 1px solid #000 !important;
        }
    }
}

/* ===== 打印样式优化 ===== */
@media print {
    @media screen and (max-width: 768px) {
        .mobile-menu,
        .hero-search-container,
        #back-to-top,
        .status-message,
        .refresh-indicator {
            display: none !important;
        }
        
        .level-card {
            break-inside: avoid !important;
            page-break-inside: avoid !important;
        }
    }
}
