/* Reset and base styles */
* {
    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;
    line-height: 1.6;
    color: #333;
    background-color: #f7f9fc;
}

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

/* Header */
.header {
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar {
    padding: 1rem 0;
    background: #2c3e50;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.foundation-logo {
    display: flex;
    align-items: center;
}

.foundation-logo a {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: 8px;
    transition: background-color 0.3s;
}

.foundation-logo a:hover {
    background-color: rgba(255,255,255,0.1);
}

.foundation-logo-img {
    height: 32px;
    width: auto;
    object-fit: contain;
    border-radius: 0;
    max-width: 68px;
}

.foundation-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: #ffffff;
}

.nav-separator {
    width: 1px;
    height: 30px;
    background-color: rgba(255,255,255,0.2);
    margin: 0 0.5rem;
}

.nav-logo a {
    text-decoration: none;
    color: inherit;
}

.nav-logo a:hover {
    text-decoration: none;
}

.nav-logo h1 {
    color: #ffffff;
    font-size: 1.5rem;
    font-weight: 600;
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.lang-switch {
    padding: 0.5rem 1rem;
    background: #2c5aa0;
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.3s;
}

.lang-switch:hover {
    background: #1e3d6f;
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #ffffff;
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4rem 0;
    text-align: center;
}

.hero-content h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    font-weight: 300;
}

.hero-content p {
    font-size: 1.2rem;
    max-width: 600px;
    margin: 0 auto;
    opacity: 0.9;
}

.hero-content a {
    display: inline-block;
    padding: 0.8rem 2rem;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    text-decoration: none;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    margin-top: 0.5rem;
}

.hero-content a:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.hero-content a p {
    margin: 0;
    font-size: inherit;
}

/* Stages Section */
.stages-section {
    padding: 4rem 0;
    background: white;
}

.stages-section h3 {
    text-align: center;
    margin-bottom: 3rem;
    font-size: 2rem;
    color: #2c5aa0;
}

.stages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.stage-card {
    background: #f8f9fa;
    padding: 2rem;
    border-radius: 10px;
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
    border: 1px solid #e9ecef;
    text-decoration: none;
    color: inherit;
    display: block;
}

.stage-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    text-decoration: none;
    color: inherit;
}

.stage-card i {
    font-size: 3rem;
    color: #2c5aa0;
    margin-bottom: 1rem;
}

.stage-card h4 {
    margin-bottom: 1rem;
    color: #2c5aa0;
    font-size: 1.3rem;
}

.stage-card p {
    color: #666;
    line-height: 1.5;
}

/* Services Section */
.services-section {
    padding: 4rem 0;
    background: #f7f9fc;
}

.services-section h3 {
    text-align: center;
    margin-bottom: 3rem;
    font-size: 2rem;
    color: #2c5aa0;
}

/* Overview Section */
.overview-section {
    padding: 4rem 0;
    background: #ffffff;
}

.overview-section h3 {
    text-align: center;
    margin-bottom: 1rem;
    font-size: 2rem;
    color: #2c5aa0;
}

.overview-section > .container > p {
    text-align: center;
    margin-bottom: 3rem;
    color: #666;
    font-size: 1.1rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.overview-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
}

.overview-card {
    background: #f8f9fa;
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid #e9ecef;
    text-decoration: none;
    color: inherit;
    display: block;
    transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s;
    position: relative;
    overflow: hidden;
}

.overview-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #2c5aa0, #667eea);
    transform: scaleX(0);
    transition: transform 0.3s;
}

.overview-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    border-color: #2c5aa0;
    text-decoration: none;
    color: inherit;
}

.overview-card:hover::before {
    transform: scaleX(1);
}

.overview-card .card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e9ecef;
}

.overview-card .card-header i {
    font-size: 2.5rem;
    color: #2c5aa0;
    flex-shrink: 0;
}

.overview-card .card-header h4 {
    margin: 0;
    color: #2c5aa0;
    font-size: 1.4rem;
    font-weight: 600;
}

.overview-card p {
    color: #666;
    line-height: 1.6;
    margin: 0;
    font-size: 1rem;
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.service-card {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    border: 1px solid #e9ecef;
    text-decoration: none;
    color: inherit;
    display: block;
}

.service-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    text-decoration: none;
    color: inherit;
}

.service-card i {
    font-size: 3rem;
    color: #28a745;
    margin-bottom: 1rem;
}

.service-card h4 {
    margin-bottom: 1rem;
    color: #2c5aa0;
    font-size: 1.3rem;
}

.service-card p {
    color: #666;
    line-height: 1.5;
}

/* Navigation styles */
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #f8f9fa;
    color: #2c5aa0;
    text-decoration: none;
    border-radius: 20px;
    font-weight: 500;
    transition: background-color 0.3s;
}

.back-btn:hover {
    background: #e9ecef;
    text-decoration: none;
    color: #1e3d6f;
}

/* Service Page Styles */
.service-page {
    min-height: calc(100vh - 200px);
}

.service-hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 3rem 0;
    text-align: center;
}

.service-hero-content {
    max-width: 800px;
    margin: 0 auto;
}

.service-icon {
    margin-bottom: 1.5rem;
}

.service-icon i {
    font-size: 4rem;
    opacity: 0.9;
}

.service-hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    font-weight: 300;
}

.service-hero p {
    font-size: 1.1rem;
    opacity: 0.9;
    line-height: 1.6;
}

.service-content {
    padding: 4rem 0;
    background: white;
}

.content-wrapper {
    max-width: 900px;
    margin: 0 auto;
}

.markdown-content {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    line-height: 1.8;
}

.markdown-content h1 {
    color: #2c5aa0;
    font-size: 2.2rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 0.5rem;
}

.markdown-content h2 {
    color: #2c5aa0;
    font-size: 1.8rem;
    margin: 2rem 0 1rem 0;
}

.markdown-content h3 {
    color: #495057;
    font-size: 1.4rem;
    margin: 1.5rem 0 1rem 0;
}

.markdown-content h4 {
    color: #2c5aa0;
    font-size: 1.2rem;
    margin: 1.5rem 0 1rem 0;
}

.markdown-content ul {
    margin: 1rem 0;
    padding-left: 2rem;
}

.markdown-content li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.markdown-content a {
    color: #28a745;
    text-decoration: none;
    font-weight: 500;
}

.markdown-content a:hover {
    text-decoration: underline;
}

.markdown-content strong {
    color: #2c5aa0;
    font-weight: 600;
}

/* Ordered lists */
.markdown-content ol {
    margin: 1rem 0;
    padding-left: 2rem;
}

.markdown-content ol li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

/* Tables */
.markdown-content .markdown-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border-radius: 6px;
    overflow: hidden;
}

.markdown-content .markdown-table th {
    background: #2c5aa0;
    color: white;
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    font-size: 0.95rem;
}

.markdown-content .markdown-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #e9ecef;
    color: #495057;
    font-size: 0.9rem;
}

.markdown-content .markdown-table tr:last-child td {
    border-bottom: none;
}

.markdown-content .markdown-table tr:nth-child(even) {
    background: #f8f9fa;
}

.markdown-content .markdown-table tr:hover {
    background: #e3f2fd;
}

/* Images */
.markdown-content .markdown-image {
    max-width: 100%;
    height: auto;
    margin: 1.5rem 0;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: block;
}

.markdown-content .markdown-image + em {
    display: block;
    text-align: center;
    font-style: italic;
    color: #6c757d;
    font-size: 0.9rem;
    margin-top: 0.5rem;
    margin-bottom: 1.5rem;
}

.loading-spinner {
    text-align: center;
    padding: 3rem;
    color: #6c757d;
}

.loading-spinner i {
    font-size: 2rem;
    margin-bottom: 1rem;
    display: block;
}

/* Contribute Section */
.contribute-section {
    padding: 3rem 0;
    background: #f7f9fc;
}

.contribute-card {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    max-width: 600px;
    margin: 0 auto;
}

.contribute-card h3 {
    color: #2c5aa0;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.contribute-card p {
    color: #666;
    margin-bottom: 2rem;
    line-height: 1.6;
}

.contribute-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.edit-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: #28a745;
    color: white;
    text-decoration: none;
    border-radius: 25px;
    font-weight: 500;
    transition: background-color 0.3s, transform 0.3s;
}

.edit-btn:hover {
    background: #218838;
    text-decoration: none;
    color: white;
    transform: translateY(-2px);
}

.edit-btn i {
    font-size: 1.1rem;
}

/* Footer */
.footer {
    background: #2c5aa0;
    color: white;
    padding: 3rem 0 1rem 0;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h4 {
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.footer-section p {
    line-height: 1.6;
    opacity: 0.9;
}

.footer-section a {
    color: white;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.footer-section a:hover {
    text-decoration: underline;
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid rgba(255,255,255,0.2);
    opacity: 0.8;
}

/* Responsive Design */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block;
    }
    
    .nav-left {
        flex: 1;
        display: flex;
        align-items: center;
        gap: 0.5rem;
        min-width: 0;
    }
    
    .foundation-name {
        display: none;
    }
    
    .nav-logo h1 {
        font-size: 1.1rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .nav-separator {
        height: 20px;
        margin: 0 0.25rem;
    }
    
    .hero-content h2 {
        font-size: 2rem;
    }
    
    .hero-content p {
        font-size: 1rem;
    }
    
    .stages-grid,
    .services-grid,
    .overview-cards {
        grid-template-columns: 1fr;
    }
    
    .overview-card .card-header {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }
    
    .overview-card .card-header i {
        font-size: 2rem;
    }
    
    .overview-card .card-header h4 {
        font-size: 1.2rem;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
    
    .modal-body {
        padding: 1.5rem;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

@media (max-width: 480px) {
    .nav-container {
        padding: 0 10px;
    }
    
    .nav-left {
        gap: 0.25rem;
        min-width: 0;
        flex: 1;
    }
    
    .foundation-logo-img {
        width: 24px;
        height: auto;
        max-height: 24px;
    }
    
    .nav-logo h1 {
        font-size: 0.9rem;
    }
    
    .nav-separator {
        display: none;
    }
    
    .hero {
        padding: 2rem 0;
    }
    
    .hero-content h2 {
        font-size: 1.5rem;
    }
    
    .stages-section,
    .services-section {
        padding: 2rem 0;
    }
    
    .stage-card,
    .service-card {
        padding: 1.5rem;
    }
}

/* Loading animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #2c5aa0;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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