/* ======================= BASE & TYPOGRAPHY ======================= */
:root {
    --primary-color: #38bdf8; /* A vibrant, light blue for accents */
    --secondary-color: #0ea5e9; /* A slightly darker blue for hover effects */
    --text-color: #e2e8f0; /* Off-white for body text */
    --text-color-muted: #94a3b8; /* Lighter gray for secondary text */
    --bg-dark-primary: #1e293b; /* Main background color (dark slate) */
    --bg-dark-secondary: #334155; /* Lighter background for containers/cards */
    --border-color: #475569; /* Subtle border color */
}

body {
    font-family: 'Lato', sans-serif;
    margin: 0;
    padding: 20px;
    background-color: var(--bg-dark-primary);
    color: var(--text-color);
    display: flex;
    justify-content: center;
}

.container {
    width: 100%;
    max-width: 1100px;
    background-color: var(--bg-dark-secondary);
    border: 1px solid var(--border-color);
    padding: 30px 40px;
    border-radius: 8px;
}

h1, h2, h3 {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    color: #f8fafc; /* Brighter white for headings */
}

h2 {
    font-size: 2em;
    padding-bottom: 10px;
    margin-bottom: 30px;
    border-bottom: 3px solid var(--primary-color);
    display: inline-block;
}

/* ======================= HEADER & NAVIGATION ======================= */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 20px;
    margin-bottom: 40px;
}

.logo {
    font-size: 2em;
    font-weight: 700;
    font-family: 'Montserrat', sans-serif;
    color: var(--primary-color);
    z-index: 1001;
    text-decoration: none;
}

nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 25px;
}

nav a.nav-link {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 700;
    font-size: 0.9em;
    padding: 5px 0;
    position: relative;
    transition: color 0.3s;
}

nav a.nav-link::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -5px;
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    transition: width 0.3s ease-out;
}

nav a.nav-link:hover, nav a.nav-link.active {
    color: var(--primary-color);
}
nav a.nav-link.active::after {
    width: 100%;
}

/* ======================= HOME SECTION ======================= */
.hero {
    display: flex;
    align-items: center;
    gap: 40px;
    margin-bottom: 40px;
}

.profile-picture {
    width: 250px;
    height: 250px;
    border-radius: 50%;
    border: 3px solid var(--primary-color);
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--primary-color);
    flex-shrink: 0;
}

.profile-picture img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.bio-text h1 {
    margin: 0;
    font-size: 2.2em;
}

.bio-text p {
    font-size: 1.1em;
    color: var(--text-color-muted);
}

.location-info {
    margin-left: auto;
    text-align: right;
    border-left: 2px solid var(--border-color);
    padding-left: 20px;
}

.location-info p {
    margin: 4px 0;
    font-weight: 600;
    color: var(--text-color-muted);
}

.about-me p {
    line-height: 1.7;
    font-size: 1.1em;
}


/* ======================= PROJECTS SECTION ======================= */
.project-filters {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.project-filters h4 {
    margin: 0 15px 0 0;
    font-size: 1em;
    color: var(--text-color-muted);
}

#tag-filters {
    margin-bottom: 30px;
}

.filter-btn {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 8px 16px;
    margin: 0;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
}

.filter-btn.active {
    background-color: var(--primary-color);
    color: var(--bg-dark-primary);
    border-color: var(--primary-color);
    font-weight: bold;
}

.filter-btn:hover {
    background-color: var(--primary-color);
    color: var(--bg-dark-primary);
    border-color: var(--primary-color);
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.project-card {
    border-radius: 8px;
    overflow: hidden;
    background-color: var(--bg-dark-primary);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: transform 0.3s, border-color 0.3s;
}

.project-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-color);
}

.project-card img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    display: block;
}

.card-content {
    padding: 15px;
}

.card-content h3 {
    margin-top: 0;
    margin-bottom: 10px;
}

.tag {
    display: inline-block;
    background-color: var(--bg-dark-secondary);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    margin-right: 5px;
    margin-bottom: 5px;
}

.modal-tags {
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 20px; /* Adds space between the tags and the image */
}

/* ======================= MODAL (POP-UP) STYLES ======================= */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    overflow-y: auto;
}

.modal.active {
    display: block;
    opacity: 1;
}

.modal-content {
    background-color: var(--bg-dark-secondary);
    border: 1px solid var(--border-color);
    padding: 30px;
    border-radius: 8px;
    width: 60%;
    position: relative;
    transform: scale(0.95);
    transition: transform 0.3s ease-in-out;
    margin: 5vh auto;
    display: flex;
    flex-direction: column;
}

.modal.active .modal-content {
    transform: scale(1);
}

.modal-content h2 {
    flex-shrink: 0;
    padding-bottom: 15px;
    margin-bottom: 15px;
}

.modal-content > img {
    flex-shrink: 0;
    object-fit: cover;
    width: 60%;
    border-radius: 4px;
    margin-bottom: 15px;
}

.close-button {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 2em;
    cursor: pointer;
    color: var(--text-color-muted);
}

.modal-body {
    display: flex;
    gap: 25px;
    margin-top: 20px;
    flex-shrink: 0; /* <-- THE CRITICAL FIX IS HERE */
}

.modal-sidebar {
    flex-basis: 150px;
    flex-shrink: 0;
    border-right: 1px solid var(--border-color);
    padding-right: 20px;
}

.modal-tab {
    display: block;
    width: 100%;
    background: none;
    border: none;
    color: var(--text-color-muted);
    padding: 10px;
    text-align: left;
    font-size: 1em;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.modal-tab:hover {
    background-color: var(--bg-dark-secondary);
    color: var(--text-color);
}

.modal-tab.active {
    background-color: var(--primary-color);
    color: var(--bg-dark-primary);
    font-weight: bold;
}

.modal-main-content {
    flex-grow: 1;
    padding-right: 15px;
}

.modal-pane {
    display: none;
    line-height: 1.7;
}

.modal-pane.active {
    display: block;
}

.modal-pane pre {
    background-color: var(--bg-dark-primary);
    padding: 15px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    white-space: pre-wrap;
    word-break: break-all;
}

.modal-pane code {
    font-family: 'Courier New', Courier, monospace;
}

.docs-list {
    list-style: none;
    padding: 0;
}

.docs-list li a {
    display: block;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    margin-bottom: 10px;
    text-decoration: none;
    color: var(--text-color);
    transition: background-color 0.2s, border-color 0.2s;
}

.docs-list li a:hover {
    background-color: var(--bg-dark-primary);
    border-color: var(--primary-color);
}

/* ======================= HISTORY SECTION (TIMELINE) ======================= */
.timeline {
    position: relative;
    max-width: 700px;
    margin: 0 auto;
}

.timeline::after {
    content: '';
    position: absolute;
    width: 3px;
    background-color: var(--primary-color);
    top: 0;
    bottom: 0;
    left: 50%;
    margin-left: -1.5px;
}

.timeline-item {
    padding: 10px 40px;
    position: relative;
    width: 50%;
    box-sizing: border-box;
}

.timeline-item:nth-child(odd) {
    left: 0;
    text-align: right;
}

.timeline-item:nth-child(even) {
    left: 50%;
}

.timeline-dot {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background-color: var(--bg-dark-secondary);
    border: 3px solid var(--primary-color);
    top: 10px; 
    border-radius: 50%;
    z-index: 1;
}

.timeline-item:nth-child(odd) .timeline-dot {
    right: -11px;
}

.timeline-item:nth-child(even) .timeline-dot {
    left: -11px;
}

.timeline-date {
    font-weight: bold;
    color: var(--primary-color);
}

.timeline-content h3 {
    margin-top: 5px;
    margin-bottom: 5px;
}

.timeline-content {
    text-align: justify;
}

/* ======================= CONTACT SECTION ======================= */
.contact-wrapper {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 60px;
    align-items: flex-start;
    margin-top: 40px;
}

.contact-info h3 {
    font-size: 1.8em;
    color: var(--primary-color);
    margin-top: 0;
}

.contact-info p {
    line-height: 1.7;
    color: var(--text-color-muted);
}

.contact-details {
    list-style: none;
    padding: 0;
    margin-top: 30px;
}

.contact-details li {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    font-size: 1.1em;
}

.contact-details svg {
    width: 24px;
    height: 24px;
    margin-right: 15px;
    color: var(--primary-color);
}

.contact-form-container {
    background-color: var(--bg-dark-primary);
    padding: 30px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.form-group {
    position: relative;
    margin-bottom: 35px;
}

.form-input {
    width: 100%;
    padding: 10px 0;
    font-size: 1em;
    color: var(--text-color);
    background-color: transparent;
    border: none;
    border-bottom: 2px solid var(--border-color);
    outline: none;
    position: relative;
    z-index: 1;
}

.form-label {
    position: absolute;
    top: 10px;
    left: 0;
    font-size: 1em;
    color: var(--text-color-muted);
    pointer-events: none;
    transition: all 0.2s ease-out;
}

.form-input:focus + .form-label,
.form-input:not(:placeholder-shown) + .form-label {
    top: -18px;
    left: 0;
    font-size: 0.8em;
    color: var(--primary-color);
}

.form-input:focus {
    border-bottom-color: var(--primary-color);
}

.btn-submit {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background-color: var(--primary-color);
    color: var(--bg-dark-primary);
    padding: 12px 25px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
    transition: transform 0.2s ease-out, background-color 0.2s;
}

.btn-submit svg {
    width: 18px;
    height: 18px;
    transition: transform 0.3s ease-in-out;
}

.btn-submit:hover {
    transform: translateY(-3px);
    background-color: var(--secondary-color);
}

.btn-submit:hover svg {
    transform: translateX(5px);
}

/* ======================= HAMBURGER MENU ======================= */
.hamburger-menu {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 25px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
}

.hamburger-menu .bar {
    width: 30px;
    height: 3px;
    background-color: var(--text-color);
    border-radius: 10px;
    transition: all 0.3s ease-in-out;
}

/* ======================= RESPONSIVE DESIGN ======================= */
@media (max-width: 850px) {
    .contact-wrapper {
        grid-template-columns: 1fr;
        gap: 40px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 20px;
        border: none;
    }
    
    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }
    
    .hamburger-menu {
        display: flex;
        position: absolute;
        top: 40px;
        right: 40px;
    }

    nav {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background-color: rgba(30, 41, 59, 0.98);
        z-index: 1000;
        display: flex;
        justify-content: center;
        align-items: center;
        transform: translateX(100%);
        transition: transform 0.3s ease-in-out;
    }
    
    nav.active {
        transform: translateX(0);
    }
    
    nav ul {
        flex-direction: column;
        gap: 40px;
        text-align: center;
    }

    nav a.nav-link {
        font-size: 1.5em;
    }

    .hamburger-menu.active .bar:nth-child(1) {
        transform: rotate(45deg) translate(5px, 6px);
    }
    .hamburger-menu.active .bar:nth-child(2) {
        opacity: 0;
    }
    .hamburger-menu.active .bar:nth-child(3) {
        transform: rotate(-45deg) translate(5px, -6px);
    }

    .hero {
        flex-direction: column;
        text-align: center;
        margin-top: 40px;
    }
    .location-info {
        margin-left: 0;
        text-align: center;
        border-left: none;
        padding-left: 0;
        margin-top: 20px;
    }
    .timeline::after {
        left: 20px;
    }
    .timeline-item {
        width: 100%;
        padding-left: 50px;
        padding-right: 15px;
        left: 0 !important;
        text-align: left !important;
    }
    .timeline-dot {
        left: 12px !important;
    }
    .button-links {
        justify-content: center;
    }
}

@media (max-width: 600px) {
    .modal-body {
        flex-direction: column;
    }
    .modal-sidebar {
        display: flex;
        flex-basis: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding-right: 0;
        padding-bottom: 10px;
        overflow-x: auto;
    }
    .modal-tab {
        flex-shrink: 0;
    }
}

/* --- CV DOWNLOAD BUTTON STYLE --- */
.btn-cv {
    display: inline-block;
    margin-top: 20px;
    padding: 10px 20px;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    text-decoration: none;
    font-weight: bold;
    border-radius: 4px;
    transition: background-color 0.3s, color 0.3s;
}

.btn-cv:hover {
    background-color: var(--primary-color);
    color: var(--bg-dark-primary);
}

/* --- LINK BUTTONS (CV, Social, etc.) --- */
.button-links {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 20px;
}

.icon-link-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center; /* <-- ADDED: Centers the icon and text */
    gap: 10px;
    min-width: 190px;         /* <-- ADDED: Sets a uniform minimum width */
    padding: 10px 20px;
    box-sizing: border-box;   /* <-- ADDED: Ensures padding is included in the width */
    background-color: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    text-decoration: none;
    font-weight: bold;
    border-radius: 4px;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 0 8px -2px var(--primary-color);
}

.icon-link-btn:hover {
    background-color: var(--primary-color); /* Fills with blue on hover */
    color: var(--bg-dark-primary); /* Text and icon turn dark on hover */
    transform: translateY(-2px);
    border-color: var(--primary-color); /* Ensures border stays blue */
    /* You can add a subtle box-shadow here if you want a subtle glow *around* the filled button on hover: */
    /* box-shadow: 0 0 10px rgba(56, 189, 248, 0.6); */
}

.icon-link-btn svg {
    width: 20px;
    height: 20px;
}

/* ======================= PUBLICATIONS PAGE ======================= */
.publication-list {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.publication-item {
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.publication-item:last-child {
    border-bottom: none;
}

.publication-item h3 {
    margin: 0;
    color: var(--text-color);
    font-size: 1.4em;
}

.publication-authors {
    margin: 5px 0;
    font-style: italic;
    color: var(--text-color-muted);
}

.publication-journal {
    margin: 5px 0 15px 0;
    color: var(--text-color);
}

.publication-description {
    margin: 10px 0 15px 0;
    color: var(--text-color);
    line-height: 1.6;
}

.publication-link {
    text-decoration: none;
    font-weight: bold;
    color: var(--primary-color);
    transition: opacity 0.3s;
}

.publication-link:hover {
    opacity: 0.8;
}

/* ======================= BOOKSHELF PAGE ======================= */
.subtitle {
    font-size: 1.1em;
    color: var(--text-color-muted);
    margin-top: -20px;
    margin-bottom: 40px;
}

.bookshelf-category {
    margin-bottom: 50px;
}

.bookshelf-category h3 {
    font-size: 1.6em;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
}

.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 30px;
}

.book-card {
    background-color: var(--bg-dark-primary);
    border-radius: 4px;
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
}

.book-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.book-card img {
    width: 100%;
    height: 225px;
    object-fit: cover;
    display: block;
}

.book-info {
    padding: 10px;
}

.book-title {
    font-weight: bold;
    margin: 0 0 5px 0;
    color: var(--text-color);
}

.book-author {
    font-size: 0.9em;
    margin: 0;
    color: var(--text-color-muted);
}

/* --- Book Modal Styles --- */
.book-modal-content {
    gap: 20px;
}

.book-modal-header {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 20px;
}

.book-modal-header img {
    width: 100px;
    height: 150px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}

.book-modal-info h2 {
    margin: 0 0 5px 0;
    border: none;
    font-size: 1.8em;
}

.book-modal-info p {
    margin: 0;
    font-size: 1.1em;
    color: var(--text-color-muted);
}

.book-modal-thoughts {
    line-height: 1.7;
}

/* --- SECTION SEPARATOR --- */
.section-title {
    margin-top: 60px; /* Adds space above a new section heading */
}