/* ===== Global Styles ===== */
:root {
    /* Primary palette */
    --primary-color: #DC2626;  
    --secondary-color: #4a4a4a;

    /* Text and heading colors for normal mode */
    --heading-color: #1a1a1a; 
    --text-color: #444444;    

    /* Backgrounds */
    --bg-color: #ffffff; 
    --bg-light: #f9f9f9;
    --bg-dark: #1a1a1a;

    /* Footer or other darker sections in normal mode */
    --footer-bg-color: #2c3e50;

    /* Icon or "dark" elements (e.g., hamburger lines) in normal mode */
    --icon-dark-color: #2c3e50;

    /* Accent / highlight */
    --accent-color: #EF4444; 

    /* Borders, cards, shadows */
    --border-color: #e0e0e0;
    --card-bg: #f9f9f9;
    --box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);

    /* Transition */
    --transition: all 0.3s ease;

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 2rem;
    --spacing-lg: 3rem;
    --spacing-xl: 5rem;

    /* Typography */
    --font-main: 'Poppins', sans-serif;
    --font-secondary: 'Roboto', sans-serif;
}

/* ===== Dark Mode Variables ===== */
body.dark-mode {
    --bg-color: #121212;         
    --heading-color: #e13737;  
    --text-color: #607D8B;     

    --card-bg: #1e1e1e;        
    --border-color: #333333;   
    --secondary-color: #607D8B;

    --footer-bg-color: #222222;  
    --icon-dark-color: #f5f5f5;  
    --box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-main);
    color: var(--text-color);
    background-color: var(--bg-color);
    line-height: 1.6;
    overflow-x: hidden;
    transition: var(--transition);
}

/* ===== Container ===== */
.container {
    width: 100%;
    max-width: 1200px;
    padding: 0 var(--spacing-sm);
    margin: 0 auto;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

ul {
    list-style: none;
}

/* ===== Buttons ===== */
.btn {
    display: inline-block;
    padding: 12px 28px;
    font-size: 1rem;
    font-weight: 500;
    border-radius: 30px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: var(--transition);
}

.primary-btn {
    background-color: var(--primary-color);
    color: #fff;
}

.primary-btn:hover {
    background-color: transparent;
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.secondary-btn {
    background-color: transparent;
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.secondary-btn:hover {
    background-color: var(--primary-color);
    color: #fff;
}

section {
    padding: var(--spacing-xl) 0;
}

.section-header {
    text-align: center;
    margin-bottom: var(--spacing-lg);
}

.section-header h2 {
    position: relative;
    font-size: 2.5rem;
    margin-bottom: var(--spacing-xs);
    color: var(--heading-color);
}

.section-header h2::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -10px;
    transform: translateX(-50%);
    width: 50px;
    height: 3px;
    background-color: var(--primary-color);
}

.section-header p {
    color: var(--secondary-color);
    font-size: 1.1rem;
}

/* ===== Cursor (optional) ===== */
.cursor {
    position: fixed;
    width: 20px;
    height: 20px;
    border: 2px solid var(--primary-color);
    border-radius: 50%;
    pointer-events: none;
    transform: translate(-50%, -50%);
    z-index: 9999;
    transition: all 0.1s ease;
    opacity: 0.7;
}

.cursor.expand {
    transform: translate(-50%, -50%) scale(2);
    opacity: 0;
    transition: all 0.3s ease;
}

/* ===== Header & Navigation ===== */
header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background-color: var(--primary-color);
    backdrop-filter: blur(5px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: var(--transition);
}

/* Header & Logo Styles */
.logo {
    display: flex;
    align-items: center;
}

.logo a {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #333;
}

.lab-logo {
    height: 70px;
    width: auto;
    margin-right: 10px;
    display: block; 
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: #333;
}

/* Navigation Link Styles for Header */
header .nav-link {
    color: #ecf0f1;
    font-weight: 500;
    padding: 5px 0;
    transition: var(--transition);
    position: relative;
}

header .nav-link:hover,
header .nav-link.active {
    color: #ffffff;
}

header .nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    transition: var(--transition);
}

header .nav-link.active::after,
header .nav-link:hover::after {
    width: 100%;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 80px;
}

.logo a {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-color);
    text-decoration: none;
    transition: var(--transition);
    display: flex;
    align-items: center;
}

.logo a img {
    display: block;
    max-height: 60px;
    width: auto;
    transition: var(--transition);
}

.logo-text {
    margin-left: 10px;
    color: #fff;
    font-weight: 700;
    display: none; /* Only show when image fails */
}

.logo a img:not([src]), 
.logo a img[src=""], 
.logo a img.error {
    display: none;
}

.logo a img:not([src]) ~ .logo-text, 
.logo a img[src=""] ~ .logo-text, 
.logo a img.error ~ .logo-text {
    display: inline-block;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-links li {
    margin-left: var(--spacing-md);
}

.hamburger {
    display: none;
    cursor: pointer;
}

.hamburger span {
    display: block;
    width: 25px;
    height: 3px;
    background-color: var(--icon-dark-color);
    margin: 5px 0;
    transition: all 0.3s ease;
}

/* ===== Hero Section ===== */
.hero {
    padding-top: 150px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    background: 
      linear-gradient(rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.8)), 
      url('../images/hero-bg.jpg') center / cover fixed;
}

#home {
    position: relative;
    overflow: hidden;
}

#home canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

body.dark-mode .hero {
    background: 
      linear-gradient(rgba(26, 26, 26, 0.8), rgba(26, 26, 26, 0.8)), 
      url('../images/hero-bg.jpg') center / cover fixed;
}

.hero-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    z-index: 5; 
}

.text-content {
    flex: 1;
    position: relative;
    z-index: 5;
}

.animate-text, .animate-text span {
    position: relative;
    z-index: 5;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: var(--spacing-sm);
    line-height: 1.2;
    font-weight: 700;
    color: var(--text-color);
}

.hero h1 span {
    color: var(--primary-color);
    position: relative;
    display: inline-block;
}

.hero h1 span::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 8px;
    background-color: var(--secondary-color);
    opacity: 0.5;
    z-index: -1;
}

.hero p {
    font-size: 1.5rem;
    color: var(--secondary-color);
    margin-bottom: var(--spacing-md);
}

.hero-buttons {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    position: relative;
    z-index: 6;
}

.social-icons {
    display: flex;
    gap: 15px;
    position: relative;
    z-index: 6;
}

.social-icons a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background-color: var(--card-bg);
    color: var(--primary-color);
    border-radius: 50%;
    border: 1px solid var(--border-color);
    font-size: 1.2rem;
    transition: var(--transition);
}

.social-icons a:hover {
    background-color: var(--primary-color);
    color: #fff;
    transform: translateY(-3px);
    box-shadow: var(--box-shadow);
}

.hero-image {
    flex: 1;
    display: flex;
    justify-content: flex-end;
    max-width: 500px;
}

.img-container {
    width: 80%;
    max-width: 450px;
    height: 400px;
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--box-shadow);
}

.placeholder-image {
    width: 100%;
    padding-bottom: 100%;
    background-color: var(--card-bg);
    border-radius: 15px;
    position: relative;
    overflow: hidden;
}

.placeholder-image::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    100% {
        left: 100%;
    }
}

/* ===== About Section ===== */
.about {
    background-color: var(--bg-light);
}

.about-content {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
}

.about-image {
    flex: 1;
    max-width: 400px;
}

.about-text {
    flex: 1;
}

.about-text h3 {
    margin-bottom: var(--spacing-sm);
    font-size: 1.5rem;
    color: var(--heading-color);
}

.about-text p {
    margin-bottom: var(--spacing-md);
    color: var(--secondary-color);
}

/* ===== Publications Section ===== */
.publications {
    background-color: var(--bg-light);
}

.publication-item {
    background-color: #fff;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: var(--box-shadow);
    transition: transform 0.3s ease;
}

.publication-item:hover {
    transform: translateY(-5px);
}

.publication-item h4 {
    color: var(--heading-color);
    margin-bottom: 10px;
    font-size: 1.2rem;
    font-weight: 600;
}

.publication-item .authors {
    font-size: 0.95rem;
    color: var(--text-color);
    margin-bottom: 5px;
}

.publication-item .journal, 
.publication-item .conference {
    font-size: 0.9rem;
    color: var(--secondary-color);
    margin-bottom: 0;
}

.publication-item .note,
.publication-item .award {
    font-size: 0.9rem;
    color: var(--primary-color);
    margin-top: 5px;
    font-weight: 500;
}

.publications-content h3 {
    position: relative;
    padding-bottom: 10px;
    margin-bottom: 20px;
    margin-top: 40px;
    font-size: 1.5rem;
    color: var(--heading-color);
}

.publications-content h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 50px;
    height: 3px;
    background-color: var(--primary-color);
}

.publications-content h3 i {
    margin-right: 10px;
    color: var(--primary-color);
}

/* ===== Services Section ===== */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-md);
}

.service-card {
    background-color: #fff;
    padding: var(--spacing-md);
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
    transition: var(--transition);
    text-align: center;
}

.service-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
}

.service-card .icon {
    width: 70px;
    height: 70px;
    margin: 0 auto var(--spacing-sm);
    background-color: var(--bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--primary-color);
    font-size: 1.5rem;
    transition: var(--transition);
}

.service-card:hover .icon {
    background-color: var(--primary-color);
    color: #fff;
}

.service-card h3 {
    margin-bottom: var(--spacing-sm);
    font-size: 1.3rem;
    color: var(--heading-color);
}

.service-card p {
    color: var(--secondary-color);
}

/* ===== Footer Section ===== */
.footer {
    background-color: var(--footer-bg-color);
    color: #fff;
    padding: 50px 0 20px;
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.footer .logo {
    margin-bottom: 20px;
}

.footer .logo a {
    color: #fff;
}

.footer p {
    margin-bottom: 20px;
    color: #aaa;
}

.footer-links {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.footer-links a {
    color: #ddd;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: var(--primary-color);
}

.theme-toggler {
    margin-top: 20px;
}

/* Back to top button */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background-color: var(--primary-color);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: var(--transition);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background-color: #24292f; /* A slightly darker, modern feel */
    transform: translateY(-5px);
}

/* ===== Responsive Styles ===== */
@media (max-width: 991px) {
    .hero-content {
        flex-direction: column-reverse;
    }
    
    .text-content, .hero-image {
        width: 100%;
        margin-bottom: 30px;
    }
    
    .hero-image {
        margin-top: 30px;
    }
    
    .about-content {
        flex-direction: column;
    }
    
    .about-image {
        margin-bottom: 30px;
    }
    
    .certificate-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }

    .logo a img {
        max-height: 50px;
    }
}

@media (max-width: 768px) {
    .hero h1 {
        font-size: 2.5rem;
    }
    
    .hero p {
        font-size: 1.2rem;
    }
    
    .hero-buttons {
        flex-direction: column;
        gap: 10px;
    }
    
    .service-card {
        padding: 15px;
    }
    
    .certificate-grid {
        grid-template-columns: 1fr;
    }

    .logo a img {
        max-height: 40px;
    }
    
    nav {
        height: 70px;
    }
}

@media (max-width: 480px) {
    .logo a img {
        max-height: 35px;
    }
    
    nav {
        height: 60px;
    }
}

/* ===== Timeline Styles (Optional) ===== */
.timeline {
    padding: 50px 0;
    margin: 0 auto;
    max-width: 1200px;
    position: relative;
}

.timeline ol {
    position: relative;
    list-style: none;
    padding: 0;
}

.timeline ol::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50px;
    width: 3px;
    height: 100%;
    background: var(--primary-color);
    opacity: 0.6;
}

.timeline ol li {
    position: relative;
    margin-bottom: 60px;
}

.timeline ol li .item-inner {
    padding: 0 0 0 100px;
    position: relative;
}

.timeline ol li .time-wrapper {
    position: relative;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
}

.timeline ol li .time-wrapper::before,
.timeline ol li .time-wrapper::after {
    content: "";
    position: absolute;
    background: var(--primary-color);
}

.timeline ol li .time-wrapper::before {
    top: 50%;
    left: -50px;
    transform: translateY(-50%);
    width: 0;
    height: 3px;
    transition: width 0.8s linear;
}

.timeline ol li .time-wrapper::after {
    top: 50%;
    left: -60px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    transform: translateY(-50%) scale(0);
    transform-origin: center;
    transition: all 0.4s ease;
    background-color: var(--bg-color);
    border: 3px solid var(--primary-color);
}

.timeline ol li time,
.timeline ol li .details > * {
    opacity: 0;
    transition: 0.5s;
}

.timeline ol li time {
    display: inline-block;
    transform: translateY(-20px);
}

.timeline ol li .details > * {
    transform: translateY(20px);
}

.timeline ol li .details h3 {
    font-size: 1.4rem;
    margin-bottom: 10px;
    color: var(--heading-color);
}

.timeline ol li .details h4 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: var(--secondary-color);
}

.timeline ol li .details ul {
    margin: 10px 0;
    padding-left: 20px;
    line-height: 1.4;
}

.timeline ol li.in-view .time-wrapper::before {
    width: 40px;
}

.timeline ol li.in-view .time-wrapper::after {
    transition-delay: 0.8s;
    transform: translateY(-50%) scale(1);
}

.timeline ol li.in-view time,
.timeline ol li.in-view .details > * {
    opacity: 1;
    transform: none;
}

.timeline ol li.in-view time {
    transition-delay: 1s;
}

.timeline ol li.in-view .details h3 {
    transition-delay: 1.2s;
}

.timeline ol li.in-view .details h4 {
    transition-delay: 1.3s;
}

.timeline ol li.in-view .details ul {
    transition-delay: 1.4s;
}

@media (max-width: 768px) {
    .timeline ol::before {
        left: 30px;
    }
    .timeline ol li .item-inner {
        padding-left: 70px;
    }
    .timeline ol li .time-wrapper::before {
        display: none;
    }
    .timeline ol li .time-wrapper::after {
        left: -40px;
    }
}

/* ===== Links Section (Optional) ===== */
.links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.link-item {
    display: flex;
    align-items: center;
    padding: 15px;
    background-color: var(--card-bg);
    border-radius: 10px;
    transition: var(--transition);
    box-shadow: var(--box-shadow);
}

.link-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    background-color: var(--primary-color);
    color: #fff;
}

.link-item i {
    font-size: 1.5rem;
    margin-right: 15px;
    color: var(--primary-color);
    transition: color 0.3s ease;
}

.link-item:hover i {
    color: #fff;
}

/* ===== Contact Section ===== */
.contact {
    background-color: var(--bg-light);
}

.contact-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
}

.contact-info .info-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 30px;
}

.contact-info .info-item i {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-right: 20px;
    padding-top: 5px;
}

.contact-info .info-item h3 {
    font-size: 1.2rem;
    margin-bottom: 5px;
    color: var(--heading-color);
}

.contact-info .info-item p {
    color: var(--secondary-color);
}

.contact-form {
    background-color: var(--bg-color);
    padding: 30px;
    border-radius: 10px;
    box-shadow: var(--box-shadow);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--heading-color);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-main);
    transition: var(--transition);
}

.form-group textarea {
    height: 150px;
    resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.2);
}

.card {
    background-color: var(--bg-color);
    padding: 25px;
    border-radius: 10px;
    box-shadow: var(--box-shadow);
    margin-bottom: 30px;
    transition: transform 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
}

.card h3 {
    margin-bottom: 15px;
    color: var(--heading-color);
    position: relative;
    padding-bottom: 10px;
}

.card h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 3px;
    background-color: var(--primary-color);
}

/* Location info */
.location-info {
    padding: 15px;
    background-color: rgba(220, 38, 38, 0.05);
    border-left: 3px solid var(--primary-color);
    margin-bottom: 20px;
}

.members-list li {
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.members-list li:last-child {
    border-bottom: none;
}

/* Enhanced responsiveness */
@media (max-width: 768px) {
    .contact-content {
        grid-template-columns: 1fr;
    }
    .links-grid {
        grid-template-columns: 1fr;
    }
    .card {
        padding: 20px;
    }
}

/* Member Card Styling */
.members-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
}

.member-card {
    background-color: var(--bg-color);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--box-shadow);
    transition: transform 0.3s ease;
}

.member-card:hover {
    transform: translateY(-5px);
}

.member-image {
    width: 100%;
    height: 280px; /* Fixed height for consistency */
    overflow: hidden;
    position: relative;
}

.member-image img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* This maintains aspect ratio while filling container */
    object-position: center; /* Centers the image */
    transition: transform 0.3s ease;
}

.member-card:hover .member-image img {
    transform: scale(1.05);
}

.member-info {
    padding: 20px;
}

.member-info h4 {
    margin-bottom: 8px;
    font-size: 1.2rem;
    color: var(--heading-color);
}

.member-position {
    color: var(--primary-color);
    font-weight: 500;
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.member-project {
    color: var(--text-color);
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.member-email {
    color: var(--secondary-color);
    font-size: 0.85rem;
}

.member-category-title {
    margin: 40px 0 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
    color: var(--heading-color);
}

.member-category-title i {
    color: var(--primary-color);
    margin-right: 10px;
}

/* Profile Image - for PI */
.profile-image {
    width: 100%;
    height: 350px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--box-shadow);
}

.profile-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
}