/* --- Color Variables (from main.css) --- */
/* Nordic theme */
:root {
  --header: #0D1B2A;

  --title-super-dark: #0D1B2A; 
  --title-dark: #1B263B;
  --title-light: #415A77;
  --title-super-light: #E0E5EA;

  --emphasis-1: #778DA9;
  --emphasis-2: #A4B5C6;

  --background-3: #F4F7FA;
  --background-2: #EEF2F5;
  --background-1: #FFFFFF;

  --text-dark: #0D1B2A;
  --text-light: white;
}

/* --- Main Content Layout --- */
.research-main {
    display: flex;
    flex-direction: column; /* Stack all research items vertically */
    gap: 30px; /* Space between each item */
    max-width: 90%; /* Constrain the width */
    margin: 20px auto;
    padding: 30px;
    background-color: var(--background-2); /* Use consistent background */
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

/* --- Individual Research Item --- */
.research-item {
    display: flex;
    flex-direction: row; /* Side-by-side: image on left, text on right */
    align-items: center; /* Vertically align image and text */
    gap: 25px; /* Space between image and text */
    
    padding-bottom: 30px; /* Add space below each item */
    border-bottom: 3px solid var(--background-1); /* Separator line */
}

.research-item:last-child {
    border-bottom: none; /* No line on the very last item */
    padding-bottom: 0;
}

/* --- Left Column: Image --- */
.research-image-container {
    flex-basis: 150px; /* Give the image a fixed width */
    flex-shrink: 0; /* Prevent the image from shrinking */
}

.research-image-container img {
    width: 150px;
    height: 150px;
    border-radius: 50%;  /* This makes the image a circle */
    object-fit: cover; /* Prevents stretching, crops to fit the circle */
    display: block;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* --- Right Column: Text --- */
.research-text-container {
    flex: 1; /* Allows text to take all remaining horizontal space */
    display: flex;
    flex-direction: column;
}

.research-text-container p {
    margin: 0px; /* Remove default paragraph margins */
    padding: 0px;
    line-height: 1.6;
}

.research-text-container h3 {
    margin: 0;
    color: var(--title-super-dark);
}

.research-text-container .authors {
    font-size: 0.95em;
    color: var(--title-dark);
}

.research-text-container .publication-venue {
    font-style: italic;
    font-size: 0.9em;
    color: var(--emphasis-1);
}

.research-text-container .abstract {
    margin-top: 5px;
    font-size: 0.95em;
    text-align: justify;
}

/* --- Links (PDF, Code, etc.) --- */
.links-container {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap; /* Allow links to wrap on small screens */
    gap: 15px; /* Space between links */
    margin-top: 10px; /* Space above the links */
}

.research-link {
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9em;
    color: var(--header);
    background-color: var(--background-3);
    padding: 5px 12px;
    border-radius: 5px;
    border: 1px solid var(--emphasis-2);
    transition: all 0.2s ease;
}

.research-link:hover {
    background-color: var(--emphasis-1);
    color: var(--text-light);
    border-color: var(--title-dark);
}

.copyright-footnote {
    margin-top: 5px;
    font-size: 0.8em;
}

/* --- Add these styles for the modal --- */

/* This class hides elements */
.hidden {
    display: none;
}

/* This just hides the BibTeX content visually */
.hidden-bibtex-content {
    display: none;
}

/* The dark background overlay */
#modal-overlay {
    position: fixed; /* Stay in place even when scrolling */
    top: 0;
    left: 0;
    width: 100vw; /* Full viewport width */
    height: 100vh; /* Full viewport height */
    background-color: rgba(0, 0, 0, 0.6); /* Semi-transparent black */
    z-index: 100; /* On top of everything */
}

/* The modal pop-up box */
#bibtex-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%); /* Center the modal */
    width: 80%;
    max-width: 600px;
    background-color: var(--background-1);
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    z-index: 101; /* On top of the overlay */
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid var(--background-2);
}

.modal-header h3 {
    margin: 0;
    color: var(--title-super-dark);
}

#modal-close-btn {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--title-dark);
    cursor: pointer;
    line-height: 1;
}
#modal-close-btn:hover {
    color: var(--title-super-dark);
}

.modal-body {
    padding: 20px;
}

/* Style the <pre> tag we added in the HTML */
.modal-body pre {
    background-color: var(--background-2);
    padding: 15px;
    border-radius: 5px;
    border: 1px solid var(--emphasis-2);
    color: var(--title-dark);
    font-family: monospace;
    white-space: pre-wrap;   /* Allows long lines to wrap */
    word-break: break-all; /* Breaks long strings */
    max-height: 400px; /* Make it scrollable if content is tall */
    overflow-y: auto;
}

/* --- Add these styles for the modal footer --- */

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--background-2);
    display: flex;
    justify-content: flex-end; /* Aligns button(s) to the right */
}

/* We reuse the .research-link style, but here's 
   a state for when the button is clicked */
#copy-bibtex-btn {
    color: var(--emphasis-1);
    background-color: var(--background-3);
}


/* --- Responsive Design --- */
@media (max-width: 768px) {
    .research-item {
        flex-direction: column; /* Stack image on top of text */
        text-align: center; /* Center the text */
    }

    /* Center the links on mobile */
    .links-container {
        justify-content: center;
    }
}