/* --- 1. Global Reset & Custom Properties --- */
:root {
    --primary-color: #0070c0;
    --secondary-color: #f1f7fe;
    --border-color: #e9ecef;
    --text-color: #212529;
    --muted-color: #6c757d;
    --font-stack: 'Roboto', 'Helvetica Neue', Arial, sans-serif;
}

body {
    font-family: var(--font-stack);
    line-height: 1.6;
    color: var(--text-color);
    background-color: #ffffff;
    margin: 0;
    padding: 0;
}

/* --- 2. Main Layout (Desktop-First) --- */
.container {
    display: flex;
    max-width: 1500px; /* INCREASED: Wider overall container for better visual balance */
    margin: 0 auto;
    gap: 30px; 
    flex-direction: row;
}

/* --- 3. Sidebar Styling (Wider and Sticky) --- */
.sidebar {
    width: 360px; /* FIX: Significant increase for spacious look */
    background-color: #ffffff;
    padding: 30px 20px;
    border-right: 1px solid var(--border-color);
    box-shadow: 2px 0 5px rgba(0,0,0,0.03);
    position: sticky; 
    top: 0;
    height: 100vh;
    overflow-y: auto;
    text-align: center;
}

.profile-image {
    width: 132px;
    height: 132px;
    border-radius: 50%;
    object-fit: cover;
    display: block; 
    margin: 0 auto 15px auto; 
    border: 4px solid var(--primary-color);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.sidebar h1 { /* Name: Rui Ning */
    font-size: 34px; 
    font-weight: 700;
    color: var(--primary-color);
    margin-top: 5px;
    margin-bottom: 5px;
    line-height: 1.1;
}

.sidebar p { /* Title and Affiliation */
    font-size: 16px;
    color: var(--muted-color);
    line-height: 1.4;
    padding: 0 5px;
}

.sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin-top: 25px;
    display: inline-block; 
}

.sidebar-nav ul li {
    margin: 0;
    border-bottom: 1px dashed #ced4da;
}

.sidebar-nav ul li:last-child {
    border-bottom: none;
}

.sidebar-nav ul li a {
    display: block;
    padding: 12px 20px;
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    text-align: left;
    transition: all 0.2s ease-in-out;
}

.sidebar-nav ul li a:hover {
    color: #ffffff;
    background-color: var(--primary-color);
    border-radius: 4px;
}

.btn-cv {
    display: block;
    margin-top: 30px;
    padding: 12px 15px;
    background-color: var(--primary-color);
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    box-shadow: 0 4px 6px rgba(0, 112, 192, 0.2);
    transition: background-color 0.2s;
}

.btn-cv:hover {
    background-color: #0056b3;
}

/* --- 4. Main Content Styling --- */
.content {
    flex-grow: 1;
    padding: 40px;
}

.section {
    margin-bottom: 50px;
}

.section h2 { 
    font-size: 32px;
    font-weight: 700;
    color: var(--primary-color);
    border-bottom: 4px solid var(--primary-color);
    padding-bottom: 8px;
    margin-bottom: 30px;
}

.section ul, .section ol {
    padding-left: 25px;
    list-style-type: disc;
}

.section li {
    margin-bottom: 15px;
    line-height: 1.7;
}

.section p, .section li {
    font-size: 17px;
    color: var(--text-color);
}

/* Card Style for Publications/Grants */
.content-card {
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    transition: transform 0.2s;
}

.content-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.08);
}

.card-title {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 5px;
    font-size: 1.1em;
}

.card-metadata {
    font-size: 0.9em;
    color: var(--muted-color);
}

/* --- 5. Responsive Styles --- */
@media (max-width: 992px) { 
    .container {
        flex-direction: column;
        gap: 0;
    }

    .sidebar {
        width: 100%; /* Sidebar reverts to full width on tablets/mobile */
        height: auto;
        position: static;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding: 20px;
        box-shadow: none;
    }

    .sidebar-nav ul {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        margin-top: 15px;
        display: flex;
    }

    .sidebar-nav ul li {
        flex: 1 1 33.33%; 
        text-align: center;
        margin: 5px 0;
        border-bottom: none;
    }
    
    .sidebar-nav ul li a {
        padding: 8px 10px;
    }

    .profile-image {
        width: 100px;
        height: 100px;
        margin: 0 auto 10px auto; 
    }

    .content {
        padding: 30px 20px;
    }
    
    .section h2 {
        font-size: 28px;
    }
}

@media (max-width: 576px) { 
    .sidebar h1 {
        font-size: 24px;
    }

    .sidebar-nav ul li {
        flex: 1 1 50%; 
    }

    .btn-cv {
        width: 100%;
        text-align: center;
        margin-top: 20px;
    }

    .section h2 {
        font-size: 24px;
        margin-bottom: 15px;
    }

    .section p, .section li {
        font-size: 16px;
    }
}
