/* 自定义样式 - 性能优化版本 */

/* 性能优化：使用will-change提示浏览器优化渲染 */
/* iPhone 15样式模拟 */
.iphone-frame {
    position: relative;
    width: 375px;
    height: 812px;
    background-color: #000;
    border-radius: 40px;
    padding: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    margin: 20px auto;
    overflow: hidden;
    /* 性能优化：硬件加速 */
    will-change: transform;
    transform: translateZ(0);
}

.iphone-screen {
    position: relative;
    width: 100%;
    height: 100%;
    background-color: #fff;
    border-radius: 30px;
    overflow: hidden;
    /* 性能优化：硬件加速 */
    will-change: transform;
    transform: translateZ(0);
}

.iphone-notch {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 150px;
    height: 30px;
    background-color: #000;
    border-bottom-left-radius: 15px;
    border-bottom-right-radius: 15px;
    z-index: 10;
}

/* 动画效果 - 优化版本 */
.fade-in {
    animation: fadeIn 0.3s ease-in-out;
    will-change: opacity;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.slide-in {
    animation: slideIn 0.3s ease-in-out;
    will-change: transform, opacity;
}

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

/* 新增页面切换动画 */
.page-transition {
    animation: pageFade 0.3s ease-in-out;
    will-change: opacity;
}

@keyframes pageFade {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

/* 新增脉冲动画 */
.pulse {
    animation: pulse 1.5s infinite ease-in-out;
}

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

/* 单词卡片样式 - 优化版本 */
.word-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    will-change: transform, box-shadow;
}

.word-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

/* 触摸设备优化 */
@media (hover: none) {
    .word-card:active {
        transform: translateY(-3px);
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    }
}

/* 进度条样式 */
.progress-bar {
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(90deg, #4F46E5 0%, #7C3AED 100%);
    transition: width 0.5s ease;
}

/* 底部导航栏样式 - 优化版本 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px); /* Safari 支持 */
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    z-index: 100;
    /* 性能优化：硬件加速 */
    will-change: transform;
    transform: translateZ(0);
    /* 添加过渡效果 */
    transition: transform 0.3s ease;
}

/* 导航项点击效果 */
.nav-item {
    transition: transform 0.2s ease, color 0.2s ease;
    will-change: transform, color;
}

.nav-item:active {
    transform: scale(0.9);
}

/* 自定义滚动条 */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 确保iframe内容填满容器 - 优化版本 */
.page-iframe {
    width: 100%;
    height: 100%;
    border: none;
    /* 添加过渡效果 */
    transition: opacity 0.3s ease;
    will-change: opacity;
}

/* 响应式设计优化 */
@media (max-width: 420px) {
    .iphone-frame {
        width: 100%;
        height: 100vh;
        margin: 0;
        border-radius: 0;
    }
    
    .iphone-screen {
        border-radius: 0;
    }
    
    .iphone-notch {
        display: none;
    }
}

/* 加载指示器动画 */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-spinner {
    animation: spin 1s linear infinite;
    will-change: transform;
}