/* 模态框遮罩层 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* 模态框主体 */
.modal {
    background: white;
    border-radius: 16px;
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    transform: scale(0.7) translateY(50px);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

/* 模态框头部 */
.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6b7280;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: #f3f4f6;
    color: #374151;
}

/* 模态框内容区域 */
.modal-content {
    padding: 24px;
    max-height: 70vh;
    overflow-y: auto;
}

.modal-content::-webkit-scrollbar {
    width: 6px;
}

.modal-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 图文混排样式 */
.content-section {
    margin-bottom: 2rem;
}

.content-section:last-child {
    margin-bottom: 0;
}

.content-text {
    font-size: 16px;
    line-height: 1.7;
    color: #374151;
    margin-bottom: 1rem;
}

.content-image {
    width: 100%;
    max-width: 500px;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    margin: 1rem 0;
    transition: transform 0.3s ease;
}

.content-image:hover {
    transform: scale(1.02);
}

.image-caption {
    font-size: 14px;
    color: #6b7280;
    text-align: center;
    margin-top: 0.5rem;
    font-style: italic;
}

/* 图片网格布局 */
.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.image-grid .content-image {
    margin: 0;
    width: 100%;
    height: 200px;
    object-fit: cover;
}

/* 文字围绕图片 */
.text-wrap-left {
    float: left;
    margin: 0 1rem 1rem 0;
    max-width: 300px;
}

.text-wrap-right {
    float: right;
    margin: 0 0 1rem 1rem;
    max-width: 300px;
}

.clearfix::after {
    content: "";
    display: table;
    clear: both;
}

/* 暗色主题 */
[data-theme="dark"] body {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

[data-theme="dark"] .theme-toggle {
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.2);
}

[data-theme="dark"] .theme-toggle:hover {
    background: rgba(0,0,0,0.5);
}

[data-theme="dark"] .demo-btn {
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.2);
}

[data-theme="dark"] .demo-btn:hover {
    background: rgba(0,0,0,0.5);
}

[data-theme="dark"] .modal {
    background: #1f2937;
    color: #f9fafb;
}

[data-theme="dark"] .modal-header {
    background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
    border-bottom: 1px solid #374151;
}

[data-theme="dark"] .modal-title {
    color: #f9fafb;
}

[data-theme="dark"] .modal-close {
    color: #9ca3af;
}

[data-theme="dark"] .modal-close:hover {
    background: #374151;
    color: #f3f4f6;
}

[data-theme="dark"] .content-text {
    color: #d1d5db;
}

[data-theme="dark"] .image-caption {
    color: #9ca3af;
}

[data-theme="dark"] .modal-content::-webkit-scrollbar-track {
    background: #374151;
}

[data-theme="dark"] .modal-content::-webkit-scrollbar-thumb {
    background: #6b7280;
}

[data-theme="dark"] .modal-content::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .modal {
        max-width: 95vw;
        margin: 20px;
    }
    
    .modal-header {
        padding: 16px 20px;
    }
    
    .modal-content {
        padding: 20px;
    }
    
    .text-wrap-left,
    .text-wrap-right {
        float: none;
        margin: 1rem 0;
        max-width: 100%;
    }
    
    .image-grid {
        grid-template-columns: 1fr;
    }
}

/* 动画增强 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.content-section {
    animation: fadeInUp 0.6s ease forwards;
}

.content-section:nth-child(2) { animation-delay: 0.1s; }
.content-section:nth-child(3) { animation-delay: 0.2s; }
.content-section:nth-child(4) { animation-delay: 0.3s; }