/* TailwindCSS 学习工具自定义样式 */

/* 代码编辑器样式优化 */
.CodeMirror {
    height: 400px !important;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14px;
    line-height: 1.5;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
}

.CodeMirror-focused {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* 课程卡片悬停效果 */
.lesson-card {
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.lesson-card:hover {
    transform: translateY(-2px);
    border-color: #3b82f6;
}

.lesson-card.active {
    border-color: #3b82f6;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
}

/* 预览容器响应式样式 */
.preview-desktop {
    width: 100%;
    max-width: none;
}

.preview-tablet {
    width: 768px;
    max-width: 100%;
    margin: 0 auto;
}

.preview-mobile {
    width: 375px;
    max-width: 100%;
    margin: 0 auto;
}

/* 进度条动画 */
.progress-bar {
    transition: width 0.5s ease-in-out;
}

/* 代码高亮样式 */
.highlight {
    background-color: #fef3c7;
    padding: 2px 4px;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875em;
}

/* 提示框样式 */
.tooltip {
    position: relative;
}

.tooltip:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #1f2937;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 5px;
}

.tooltip:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #1f2937;
    z-index: 1000;
}

/* 滚动条样式 */
.custom-scrollbar::-webkit-scrollbar {
    width: 8px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.pulse {
    animation: pulse 2s infinite;
}

/* 响应式调整 */
@media (max-width: 1024px) {
    .CodeMirror {
        height: 300px !important;
        font-size: 13px;
    }
}

@media (max-width: 768px) {
    .CodeMirror {
        height: 250px !important;
        font-size: 12px;
    }
    
    .lesson-card {
        padding: 1rem;
    }
    
    .preview-tablet,
    .preview-mobile {
        width: 100%;
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    .CodeMirror {
        background-color: #1f2937;
        color: #f9fafb;
    }
    
    .CodeMirror-cursor {
        border-left-color: #f9fafb;
    }
}

/* 打印样式 */
@media print {
    .no-print {
        display: none !important;
    }
    
    .CodeMirror {
        height: auto !important;
        border: 1px solid #000;
    }
}

/* 辅助功能 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* 焦点样式 */
.focus-visible:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* 加载状态 */
.loading {
    pointer-events: none;
    opacity: 0.6;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #3b82f6;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 错误状态 */
.error {
    border-color: #ef4444 !important;
    background-color: #fef2f2;
}

.error-message {
    color: #dc2626;
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

/* 成功状态 */
.success {
    border-color: #10b981 !important;
    background-color: #f0fdf4;
}

.success-message {
    color: #059669;
    font-size: 0.875rem;
    margin-top: 0.5rem;
}