/* 性能优化：启用硬件加速 */
.feature-modal,
.feature-modal-content,
.feature-modal-header,
.feature-modal-body,
.feature-modal-iframe {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* 减少不必要的重绘 */
.feature-modal * {
    box-sizing: border-box;
}

/* 功能模态窗口样式 */
.feature-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94), 
                visibility 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                background 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                backdrop-filter 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.feature-modal.show {
    opacity: 1;
    visibility: visible;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.feature-modal-content {
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
    width: 95%;
    max-width: 1400px;
    height: 90vh;
    max-height: 900px;
    position: relative;
    overflow: hidden;
    transform: scale(0.85) translateY(40px);
    transition: transform 0.5s cubic-bezier(0.34, 1.3, 0.64, 1), 
                opacity 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                box-shadow 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border: 1px solid var(--border-color);
    opacity: 0;
    will-change: transform, opacity, box-shadow;
}

.feature-modal.show .feature-modal-content {
    transform: scale(1) translateY(0);
    opacity: 1;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.feature-modal-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    background: var(--header-bg);
    position: relative;
    min-height: 81px;
    box-sizing: border-box;
    width: 100%;
    opacity: 0;
    transform: translateY(-15px);
    transition: opacity 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.15s, 
                transform 0.4s cubic-bezier(0.34, 1.2, 0.64, 1) 0.15s;
}

.feature-modal.show .feature-modal-header {
    opacity: 1;
    transform: translateY(0);
}

.feature-modal-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    margin-right: 24px;
    min-width: 0;
    overflow: hidden;
    max-width: calc(100% - 120px);
}

.feature-modal-title .title-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.feature-modal-title .material-icons {
    font-size: 1.5rem;
    color: var(--primary-color);
    flex-shrink: 0;
}

.feature-modal-controls {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px;
    flex-shrink: 0 !important;
    min-width: 96px !important;
    width: 96px !important;
    height: 40px !important;
    position: relative;
    z-index: 100;
}

.feature-modal-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    min-height: 40px !important;
    max-width: 40px !important;
    max-height: 40px !important;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    flex-shrink: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    border: 1px solid rgba(255, 255, 255, 0.15);
    overflow: hidden;
    vertical-align: top !important;
    top: 0 !important;
    opacity: 0;
    transform: translateY(-10px) scale(0.9);
    will-change: transform, opacity, background;
}

.feature-modal.show .feature-modal-btn {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.feature-modal.show .feature-modal-btn:nth-child(1) {
    transition-delay: 0.4s;
}

.feature-modal.show .feature-modal-btn:nth-child(2) {
    transition-delay: 0.45s;
}

.feature-modal-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    transition: opacity 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    opacity: 0;
}

.feature-modal-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    border-color: rgba(255, 255, 255, 0.2);
}

.feature-modal-btn:hover::before {
    opacity: 1;
}

.feature-modal-btn:active {
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.1s ease;
}

.feature-modal-btn.fullscreen {
    background: linear-gradient(135deg, var(--primary-color-10) 0%, var(--primary-color-5) 100%);
    color: var(--primary-color);
    border-color: var(--primary-color-20);
}

.feature-modal-btn.fullscreen:hover {
    background: linear-gradient(135deg, var(--primary-color-20) 0%, var(--primary-color-10) 100%);
    color: var(--primary-color-dark);
    border-color: var(--primary-color-30);
}

.feature-modal-btn.close-btn {
    background: linear-gradient(135deg, rgba(120, 120, 120, 0.15) 0%, rgba(120, 120, 120, 0.08) 100%);
    color: var(--text-secondary);
    border-color: rgba(160, 160, 160, 0.25);
}

.feature-modal-btn.close-btn:hover {
    background: linear-gradient(135deg, rgba(140, 140, 140, 0.25) 0%, rgba(140, 140, 140, 0.15) 100%);
    color: var(--text-primary);
    border-color: rgba(180, 180, 180, 0.35);
}

.feature-modal-btn .material-icons {
    font-size: 20px !important;
    line-height: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: relative;
    z-index: 2;
    margin: 0 !important;
    padding: 0 !important;
    vertical-align: middle !important;
}

.feature-modal-body {
    height: calc(100% - 81px);
    overflow: hidden;
    position: relative;
    background: var(--bg-primary);
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.25s, 
                transform 0.4s cubic-bezier(0.34, 1.1, 0.64, 1) 0.25s;
}

.feature-modal.show .feature-modal-body {
    opacity: 1;
    transform: translateY(0);
}

.feature-modal-iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: var(--bg-primary);
    transition: opacity 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    opacity: 0;
    transform: scale(1.02);
    will-change: opacity, transform;
}

.feature-modal-iframe.loaded {
    opacity: 1;
    transform: scale(1);
    transition: opacity 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 0.6s cubic-bezier(0.34, 1.1, 0.64, 1);
}

/* 加载状态优化 */
.feature-modal-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    color: var(--text-secondary);
    z-index: 10;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.3s,
                transform 0.3s cubic-bezier(0.34, 1.1, 0.64, 1) 0.3s;
}

.feature-modal.show .feature-modal-loading {
    opacity: 1;
    transform: translateY(0);
}

.feature-modal-loading .loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
    opacity: 0;
    transform: scale(0.8);
    animation-delay: 0.5s;
}

.feature-modal.show .feature-modal-loading .loading-spinner {
    opacity: 1;
    transform: scale(1);
    transition: opacity 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.6s,
                transform 0.4s cubic-bezier(0.34, 1.2, 0.64, 1) 0.6s;
}



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

/* 错误状态 */
.feature-modal-error {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    color: var(--text-secondary);
    z-index: 10;
    padding: 40px;
    text-align: center;
}

.feature-modal-error .material-icons {
    font-size: 64px;
    color: var(--error-color);
    margin-bottom: 20px;
}

.feature-modal-error h3 {
    margin: 0 0 12px 0;
    color: var(--text-primary);
    font-size: 1.2rem;
    font-weight: 600;
}

.feature-modal-error p {
    margin: 0 0 24px 0;
    color: var(--text-secondary);
    line-height: 1.5;
    max-width: 400px;
}

.feature-modal-error .btn {
    padding: 10px 24px;
    border-radius: 8px;
    border: none;
    background: var(--primary-color);
    color: white;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.feature-modal-error .btn:hover {
    background: var(--primary-color-dark);
    transform: translateY(-1px);
}

/* 全屏模式 */
.feature-modal.fullscreen {
    background: rgba(0, 0, 0, 0.95);
}

.feature-modal.fullscreen .feature-modal-content {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    border-radius: 0;
    border: none;
    box-shadow: none;
}

.feature-modal.fullscreen .feature-modal-header {
    padding: 24px 32px;
    min-height: 89px;
    box-sizing: border-box;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(20px);
}

.feature-modal.fullscreen .feature-modal-controls {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 12px !important;
    min-width: 104px !important;
    width: 104px !important;
    height: 44px !important;
    position: relative;
    z-index: 100;
}

.feature-modal.fullscreen .feature-modal-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    max-width: 44px !important;
    max-height: 44px !important;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    vertical-align: top !important;
    top: 0 !important;
    position: relative;
}

.feature-modal.fullscreen .feature-modal-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    border-color: rgba(255, 255, 255, 0.2);
}

.feature-modal.fullscreen .feature-modal-btn.fullscreen {
    background: linear-gradient(135deg, var(--primary-color-15) 0%, var(--primary-color-8) 100%);
    border-color: var(--primary-color-25);
}

.feature-modal.fullscreen .feature-modal-btn.fullscreen:hover {
    background: linear-gradient(135deg, var(--primary-color-25) 0%, var(--primary-color-15) 100%);
    border-color: var(--primary-color-35);
}

.feature-modal.fullscreen .feature-modal-btn.close-btn {
    background: linear-gradient(135deg, rgba(140, 140, 140, 0.18) 0%, rgba(140, 140, 140, 0.12) 100%);
    color: rgba(255, 255, 255, 0.8);
    border-color: rgba(180, 180, 180, 0.3);
}

.feature-modal.fullscreen .feature-modal-btn.close-btn:hover {
    background: linear-gradient(135deg, rgba(160, 160, 160, 0.28) 0%, rgba(160, 160, 160, 0.18) 100%);
    color: rgba(255, 255, 255, 0.95);
    border-color: rgba(200, 200, 200, 0.4);
}

.feature-modal.fullscreen .feature-modal-btn .material-icons {
    font-size: 22px !important;
}

.feature-modal.fullscreen .feature-modal-title {
    flex: 1;
    margin-right: 24px;
    min-width: 0;
    overflow: hidden;
    max-width: calc(100% - 140px);
    font-size: 1.3rem;
}

.feature-modal.fullscreen .feature-modal-title .material-icons {
    font-size: 1.6rem !important;
}

.feature-modal.fullscreen .feature-modal-title .title-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .feature-modal-content {
        width: 100%;
        height: 100%;
        max-width: none;
        max-height: none;
        border-radius: 0;
        border: none;
    }
    
    .feature-modal-header {
        padding: 16px 20px;
        min-height: 69px;
        box-sizing: border-box;
    }
    
    .feature-modal-title {
        font-size: 1.1rem;
        flex: 1;
        margin-right: 16px;
        min-width: 0;
        overflow: hidden;
        max-width: calc(100% - 100px);
    }
    
    .feature-modal-title .title-text {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .feature-modal-title .material-icons {
        font-size: 1.3rem;
        flex-shrink: 0;
    }
    
    .feature-modal-controls {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 6px !important;
        min-width: 84px !important;
        width: 84px !important;
        height: 36px !important;
        position: relative;
        z-index: 100;
    }
    
    .feature-modal-btn {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        min-height: 36px !important;
        max-width: 36px !important;
        max-height: 36px !important;
        border-radius: 8px;
        background: rgba(255, 255, 255, 0.08);
        backdrop-filter: blur(8px);
        border: 1px solid rgba(255, 255, 255, 0.12);
        vertical-align: top !important;
        top: 0 !important;
        position: relative;
    }
    
    .feature-modal-btn:hover {
        background: rgba(255, 255, 255, 0.12);
        transform: translateY(-1px);
        box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
    }
    
    .feature-modal-btn .material-icons {
        font-size: 18px !important;
    }
    
    .feature-modal-btn.fullscreen {
        background: linear-gradient(135deg, var(--primary-color-8) 0%, var(--primary-color-4) 100%);
        border-color: var(--primary-color-15);
    }
    
    .feature-modal-btn.fullscreen:hover {
        background: linear-gradient(135deg, var(--primary-color-15) 0%, var(--primary-color-8) 100%);
        border-color: var(--primary-color-25);
    }
    
    .feature-modal-btn.close-btn {
        background: linear-gradient(135deg, rgba(120, 120, 120, 0.12) 0%, rgba(120, 120, 120, 0.06) 100%);
        color: var(--text-secondary);
        border-color: rgba(160, 160, 160, 0.2);
    }
    
    .feature-modal-btn.close-btn:hover {
        background: linear-gradient(135deg, rgba(140, 140, 140, 0.2) 0%, rgba(140, 140, 140, 0.12) 100%);
        color: var(--text-primary);
        border-color: rgba(180, 180, 180, 0.3);
    }
    
    .feature-modal-body {
        height: calc(100% - 69px);
    }
}

/* 暗色主题适配 */
[data-theme="dark"] .feature-modal {
    background: rgba(0, 0, 0, 0.85);
}

[data-theme="dark"] .feature-modal-content {
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}

/* 动画效果 */
.feature-modal-fade-enter {
    opacity: 0;
}

.feature-modal-fade-enter-active {
    opacity: 1;
    transition: opacity 0.3s ease;
}

.feature-modal-fade-leave {
    opacity: 1;
}

.feature-modal-fade-leave-active {
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* 工具提示已移除 */

/* 键盘快捷键提示 */
.keyboard-shortcut {
    font-size: 0.7rem;
    color: var(--text-tertiary);
    background: var(--code-bg);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
    font-family: 'Monaco', 'Menlo', monospace;
}

/* 防止按钮重叠的强制性规则 */
.feature-modal-header .feature-modal-controls > .feature-modal-btn:first-child {
    margin: 0 !important;
}

.feature-modal-header .feature-modal-controls > .feature-modal-btn:last-child {
    margin: 0 !important;
}

/* 确保按钮在各种情况下都不会重叠 */
.feature-modal .feature-modal-controls .fullscreen-btn,
.feature-modal .feature-modal-controls .close-btn {
    position: relative !important;
    z-index: 10 !important;
    box-sizing: border-box !important;
}

/* 按钮图标样式统一 */
.feature-modal-btn .material-icons {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    height: 100% !important;
    transition: all 0.25s ease;
    line-height: 1 !important;
    margin: 0 !important;
    padding: 0 !important;
    vertical-align: middle !important;
    position: relative;
    top: 0 !important;
    vertical-align: middle !important;
} 