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

:root {
    --primary-color: #2196F3;
    --primary-dark: #1976D2;
    --text-color: #333;
    --bg-color: #f5f5f5;
    --card-bg: #fff;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-hover: 0 8px 25px rgba(0,0,0,0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

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

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 60px 0;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* Main Content */
.main {
    padding: 40px 0;
    min-height: 60vh;
}

/* Category Menu */
.category-menu {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 30px;
    padding: 0 20px;
}

.category-btn {
    padding: 12px 24px;
    border: 2px solid #e1e8ed;
    background: white;
    color: #666;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 25px;
    transition: all 0.3s ease;
}

.category-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.15);
}

.category-btn.active {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 4px 15px rgba(33, 150, 243, 0.3);
}

/* Search Container */
.search-container {
    margin-bottom: 40px;
    padding: 0 20px;
}

.search-box {
    display: flex;
    max-width: 600px;
    margin: 0 auto;
    background: white;
    border-radius: 50px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}

.search-box:focus-within {
    box-shadow: 0 6px 30px rgba(33, 150, 243, 0.2);
}

.search-box input {
    flex: 1;
    padding: 18px 30px;
    border: none;
    font-size: 1.1rem;
    outline: none;
    background: transparent;
}

.search-box input::placeholder {
    color: #999;
}

.search-box .clear-btn {
    padding: 0 15px;
    background: transparent;
    border: none;
    color: #999;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.search-box .clear-btn:hover {
    color: #ff4444;
    transform: scale(1.1);
}

.search-box .clear-btn svg {
    stroke-width: 2.5;
}

.search-box button {
    padding: 0 25px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.search-box button:hover {
    background: linear-gradient(135deg, var(--primary-dark), #0d47a1);
}

.search-stats {
    text-align: center;
    margin-top: 15px;
    color: #666;
    font-size: 0.95rem;
    min-height: 24px;
}

.search-stats.highlight {
    color: var(--primary-color);
    font-weight: 500;
}

/* Highlight matched text */
.highlight-match {
    background: linear-gradient(120deg, #ffeb3b 0%, #ffeb3b 100%);
    background-repeat: no-repeat;
    background-size: 100% 40%;
    background-position: 0 88%;
    padding: 0 4px;
    border-radius: 3px;
}

/* Projects Grid - 固定4列布局 */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 25px;
    padding: 20px 0;
}

/* Project Card */
.project-card {
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    cursor: pointer;
}

.project-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.project-image {
    width: 100%;
    height: 160px;
    object-fit: cover;
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    font-size: 3rem;
}

.project-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.project-info {
    padding: 20px;
}

.project-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.project-name {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-color);
    flex: 1;
    line-height: 1.4;
}

.category-badge {
    display: inline-block;
    padding: 4px 10px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 12px;
    white-space: nowrap;
    flex-shrink: 0;
}

.project-date {
    font-size: 0.9rem;
    color: #666;
    display: flex;
    align-items: center;
    gap: 5px;
}

.project-date::before {
    content: '📅';
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.8);
    overflow-y: auto;
    opacity: 1;
    visibility: visible;
}

.modal[style*="display: block"],
.modal.active {
    display: block !important;
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 1000px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

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

.close-btn:hover {
    color: #000;
}

/* Modal Header */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.modal-header h2 {
    margin: 0;
    color: var(--text-color);
}

/* Thumbnails Grid */
.modal-images {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
    padding: 10px 0;
}

.thumbnail {
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    aspect-ratio: 1;
}

.thumbnail:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Lightbox Styles */
.lightbox {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    justify-content: center;
    align-items: center;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 40px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 2001;
    transition: color 0.3s;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.lightbox-close:hover {
    color: #ff6b6b;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.3s;
    z-index: 2001;
    user-select: none;
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: translateY(-50%) scale(1.1);
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

.lightbox-counter {
    color: white;
    font-size: 16px;
    margin-top: 15px;
    text-align: center;
    background: rgba(0,0,0,0.6);
    padding: 8px 20px;
    border-radius: 20px;
}

/* Pagination */
.pagination-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin-top: 40px;
    padding: 30px 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.pagination {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.page-btn {
    padding: 10px 16px;
    border: 1px solid #e1e8ed;
    background: white;
    color: #333;
    font-size: 0.95rem;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.3s ease;
    min-width: 40px;
}

.page-btn:hover:not(:disabled) {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    font-weight: 600;
}

.page-numbers {
    display: flex;
    gap: 6px;
}

.page-jump {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
    color: #666;
}

.page-jump input {
    width: 60px;
    padding: 8px 12px;
    border: 1px solid #e1e8ed;
    border-radius: 6px;
    text-align: center;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.3s;
}

.page-jump input:focus {
    border-color: var(--primary-color);
}

.page-info {
    color: #666;
    font-size: 0.9rem;
}

/* Footer */
.footer {
    background: var(--text-color);
    color: white;
    text-align: center;
    padding: 30px 0;
    margin-top: 60px;
}

/* Loading State */
.loading {
    text-align: center;
    padding: 60px 20px;
    color: #666;
    font-size: 1.1rem;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--primary-color);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
    vertical-align: middle;
}

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

/* Empty State */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: #666;
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: var(--text-color);
}

/* Responsive Design */
@media (max-width: 768px) {
    .header h1 {
        font-size: 2rem;
    }
    
    .header p {
        font-size: 1rem;
    }
    
    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .project-image {
        height: 180px;
    }
    
    .modal-content {
        margin: 10% auto;
        padding: 20px;
        width: 95%;
    }
    
    .modal-header {
        flex-direction: column;
        gap: 10px;
    }
    
    .modal-header h2 {
        font-size: 1.5rem;
    }
    
    .modal-images {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 10px;
    }
    
    /* Category Menu Mobile */
    .category-menu {
        gap: 8px;
        padding: 0 10px;
    }
    
    .category-btn {
        padding: 10px 18px;
        font-size: 0.85rem;
    }
    
    /* Lightbox Mobile */
    .lightbox-close {
        top: 10px;
        right: 20px;
        font-size: 30px;
    }
    
    .lightbox-nav {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
    
    .lightbox-prev {
        left: 10px;
    }
    
    .lightbox-next {
        right: 10px;
    }
    
    .lightbox-counter {
        font-size: 14px;
        padding: 6px 15px;
    }
}

@media (max-width: 480px) {
    .projects-grid {
        grid-template-columns: 1fr;
    }
    
    .project-image {
        height: 200px;
    }
    
    .header {
        padding: 40px 0;
    }
    
    .header h1 {
        font-size: 1.75rem;
    }
    
    .modal-images {
        grid-template-columns: 1fr;
    }
    
    /* Mobile Category Menu - Horizontal scroll */
    .category-menu {
        flex-wrap: nowrap;
        overflow-x: auto;
        justify-content: flex-start;
        padding: 0 10px 10px;
        gap: 8px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    
    .category-menu::-webkit-scrollbar {
        display: none;
    }
    
    .category-btn {
        padding: 10px 16px;
        font-size: 0.85rem;
        white-space: nowrap;
        flex-shrink: 0;
    }
    
    /* Mobile Search */
    .search-box {
        margin: 0 10px;
    }
    
    .search-box input {
        padding: 14px 20px;
        font-size: 1rem;
    }
    
    .search-box button {
        padding: 0 20px;
    }
    
    .search-container {
        padding: 0 10px;
    }
    
    /* Mobile Pagination */
    .pagination-container {
        padding: 15px 10px;
        gap: 12px;
    }
    
    .pagination {
        gap: 4px;
    }
    
    .page-btn {
        padding: 8px 10px;
        font-size: 0.8rem;
        min-width: 32px;
    }
    
    .page-numbers {
        gap: 3px;
    }
    
    .page-jump {
        font-size: 0.8rem;
        gap: 6px;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .page-jump input {
        width: 50px;
        padding: 6px;
    }
    
    .page-info {
        font-size: 0.8rem;
        text-align: center;
    }
}
    
    /* Mobile Pagination */
    .pagination-container {
        padding: 20px 15px;
        gap: 15px;
    }
    
    .pagination {
        gap: 5px;
    }
    
    .page-btn {
        padding: 8px 12px;
        font-size: 0.85rem;
        min-width: 36px;
    }
    
    .page-numbers {
        gap: 4px;
    }
    
    .page-jump {
        font-size: 0.85rem;
        gap: 8px;
    }
    
    .page-jump input {
        width: 50px;
        padding: 6px 8px;
    }
}

@media (max-width: 480px) {
    .projects-grid {
        grid-template-columns: 1fr;
    }
    
    .header {
        padding: 40px 0;
    }
    
    .header h1 {
        font-size: 1.75rem;
    }
    
    .modal-images {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .thumbnail {
        aspect-ratio: 1;
    }
    
    .search-box {
        border-radius: 30px;
    }
    
    .search-box input {
        padding: 12px 18px;
    }
}
    
    .thumbnail {
        aspect-ratio: 1;
    }
}