* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

.header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
    animation: fadeInDown 0.8s ease-out;
}

.header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.subtitle {
    font-size: 1.2em;
    opacity: 0.9;
}

.repo-links {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}

.repo-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    text-decoration: none;
    border-radius: 25px;
    font-size: 0.9em;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.repo-link:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.repo-link.github:hover {
    background: #24292e;
    color: white;
}

.repo-link.gitee:hover {
    background: #c71d23;
    color: white;
}

.search-box {
    text-align: center;
    margin-bottom: 30px;
    animation: fadeIn 1s ease-out;
}

#searchInput {
    width: 100%;
    max-width: 500px;
    padding: 15px 20px;
    font-size: 16px;
    border: none;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    outline: none;
    transition: all 0.3s ease;
}

#searchInput:focus {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
    animation: fadeInUp 1s ease-out;
}

.project-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2);
}

.project-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.project-icon {
    font-size: 3em;
    margin-bottom: 15px;
}

.project-title {
    font-size: 1.5em;
    font-weight: bold;
    margin-bottom: 10px;
    color: #667eea;
}

.project-description {
    color: #666;
    font-size: 0.95em;
    margin-bottom: 15px;
    line-height: 1.5;
}

.project-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85em;
    color: #999;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.file-count {
    display: flex;
    align-items: center;
    gap: 5px;
}

.project-link {
    display: inline-block;
    margin-top: 10px;
    padding: 8px 20px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    text-decoration: none;
    border-radius: 20px;
    font-size: 0.9em;
    transition: all 0.3s ease;
}

.project-link:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.footer {
    text-align: center;
    color: white;
    padding: 20px;
    opacity: 0.8;
    animation: fadeIn 1.5s ease-out;
}

.no-results {
    text-align: center;
    padding: 60px 20px;
    color: white;
    font-size: 1.2em;
}

.no-results-icon {
    font-size: 4em;
    margin-bottom: 20px;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

/* Code Viewer Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 15px;
    width: 90%;
    max-width: 1000px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: slideIn 0.3s ease;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 2px solid #f0f0f0;
}

.modal-header h2 {
    margin: 0;
    color: #667eea;
}

.close {
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close:hover {
    color: #333;
}

.modal-body {
    padding: 20px 25px;
    overflow-y: auto;
    flex: 1;
}

.file-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.file-tab {
    padding: 8px 16px;
    background: #f5f5f5;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.3s ease;
}

.file-tab:hover {
    background: #e0e0e0;
}

.file-tab.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.code-container {
    background: #2d2d2d;
    border-radius: 10px;
    overflow: auto;
    max-height: 60vh;
    /* Enable smooth scrolling */
    -webkit-overflow-scrolling: touch;
    /* Enable horizontal scroll with better UX */
    overflow-x: auto;
    overflow-y: auto;
    /* Add scroll indicators */
    scrollbar-width: thin;
    scrollbar-color: #667eea #2d2d2d;
}

.code-container::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.code-container::-webkit-scrollbar-track {
    background: #2d2d2d;
    border-radius: 10px;
}

.code-container::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

.code-container::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}

.code-container pre {
    margin: 0;
    padding: 20px;
    /* Prevent text wrapping for better horizontal scroll */
    white-space: pre;
    min-width: max-content;
}

.code-container code {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    /* Enable text selection */
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
}

/* Mobile: Enable pinch-to-zoom for code */
@media (max-width: 768px) {
    .code-container {
        /* Allow pinch zoom on mobile */
        touch-action: pan-x pan-y pinch-zoom;
    }
    
    .code-container code {
        /* Larger font on mobile for better readability */
        font-size: 13px;
    }
}

/* AI Assistant Widget */
.ai-widget {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 999;
}

.ai-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none;
    font-size: 28px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
}

.ai-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(102, 126, 234, 0.6);
}

.ai-panel {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    max-height: 500px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
}

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

.ai-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-radius: 15px 15px 0 0;
}

.ai-header h3 {
    margin: 0;
    font-size: 1.1em;
}

.ai-close {
    cursor: pointer;
    font-size: 24px;
    font-weight: bold;
}

.ai-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    max-height: 350px;
    min-height: 200px;
}

.ai-message {
    margin-bottom: 15px;
    padding: 10px 15px;
    border-radius: 10px;
    font-size: 0.9em;
    line-height: 1.5;
    animation: fadeIn 0.3s ease;
}

.ai-message.user {
    background: #667eea;
    color: white;
    margin-left: 20px;
    text-align: right;
}

.ai-message.ai {
    background: #f5f5f5;
    color: #333;
    margin-right: 20px;
}

.ai-input-container {
    display: flex;
    padding: 15px;
    border-top: 1px solid #eee;
    gap: 10px;
}

.ai-input-container input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 0.9em;
    outline: none;
}

.ai-input-container input:focus {
    border-color: #667eea;
}

.ai-input-container button {
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.3s ease;
}

.ai-input-container button:hover {
    transform: scale(1.05);
}

.view-code-btn {
    display: inline-block;
    margin-top: 10px;
    margin-right: 10px;
    padding: 8px 20px;
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
    text-decoration: none;
    border-radius: 20px;
    font-size: 0.9em;
    transition: all 0.3s ease;
    cursor: pointer;
}

.view-code-btn:hover {
    background: #667eea;
    color: white;
    transform: scale(1.05);
}

.view-repo-btn {
    display: inline-block;
    margin-top: 10px;
    padding: 8px 20px;
    background: white;
    color: #764ba2;
    border: 2px solid #764ba2;
    text-decoration: none;
    border-radius: 20px;
    font-size: 0.9em;
    transition: all 0.3s ease;
    cursor: pointer;
}

.view-repo-btn:hover {
    background: #764ba2;
    color: white;
    transform: scale(1.05);
}

/* Repository Modal Styles */
.repo-modal-content {
    max-width: 600px;
}

.repo-modal-body {
    padding: 30px 25px;
}

.repo-modal-description {
    text-align: center;
    color: #666;
    margin-bottom: 25px;
    font-size: 1.1em;
}

.repo-options {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.repo-option {
    display: flex;
    align-items: center;
    padding: 20px;
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    text-decoration: none;
    color: #333;
    transition: all 0.3s ease;
    cursor: pointer;
}

.repo-option:hover {
    transform: translateX(5px);
    border-color: #667eea;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
}

.repo-option.github-option:hover {
    border-color: #24292e;
    background: #f6f8fa;
}

.repo-option.gitee-option:hover {
    border-color: #c71d23;
    background: #fff5f5;
}

.repo-option-icon {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 10px;
    margin-right: 20px;
}

.github-option .repo-option-icon {
    color: #24292e;
}

.gitee-option .repo-option-icon {
    color: #c71d23;
}

.repo-option-content {
    flex: 1;
}

.repo-option-content h3 {
    margin: 0 0 5px 0;
    font-size: 1.3em;
    color: #333;
}

.repo-option-content p {
    margin: 0;
    color: #666;
    font-size: 0.9em;
}

.repo-option-arrow {
    font-size: 1.5em;
    color: #999;
    margin-left: 10px;
    transition: all 0.3s ease;
}

.repo-option:hover .repo-option-arrow {
    transform: translateX(5px);
    color: #667eea;
}

.github-option:hover .repo-option-arrow {
    color: #24292e;
}

.gitee-option:hover .repo-option-arrow {
    color: #c71d23;
}

/* Preview Button Styles */
.view-preview-btn {
    display: inline-block;
    margin-top: 10px;
    padding: 8px 20px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    text-decoration: none;
    border-radius: 20px;
    font-size: 0.9em;
    transition: all 0.3s ease;
    cursor: pointer;
}

.view-preview-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* Preview Modal Option Styles */
.preview-option {
    display: flex;
    align-items: center;
    padding: 20px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.3s ease;
    margin-bottom: 15px;
}

.preview-option:last-child {
    margin-bottom: 0;
}

.preview-option:hover {
    border-color: #667eea;
    background: #f8f9ff;
    transform: translateX(5px);
}

.preview-option .repo-option-icon svg {
    fill: #667eea;
}

.preview-option:hover .repo-option-icon svg {
    fill: #764ba2;
}

.preview-option:hover .repo-option-arrow {
    color: #667eea;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .header h1 {
        font-size: 2em;
    }
    
    .project-grid {
        grid-template-columns: 1fr;
    }
    
    body {
        padding: 10px;
    }
    
    .repo-links {
        flex-direction: column;
        align-items: center;
    }
    
    .modal-content {
        width: 95%;
        max-height: 95vh;
    }
    
    .repo-modal-content {
        width: 95%;
        max-width: 95vw;
    }
    
    .repo-option {
        padding: 15px;
    }
    
    .repo-option-icon {
        width: 50px;
        height: 50px;
        margin-right: 15px;
    }
    
    .repo-option-icon svg {
        width: 30px;
        height: 30px;
    }
    
    .repo-option-content h3 {
        font-size: 1.1em;
    }
    
    .repo-option-content p {
        font-size: 0.85em;
    }
    
    .ai-panel {
        width: 90vw;
        right: 5vw;
    }
    
    .ai-widget {
        right: 15px;
        bottom: 15px;
    }
}
