:root {
    /* Light Theme Colors */
    --light-bg: #ffffff;
    --light-text: #333333;
    --light-side-panel: #f0f0f0;
    --light-section-bg: #f9f9f9;
    --light-border: #e0e0e0;
    --light-shadow: rgba(0,0,0,0.1);
    --light-heading: #2c3e50;
    --light-link: #008080;
    --light-button: #008080;
    --light-footer: linear-gradient(135deg, #008080 0%, #006666 100%);
    --light-scrollbar-track: #f0f0f0;
    --light-scrollbar-thumb: #b0c4c4;
    
    /* Dark Theme Colors */
    --dark-bg: #000000;
    --dark-text: #ffffff;
    --dark-side-panel: #0a0a0a;
    --dark-section-bg: #0a0a0a;
    --dark-border: #1a1a1a;
    --dark-shadow: rgba(0,0,0,0.5);
    --dark-heading: #4fc3f7;
    --dark-link: #4fc3f7;
    --dark-button: #1976d2;
    --dark-footer: linear-gradient(135deg, #0a0a0a 0%, #000000 100%);
    --dark-scrollbar-track: #0a0a0a;
    --dark-scrollbar-thumb: #333333;
}

/* Theme Toggle Switch */
.theme-toggle {
    position: relative;
    background: #333;
    border: none;
    border-radius: 25px;
    width: 50px;
    height: 25px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
    transition: background 0.3s ease;
    box-sizing: border-box;
    overflow: hidden;
    margin-right: 10px; /* Space between toggle and first social button */
    margin-top: 5px; /* More down to better center with social icons */
}

.theme-toggle.light {
    background: #4fc3f7;
}

.theme-toggle.dark {
    background: #333;
}

.theme-toggle::before {
    content: '☀️';
    font-size: 14px;
    transition: transform 0.3s ease;
    position: absolute;
    left: 2px;
    top: 50%;
    transform: translateY(-50%);
    line-height: 1;
    white-space: nowrap;
    pointer-events: none;
}

.theme-toggle.dark::before {
    content: '🌙';
    transform: translate(25px, -50%);
}

/* Mobile toggle button fixes */
@media (max-width: 768px) {
    .theme-toggle {
        width: 45px;
        height: 22px;
        margin-right: 15px;
        margin-top: 0;
        border-radius: 22px; /* Maintain pill shape */
    }

    .theme-toggle::before {
        font-size: 12px;
        left: 2px;
    }

    .theme-toggle.dark::before {
        transform: translate(23px, -50%);
    }
}

@media (max-width: 480px) {
    .theme-toggle {
        width: 40px;
        height: 20px;
        margin-right: 12px;
        border-radius: 20px; /* Maintain pill shape */
    }

    .theme-toggle::before {
        font-size: 11px;
        left: 1px;
    }

    .theme-toggle.dark::before {
        transform: translate(20px, -50%);
    }
}

@media (max-width: 360px) {
    .theme-toggle {
        width: 35px;
        height: 18px;
        border-radius: 18px; /* Maintain pill shape */
    }

    .theme-toggle::before {
        font-size: 10px;
    }

    .theme-toggle.dark::before {
        transform: translate(17px, -50%);
    }
}

/* Remove the media queries that were moving the toggle around */
/* The toggle will now stay in the same position as social buttons */

/* Light Theme (Default) */
body {
    font-family: 'Poppins', sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--light-bg);
    color: var(--light-text);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Dark Theme */
body.dark-theme {
    background-color: var(--dark-bg);
    color: var(--dark-text);
}

.container {
    display: grid;
    grid-template-columns: 33.33% 66.67%;
    grid-template-rows: 1fr;
    min-height: 100vh;
    box-sizing: border-box;
    gap: 0;
    width: 100%;
    max-width: 100%;
    flex: 1;
}

.side-panel {
    background-color: var(--light-side-panel);
    padding: 20px;
    box-shadow: 2px 0 5px var(--light-shadow);
    position: relative;
    background-image: url("/static/images/background.jpeg");
    background-size: initial;
    background-repeat: repeat;
    background-position: top;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    min-height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    grid-column: 1;
    justify-content: flex-start;
    align-items: stretch;
    width: 100%;
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

body.dark-theme .side-panel {
    background-color: var(--dark-side-panel);
    box-shadow: 2px 0 5px var(--dark-shadow);
}

.side-panel::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    z-index: 1;
    transition: background-color 0.3s ease;
}

body.dark-theme .side-panel::before {
    background-color: rgba(10, 10, 10, 0.95);
}

.profile-section, .introduction {
    position: relative;
    z-index: 2;
}

.profile-section {
    text-align: center;
    margin-bottom: 20px;
    flex-shrink: 0;
}

.profile-photo {
    border-radius: 50%;
    width: 100%;
    max-width: 200px;
    height: auto;
    margin-bottom: 10px;
    margin-top: 30px;
}

h1 {
    font-size: 1.8em;
    margin: 10px 0 5px 0;
    color: var(--light-heading);
    font-family: 'Poppins', sans-serif;
    letter-spacing: 2px;
    transition: color 0.3s ease;
}

body.dark-theme h1 {
    color: var(--dark-text);
}

.title {
    font-size: 1.2em;
    font-family: 'Poppins', sans-serif;
    margin-top: 0;
    margin-bottom: 0;
    color: var(--light-heading);
    transition: color 0.3s ease;
}

body.dark-theme .title {
    color: var(--dark-heading);
}

.introduction {
    text-align: justify;
    margin-top: 0px;
    font-size: 1em;
    padding-left: 20px;
    padding-right: 20px;
    flex: 1;
    overflow: visible;
    color: var(--light-text);
    transition: color 0.3s ease;
}

body.dark-theme .introduction {
    color: var(--dark-text);
}

.introduction a {
    color: var(--light-link);
    transition: color 0.3s ease;
}

body.dark-theme .introduction a {
    color: var(--dark-link);
}

.introduction a:hover {
    color: #005f5f;
    text-decoration: underline;
}

body.dark-theme .introduction a:hover {
    color: #81d4fa;
}

.main-panel {
    flex: 1;
    padding: 40px;
    background-color: var(--light-bg);
    position: relative;
    box-sizing: border-box;
    grid-column: 2;
    min-height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
    border-left: 1px solid var(--light-border);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

body.dark-theme .main-panel {
    background-color: var(--dark-bg);
    border-left-color: var(--dark-border);
}

.social-buttons {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 7px;
    z-index: 10;
}

.icon-button {
    background-color: transparent;
    border: 2px solid;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1em;
    text-decoration: none;
    transition: color 0.3s, border-color 0.3s, background-color 0.3s;
}

.icon-button.scholar {
    color: #cb461d;
    border-color: #cb461d;
}

.icon-button.scholar:hover {
    background-color: #cb461d6a;
}

.icon-button.linkedin {
    color: #320482;
    border-color: #320482;
}

.icon-button.linkedin:hover {
    background-color: #3204826a;
}

.icon-button.github {
    color: #0288d1;
    border-color: #0288d1;
}

.icon-button.github:hover {
    background-color: #0288d16a;
}

.icon-button.twitter {
    color: #00897b;
    border-color: #00897b;
}

.icon-button.twitter:hover {
    background-color: #00897b6a;
}

.icon-button.email {
    color: #fbc02d;
    border-color: #fbc02d;
}

.icon-button.email:hover {
    background-color: #fbc02d6a;
}

.icon-button.resume {
    color: #795548;
    border-color: #795548;
}

.icon-button.resume:hover {
    background-color: #7955486a;
}

.icon-button.orcid {
    color: #a6ce39;
    border-color: #a6ce39;
}

.icon-button.orcid:hover {
    background-color: #a6ce396a;
}

.icon-button.osgeo {
    color: #ff7043;
    border-color: #ff7043;
}

.icon-button.osgeo:hover {
    background-color: #ff70436a;
}

/* Dark theme social buttons */
body.dark-theme .icon-button.scholar {
    color: #ff7043;
    border-color: #ff7043;
}

body.dark-theme .icon-button.scholar:hover {
    background-color: #ff7043;
    color: #ffffff;
}

body.dark-theme .icon-button.linkedin {
    color: #42a5f5;
    border-color: #42a5f5;
}

body.dark-theme .icon-button.linkedin:hover {
    background-color: #42a5f5;
    color: #ffffff;
}

body.dark-theme .icon-button.github {
    color: #66bb6a;
    border-color: #66bb6a;
}

body.dark-theme .icon-button.github:hover {
    background-color: #66bb6a;
    color: #ffffff;
}

body.dark-theme .icon-button.twitter {
    color: #26c6da;
    border-color: #26c6da;
}

body.dark-theme .icon-button.twitter:hover {
    background-color: #26c6da;
    color: #ffffff;
}

body.dark-theme .icon-button.email {
    color: #ffca28;
    border-color: #ffca28;
}

body.dark-theme .icon-button.email:hover {
    background-color: #ffca28;
    color: #ffffff;
}

body.dark-theme .icon-button.resume {
    color: #ab47bc;
    border-color: #ab47bc;
}

body.dark-theme .icon-button.resume:hover {
    background-color: #ab47bc;
    color: #ffffff;
}

body.dark-theme .icon-button.orcid {
    color: #a6ce39;
    border-color: #a6ce39;
}

body.dark-theme .icon-button.orcid:hover {
    background-color: #a6ce39;
    color: #ffffff;
}

body.dark-theme .icon-button.osgeo {
    color: #ff7043;
    border-color: #ff7043;
}

body.dark-theme .icon-button.osgeo:hover {
    background-color: #ff7043;
    color: #ffffff;
}

.section-title {
    font-size: 1.5em;
    color: var(--light-heading);
    transition: color 0.3s ease;
}

body.dark-theme .section-title {
    color: var(--dark-heading);
}

.news-updates, .publications {
    margin-bottom: 40px;
    padding: 40px;
    padding-top: 20px;
    border-radius: 10px;
    background-color: var(--light-section-bg);
    box-shadow: 0 2px 5px var(--light-shadow);
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

body.dark-theme .news-updates,
body.dark-theme .publications {
    background-color: var(--dark-section-bg);
    box-shadow: 0 2px 5px var(--dark-shadow);
    border: 1px solid var(--dark-border);
}

.news-updates {
    margin-top: 30px;
    flex: 1;
}

.news-updates ul {
    list-style-type: none;
    padding: 0;
    font-size: 1em;
}

.news-updates li {
    margin-bottom: 15px;
    line-height: 1.2;
    color: var(--light-text);
    transition: color 0.3s ease;
}

body.dark-theme .news-updates li {
    color: var(--dark-text);
}

.see-more {
    color: var(--light-link);
    text-decoration: none;
    cursor: pointer;
    font-size: 1em;
    transition: color 0.3s ease;
}

body.dark-theme .see-more {
    color: var(--dark-link);
}

.see-more:hover {
    text-decoration: underline;
    color: #005f5f;
}

body.dark-theme .see-more:hover {
    color: #81d4fa;
}

.publications p {
    font-size: 1em;
    color: var(--light-text);
    transition: color 0.3s ease;
}

body.dark-theme .publications p {
    color: var(--dark-text);
}

.publication {
    margin-bottom: 20px;
    font-size: 1em;
    border-bottom: 1px solid #ddd;
    padding-bottom: 15px;
    transition: border-color 0.3s ease;
}

body.dark-theme .publication {
    border-bottom-color: var(--dark-border);
}

.publication h3 {
    margin-bottom: 0px;
    font-size: 1em;
    color: var(--light-heading);
    transition: color 0.3s ease;
}

body.dark-theme .publication h3 {
    color: var(--dark-text);
}

.publication .tldr {
    margin-bottom: 10px;
    font-size: 0.9em;
    color: var(--light-text);
    transition: color 0.3s ease;
}

body.dark-theme .publication .tldr {
    color: var(--dark-text);
}

.publication .authors {
    margin-top: 0px;
    font-style: italic;
    font-size: 0.9em;
    color: #666;
    transition: color 0.3s ease;
}

body.dark-theme .publication .authors {
    color: #b0b0b0;
}

/* Button links styling */
.button-link {
    display: inline-block;
    padding: 10px 18px;
    margin: 8px 5px 15px 0;
    font-size: 0.9em;
    color: #ffffff !important;
    background-color: var(--light-button);
    border: none;
    border-radius: 8px;
    text-decoration: none;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    line-height: 1.4;
    box-shadow: 0 3px 10px rgba(0,0,0,0.15);
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    position: relative;
    overflow: hidden;
    will-change: transform, box-shadow;
    transform: translateZ(0);
}

/* Button shine effect */
.button-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.6s ease;
    pointer-events: none;
}

.button-link:hover::before {
    left: 100%;
}

body.dark-theme .button-link {
    background-color: var(--dark-button);
}

.button-link:hover {
    background-color: #005f5f;
    transform: translateY(-3px) translateZ(0);
    box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}

body.dark-theme .button-link:hover {
    background-color: #1565c0;
    transform: translateY(-3px) translateZ(0);
    box-shadow: 0 6px 20px rgba(255,255,255,0.15);
}

/* Mobile button fixes */
@media (max-width: 768px) {
    .button-link {
        padding: 12px 16px;
        font-size: 0.95em;
        margin: 8px 8px 12px 0;
        display: inline-block;
        border-radius: 8px; /* Maintain rounded corners */
        min-height: 48px; /* Touch-friendly height */
        min-width: 48px; /* Touch-friendly width */
        line-height: 1.3;
        vertical-align: middle;
        box-shadow: 0 2px 8px rgba(0,0,0,0.2);
        font-weight: 600;
    }
    
    /* Touch-specific interactions */
    .button-link:active {
        transform: scale(0.95) translateZ(0);
        transition: transform 0.1s ease;
    }
}

@media (max-width: 480px) {
    .button-link {
        padding: 6px 10px;
        font-size: 0.85em;
        margin: 3px 3px 8px 0;
        border-radius: 5px; /* Maintain rounded corners */
        min-height: 40px; /* Slightly smaller but still touch-friendly */
        min-width: 40px;
    }
}

@media (max-width: 360px) {
    .button-link {
        padding: 5px 8px;
        font-size: 0.8em;
        margin: 2px 2px 6px 0;
        border-radius: 4px; /* Slightly smaller radius for very small screens */
        min-height: 36px;
        min-width: 36px;
    }
}

h2 {
    color: var(--light-link);
    margin-bottom: 20px;
    transition: color 0.3s ease;
}

body.dark-theme h2 {
    color: var(--dark-link);
}

a {
    color: var(--light-link);
    text-decoration: none;
    transition: color 0.3s ease;
}

body.dark-theme a {
    color: var(--dark-link);
}

a:hover {
    text-decoration: underline;
    color: #005f5f;
}

body.dark-theme a:hover {
    color: #81d4fa;
}

footer {
    background: var(--light-footer);
    color: #ffffff;
    text-align: center;
    padding: 20px 15px;
    position: relative;
    width: 100%;
    box-sizing: border-box;
    margin-top: 0;
    box-shadow: 0 -2px 10px var(--light-shadow);
    flex-shrink: 0;
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

body.dark-theme footer {
    background: var(--dark-footer);
    box-shadow: 0 -2px 10px var(--dark-shadow);
    border-top: 1px solid var(--dark-border);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    text-align: left;
}

.footer-section {
    padding: 10px;
}

.footer-section h3 {
    color: #ffffff;
    margin-bottom: 10px;
    font-size: 1.1em;
    font-weight: 600;
    position: relative;
    padding-bottom: 8px;
    font-family: 'Poppins', sans-serif;
    transition: color 0.3s ease;
}

body.dark-theme .footer-section h3 {
    color: var(--dark-heading);
}

.footer-section h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 30px;
    height: 2px;
    background: #ffffff;
    border-radius: 1px;
    transition: background 0.3s ease;
}

body.dark-theme .footer-section h3::after {
    background: var(--dark-heading);
}

.footer-section p, .footer-section a {
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 6px;
    transition: color 0.3s ease;
    text-decoration: none;
    display: block;
    font-size: 0.9em;
}

body.dark-theme .footer-section p,
body.dark-theme .footer-section a {
    color: rgba(255, 255, 255, 0.9);
}

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

body.dark-theme .footer-section a:hover {
    color: var(--dark-heading);
}

.footer-section a i {
    margin-right: 6px;
    width: 14px;
    text-align: center;
}

.footer-bottom {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    text-align: center;
    transition: border-color 0.3s ease;
}

body.dark-theme .footer-bottom {
    border-top-color: rgba(51, 51, 51, 0.5);
}

.footer-bottom p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85em;
    margin: 0;
    transition: color 0.3s ease;
}

body.dark-theme .footer-bottom p {
    color: rgba(255, 255, 255, 0.8);
}

.footer-social-links {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 12px;
}

.footer-social-links a {
    color: #ffffff;
    font-size: 1.1em;
    transition: transform 0.3s ease, color 0.3s ease;
}

body.dark-theme .footer-social-links a {
    color: var(--dark-heading);
}

.footer-social-links a:hover {
    color: #ffffff;
    transform: scale(1.1);
}

body.dark-theme .footer-social-links a:hover {
    color: #81d4fa;
}

/* Custom Scrollbar Styles */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: var(--light-scrollbar-track);
    border-radius: 10px;
    transition: background 0.3s ease;
}

body.dark-theme ::-webkit-scrollbar-track {
    background: var(--dark-scrollbar-track);
}

::-webkit-scrollbar-thumb {
    background-color: var(--light-scrollbar-thumb);
    border-radius: 10px;
    border: 3px solid var(--light-scrollbar-track);
    transition: background-color 0.3s ease;
}

body.dark-theme ::-webkit-scrollbar-thumb {
    background-color: var(--dark-scrollbar-thumb);
    border-color: var(--dark-scrollbar-track);
}

::-webkit-scrollbar-thumb:hover {
    background-color: #90a4a4;
}

body.dark-theme ::-webkit-scrollbar-thumb:hover {
    background-color: #616161;
}

/* Mobile Responsive Design */
@media (max-width: 768px) {
    /* Container layout for mobile */
    .container {
        display: flex;
        flex-direction: column;
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        min-height: auto;
    }

    /* Side panel mobile adjustments */
    .side-panel {
        width: 100%;
        padding: 20px;
        min-height: auto;
        order: 1;
        background-size: cover;
        background-position: center;
    }

    /* Profile section mobile */
    .profile-section {
        order: 1;
        margin-bottom: 15px;
    }

    .profile-photo {
        max-width: 150px;
        margin-top: 20px;
        margin-bottom: 15px;
    }

    h1 {
        font-size: 1.5em;
        margin: 8px 0 3px 0;
    }

    .title {
        font-size: 1.1em;
    }

    /* Introduction mobile */
    .introduction {
        order: 2;
        padding-left: 15px;
        padding-right: 15px;
        font-size: 0.95em;
        margin-bottom: 20px;
    }

    /* Social buttons mobile */
    .social-buttons {
        order: 3;
        position: static;
        justify-content: center;
        margin: 20px 0;
        gap: 10px;
        flex-wrap: wrap;
    }

    /* Theme toggle mobile */
    .theme-toggle {
        width: 45px;
        height: 22px;
        margin-right: 15px;
        margin-top: 0;
    }

    .theme-toggle::before {
        font-size: 12px;
        left: 2px;
    }

    .theme-toggle.dark::before {
        transform: translate(23px, -50%);
    }

    /* Social icon buttons mobile */
    .icon-button {
        width: 45px;
        height: 45px;
        font-size: 1.2em;
        border-width: 2px;
    }

    /* Main panel mobile */
    .main-panel {
        width: 100%;
        padding: 20px;
        order: 4;
        min-height: auto;
        border-left: none;
        border-top: 1px solid var(--light-border);
    }

    body.dark-theme .main-panel {
        border-top-color: var(--dark-border);
    }

    /* Section spacing mobile */
    .news-updates, .publications {
        margin-bottom: 25px;
        padding: 25px 20px;
        padding-top: 15px;
    }

    .news-updates {
        margin-top: 20px;
        order: 1;
    }

    .publications {
        order: 2;
    }

    /* Section titles mobile */
    .section-title {
        font-size: 1.3em;
        margin-bottom: 15px;
    }

    /* News updates mobile */
    .news-updates ul {
        font-size: 0.95em;
    }

    .news-updates li {
        margin-bottom: 12px;
        line-height: 1.4;
    }

    /* Publications mobile */
    .publication {
        margin-bottom: 15px;
        padding-bottom: 12px;
    }

    .publication h3 {
        font-size: 0.95em;
        line-height: 1.3;
    }

    .publication .tldr {
        font-size: 0.9em;
        line-height: 1.4;
    }

    .publication .authors {
        font-size: 0.85em;
    }

    /* Button links mobile - styling handled in main button section */

    /* Footer mobile */
    footer {
        order: 5;
        padding: 25px 20px;
        margin-top: 20px;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 25px;
        text-align: center;
    }

    .footer-section {
        padding: 15px;
    }

    .footer-section h3 {
        font-size: 1.2em;
        margin-bottom: 12px;
    }

    .footer-section h3::after {
        left: 50%;
        transform: translateX(-50%);
    }

    .footer-section p, .footer-section a {
        font-size: 0.95em;
        margin-bottom: 8px;
    }

    .footer-bottom {
        margin-top: 25px;
        padding-top: 20px;
    }

    .footer-social-links {
        gap: 20px;
        margin-top: 15px;
    }

    .footer-social-links a {
        font-size: 1.2em;
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    .side-panel {
        padding: 15px;
    }

    .profile-photo {
        max-width: 120px;
        margin-top: 15px;
    }

    h1 {
        font-size: 1.3em;
    }

    .title {
        font-size: 1em;
    }

    .introduction {
        padding-left: 10px;
        padding-right: 10px;
        font-size: 0.9em;
    }

    .social-buttons {
        gap: 8px;
        margin: 15px 0;
    }

    .theme-toggle {
        width: 40px;
        height: 20px;
        margin-right: 12px;
    }

    .theme-toggle::before {
        font-size: 11px;
        left: 1px;
    }

    .theme-toggle.dark::before {
        transform: translate(20px, -50%);
    }

    .icon-button {
        width: 40px;
        height: 40px;
        font-size: 1.1em;
    }

    .main-panel {
        padding: 15px;
    }

    .news-updates, .publications {
        padding: 20px 15px;
        padding-top: 15px;
        margin-bottom: 20px;
    }

    .section-title {
        font-size: 1.2em;
    }

    .news-updates li {
        font-size: 0.9em;
        line-height: 1.3;
    }

    .publication h3 {
        font-size: 0.9em;
    }

    .publication .tldr {
        font-size: 0.85em;
    }

    .publication .authors {
        font-size: 0.8em;
    }

    /* Button styling handled in main button section */

    footer {
        padding: 20px 15px;
    }

    .footer-content {
        gap: 20px;
    }

    .footer-section {
        padding: 10px;
    }

    .footer-section h3 {
        font-size: 1.1em;
    }

    .footer-section p, .footer-section a {
        font-size: 0.9em;
    }
}

/* Landscape mobile orientation */
@media (max-width: 768px) and (orientation: landscape) {
    .container {
        flex-direction: row;
    }

    .side-panel {
        width: 40%;
        min-height: 100vh;
    }

    .main-panel {
        width: 60%;
        border-left: 1px solid var(--light-border);
        border-top: none;
    }

    body.dark-theme .main-panel {
        border-left-color: var(--dark-border);
        border-top: none;
    }

    .profile-photo {
        max-width: 100px;
    }

    h1 {
        font-size: 1.3em;
    }

    .title {
        font-size: 1em;
    }

    .introduction {
        font-size: 0.9em;
        padding-left: 10px;
        padding-right: 10px;
    }
}

/* Additional mobile fixes and improvements */
@media (max-width: 768px) {
    /* Ensure smooth scrolling on mobile */
    html, body {
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Fix any potential overflow issues */
    .container, .side-panel, .main-panel {
        overflow-x: hidden;
    }
    
    /* Ensure proper text wrapping */
    .introduction p, .news-updates li, .publication p {
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }
    
    /* Better touch targets for mobile */
    .icon-button, .theme-toggle, .button-link {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Improve button spacing on mobile */
    .button-link {
        margin-bottom: 8px;
        margin-right: 8px;
    }
    
    /* Better spacing for publication sections */
    .publication:last-child {
        border-bottom: none;
        margin-bottom: 0;
    }
    
    /* Ensure footer links are properly spaced */
    .footer-section a {
        padding: 5px 0;
        display: block;
    }
}

/* Fix for very small screens */
@media (max-width: 360px) {
    .side-panel {
        padding: 10px;
    }
    
    .main-panel {
        padding: 10px;
    }
    
    .news-updates, .publications {
        padding: 15px 10px;
    }
    
    .profile-photo {
        max-width: 100px;
    }
    
    h1 {
        font-size: 1.2em;
    }
    
    .title {
        font-size: 0.9em;
    }
    
    .introduction {
        font-size: 0.85em;
        padding-left: 8px;
        padding-right: 8px;
    }
    
    .social-buttons {
        gap: 6px;
    }
    
    .icon-button {
        width: 35px;
        height: 35px;
        font-size: 1em;
    }
    
    .theme-toggle {
        width: 35px;
        height: 18px;
    }
    
    .theme-toggle::before {
        font-size: 10px;
    }
    
    .theme-toggle.dark::before {
        transform: translate(17px, -50%);
    }
}



/* Enhanced Accessibility */
.focused {
    outline: 2px solid var(--light-link);
    outline-offset: 2px;
}

body.dark-theme .focused {
    outline-color: var(--dark-link);
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Remove hover effects on touch devices */
    .icon-button:hover,
    .button-link:hover {
        transform: none;
        box-shadow: none;
    }
    
    /* Larger touch targets for mobile */
    .icon-button,
    .button-link,
    .theme-toggle {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Active state for touch feedback */
    .icon-button:active,
    .button-link:active {
        transform: scale(0.95);
        transition: transform 0.1s ease;
    }
    
    /* Better touch scrolling */
    .container,
    .main-panel {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
}

/* 60 FPS Smooth Animations */
.theme-toggle,
.icon-button,
.button-link,
.publication,
.section-title {
    will-change: transform, opacity, background-color;
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Smooth transitions for 60 FPS */
.theme-toggle,
.icon-button,
.button-link {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Hover effects with 60 FPS */
.icon-button:hover,
.button-link:hover {
    transform: translateY(-3px) translateZ(0);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

/* Dark theme hover effects */
body.dark-theme .icon-button:hover,
body.dark-theme .button-link:hover {
    transform: translateY(-3px) translateZ(0);
    box-shadow: 0 8px 25px rgba(255,255,255,0.1);
}

/* Screen Reader Only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Smooth Transitions */
* {
    transition: color 0.3s ease, background-color 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
}

/* Performance optimizations for 60 FPS */
html, body {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    overflow-x: hidden;
    /* 60 FPS smooth scrolling */
    scroll-behavior: smooth;
    -webkit-scroll-behavior: smooth;
    -moz-scroll-behavior: smooth;
    -ms-scroll-behavior: smooth;
}

/* Smooth scrolling containers */
.container,
.side-panel,
.main-panel {
    will-change: transform, scroll-position;
    transform: translateZ(0);
    /* Hardware acceleration for smooth scrolling */
    -webkit-transform: translateZ(0);
    -moz-transform: translateZ(0);
    -ms-transform: translateZ(0);
    /* Smooth scrolling behavior */
    scroll-behavior: smooth;
    -webkit-scroll-behavior: smooth;
}

/* Custom scrollbar for 60 FPS */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: var(--light-scrollbar-track);
    border-radius: 6px;
}

::-webkit-scrollbar-thumb {
    background: var(--light-scrollbar-thumb);
    border-radius: 6px;
    border: 2px solid var(--light-scrollbar-track);
    transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: #8a9a9a;
}

/* Dark theme scrollbar */
body.dark-theme ::-webkit-scrollbar-track {
    background: var(--dark-scrollbar-track);
}

body.dark-theme ::-webkit-scrollbar-thumb {
    background: var(--dark-scrollbar-thumb);
    border-color: var(--dark-scrollbar-track);
}

body.dark-theme ::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.container,
.side-panel,
.main-panel {
    will-change: transform;
    transform: translateZ(0);
}

/* Smooth section transitions */
.publication,
.section-title,
.news-updates {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease forwards;
}

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

/* Stagger animation for publications */
.publication:nth-child(1) { animation-delay: 0.1s; }
.publication:nth-child(2) { animation-delay: 0.2s; }
.publication:nth-child(3) { animation-delay: 0.3s; }
.publication:nth-child(4) { animation-delay: 0.4s; }
.publication:nth-child(5) { animation-delay: 0.5s; }



/* Parallax Background Effect */
.side-panel {
    background-attachment: fixed;
    background-position: center;
    background-size: cover;
}

@media (max-width: 768px) {
    .side-panel {
        background-attachment: scroll;
    }
    
    /* Mobile touch optimizations */
    .icon-button,
    .button-link,
    .theme-toggle {
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }
    
    /* Better mobile scrolling */
    .main-panel {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
    
    /* Mobile-specific animations */
    .publication,
    .section-title {
        animation-duration: 0.4s;
    }
    
    /* Enhanced mobile scrolling */
    .main-panel {
        scroll-snap-type: y proximity;
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
    
    /* Smooth momentum scrolling for iOS */
    .container,
    .side-panel,
    .main-panel {
        -webkit-overflow-scrolling: touch;
        -webkit-scroll-behavior: smooth;
        scroll-behavior: smooth;
    }
}

/* Focus Management for Keyboard Navigation */
.theme-toggle:focus,
.icon-button:focus,
.button-link:focus {
    outline: 2px solid var(--light-link);
    outline-offset: 2px;
}

body.dark-theme .theme-toggle:focus,
body.dark-theme .icon-button:focus,
body.dark-theme .button-link:focus {
    outline-color: var(--dark-link);
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .button-link,
    .icon-button {
        border: 2px solid currentColor;
    }
    
    .theme-toggle {
        border: 2px solid currentColor;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .back-to-top:hover {
        transform: none;
    }
    
    .button-link:hover {
        transform: none;
    }
    
    .icon-button:hover {
        transform: none;
    }
}

/* Mobile Responsive Design for Remaining Features */
@media (max-width: 768px) {
    /* Back to top button mobile */
    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
        font-size: 16px;
    }
    
    /* Hover effects removed for mobile */
    .icon-button:hover {
        /* No hover effects */
    }
    
    .button-link:hover {
        /* No hover effects */
    }
    
    .back-to-top:hover {
        /* No hover effects */
    }
}

@media (max-width: 480px) {
    /* Back to top button small mobile */
    .back-to-top {
        bottom: 15px;
        right: 15px;
        width: 40px;
        height: 40px;
        font-size: 14px;
    }
}

@media (max-width: 360px) {
    /* Back to top button very small mobile */
    .back-to-top {
        bottom: 10px;
        right: 10px;
        width: 35px;
        height: 35px;
        font-size: 12px;
    }
}

/* Touch device optimizations - hover effects removed */
@media (hover: none) and (pointer: coarse) {
    .icon-button:hover,
    .button-link:hover,
    .back-to-top:hover {
        /* No hover effects */
    }
    
    .icon-button:active,
    .button-link:active,
    .back-to-top:active {
        /* No active effects */
    }
}

/* High DPI display optimizations */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* High DPI optimizations - loading spinner removed */
}

/* Print styles */
@media print {
    .back-to-top,
    .theme-toggle {
        display: none !important;
    }
    
    .side-panel {
        background-image: none !important;
    }
    
    .side-panel::before {
        display: none !important;
    }
    
    .container {
        display: block;
    }
    
    .side-panel,
    .main-panel {
        width: 100%;
        padding: 20px;
        margin: 0;
        border: none;
    }
}