/**
 * 教程功能模态窗口样式
 * 基于index.html的FeatureModal样式定制
 */

/* 工作流程步骤点击样式 */
.workflow-step {
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.workflow-step::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 16px;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.3s ease;
}

.workflow-step:hover::after {
    opacity: 1;
    transform: translateY(-50%) scale(1.1);
}

.workflow-step:hover .step-function {
    color: #667eea;
    transition: color 0.3s ease;
}

.step-function {
    position: relative;
}

/* 模态窗口样式 - 默认最大化 */
.feature-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0; /* 最大化时无padding */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    overflow: hidden; /* 防止模态窗口内容溢出 */
    box-sizing: border-box; /* 确保padding不影响居中计算 */
}

.feature-modal.show {
    opacity: 1;
    visibility: visible;
}

/* 禁止背景滚动的样式 */
body.modal-open {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    height: 100% !important;
    top: 0 !important;
    left: 0 !important;
}

/* 禁止所有子元素滚动 */
body.modal-open * {
    overflow: visible !important;
}

/* 确保html元素也不滚动 */
html.modal-open {
    overflow: hidden !important;
    height: 100% !important;
}

/* 禁用触摸滚动 */
body.modal-open {
    -webkit-overflow-scrolling: auto !important;
    touch-action: none !important;
}

/* 防止滚动条闪烁 */
body.modal-open {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

body.modal-open::-webkit-scrollbar {
    display: none; /* Chrome, Safari and Opera */
}

/* 隐藏返回首页按钮 */
.back-to-home {
    display: none !important;
}

/* 阻止鼠标滚轮事件 */
.feature-modal {
    pointer-events: auto;
}

.feature-modal .modal-backdrop {
    pointer-events: auto;
}

/* 确保模态窗口内部可以正常交互 */
.modal-container {
    pointer-events: auto;
}

/* 背景遮罩 */
.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* 模态窗口容器 - 默认最大化 */
.modal-container {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    min-height: 100%;
    background: white;
    border-radius: 0;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border: none;
    margin: 0; /* 最大化时不需要margin */
}

.feature-modal.show .modal-container {
    transform: scale(1);
}

/* 模态窗口头部 */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    flex-shrink: 0;
}

.modal-title {
    font-size: 1.4rem;
    font-weight: 600;
    margin: 0;
    color: white;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.modal-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-control-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.modal-control-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.modal-control-btn .material-icons {
    font-size: 20px;
}

/* 模态窗口内容区域 */
.modal-content {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #f8fafc;
}

/* iframe样式 */
.feature-iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.feature-iframe[style*="block"] {
    opacity: 1;
}

/* 加载状态 */
.modal-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    z-index: 10;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

.loading-text {
    font-size: 1rem;
    color: #64748b;
    font-weight: 500;
    margin: 0;
    text-align: center;
}

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

/* 错误状态 */
.modal-error {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    color: #991b1b;
    text-align: center;
    padding: 40px;
    z-index: 10;
}

.modal-error .material-icons {
    font-size: 64px;
    color: #dc2626;
    margin-bottom: 16px;
}

.modal-error h3 {
    font-size: 1.5rem;
    margin: 0 0 12px 0;
    font-weight: 600;
}

.modal-error p {
    font-size: 1rem;
    color: #7f1d1d;
    margin: 0 0 24px 0;
    line-height: 1.6;
    max-width: 400px;
}

.retry-btn {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.retry-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(220, 38, 38, 0.4);
}

/* 全屏模式 */
.feature-modal.fullscreen {
    padding: 0;
}

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

/* 响应式设计 */
@media (max-width: 768px) {
    .feature-modal {
        padding: 0; /* 移动端也保持最大化 */
        align-items: center;
        justify-content: center;
    }
    
    .modal-container {
        height: 100%; /* 移动端也保持最大化 */
        min-height: 100%;
        margin: 0;
        border-radius: 0;
    }
    
    .modal-header {
        padding: 16px 20px;
    }
    
    .modal-title {
        font-size: 1.2rem;
    }
    
    .modal-control-btn {
        width: 36px;
        height: 36px;
    }
    
    .modal-control-btn .material-icons {
        font-size: 18px;
    }
    
    .loading-spinner {
        width: 40px;
        height: 40px;
        border-width: 3px;
    }
    
    .modal-error .material-icons {
        font-size: 48px;
    }
    
    .modal-error h3 {
        font-size: 1.3rem;
    }
}

@media (max-width: 480px) {
    .feature-modal {
        padding: 0; /* 小屏幕也保持最大化 */
        align-items: center;
        justify-content: center;
    }
    
    .modal-container {
        height: 100%; /* 小屏幕也保持最大化 */
        border-radius: 0;
        margin: 0;
    }
    
    .modal-header {
        padding: 12px 16px;
    }
    
    .modal-title {
        font-size: 1.1rem;
    }
    
    .modal-controls {
        gap: 6px;
    }
    
    .modal-control-btn {
        width: 32px;
        height: 32px;
    }
    
    .modal-control-btn .material-icons {
        font-size: 16px;
    }
    
    .modal-error {
        padding: 24px 16px;
    }
    
    .modal-error p {
        font-size: 0.9rem;
    }
    
    .retry-btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
}

/* 暗色主题支持 */
@media (prefers-color-scheme: dark) {
    .modal-container {
        background: #1e293b;
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    .modal-content {
        background: #0f172a;
    }
    
    .feature-iframe {
        background: #1e293b;
    }
    
    .modal-loading {
        background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    }
    
    .loading-text {
        color: #cbd5e1;
    }
    
    .loading-spinner {
        border-color: #374151;
        border-top-color: #667eea;
    }
}

/* 点击反馈动画 */
.workflow-step:active {
    transform: translate3d(6px, 0, 0) scale(0.98);
    transition: transform 0.1s ease;
}

/* 无障碍支持 */
@media (prefers-reduced-motion: reduce) {
    .feature-modal,
    .modal-container,
    .modal-control-btn,
    .workflow-step,
    .loading-spinner {
        transition: none;
        animation: none;
    }
}

/* 提升层级确保显示在最前面 */
.feature-modal {
    z-index: 999999;
} 