/* Import JetBrains Mono font */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;700&display=swap');

/* General Styles */
body {
    font-family: 'JetBrains Mono', monospace;
    background-color: var(--dark-bg);
    color: var(--dark-text);
    line-height: 1.6;
    margin: 0;
    padding: 0;
}
.container {
    max-width: var(--container-width);
    margin: 50px auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

h1 {
    margin-bottom: 20px;
}

textarea, 
input[type="text"], 
[contenteditable="true"] {
    width: 100%;
    padding: 15px;  /* Increased padding */
    margin-bottom: 0px;
    border-radius: 5px;
    text-align: center;
    resize: none;
    background-color: #282828;
    color: #ffffff;  /* Brighter white for better contrast */
    border: 1px solid #444;
    overflow: hidden;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.0em;  /* Slightly reduced as JetBrains Mono runs larger */
    line-height: 1.5;  /* Better line height for readability */
}

/* Ensure placeholder text uses JetBrains Mono */
textarea::placeholder,
input[type="text"]::placeholder {
    color: #a0a0a0;  /* Lighter gray for better visibility */
    opacity: 1;  /* Ensure placeholder is clearly visible */
    font-size: 1.1em;
    font-family: 'JetBrains Mono', monospace;
}

button {
    padding: 10px 20px;
    border-radius: 5px;
    background-color: #007BFF;
    color: #FFF;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s;
    font-family: 'JetBrains Mono', monospace;
}

button:hover {
    background-color: #0056b3;
}

/* Class specific styles */
.logo {
    width: 80px;
    height: auto;
    display: block;
    margin: 0;
    transition: filter 0.3s ease;
}

.response {
    width: 100%;
    margin-top: 20px;
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #181818; 
    background-color: #181818;
    text-align: left;
    font-family: 'JetBrains Mono', monospace;
    display: none; /* Initially hide the response box */
}

.activeResponse {
    display: block; /* Show the response box */
    border: 1px solid #444; /* Slightly lighter border for contrast */
    background-color: #282828; /* Darker background for response box */
}

.title {
    font-family: 'JetBrains Mono', monospace;
    font-variant: small-caps;
    display: block;
    font-size: 1.0em;  /* 1.5 times the parent or root font size */
    font-weight: 700;
}
  
.subtitle {
    /* font-style: italic; */
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.5em;  /* 1.5 times the parent or root font size */
    display: block;
    font-weight: 300;
}

/* Connection status styling */
.connection-status {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 20px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 1000;
    transition: all 0.3s ease;
}

/* Light theme connection status */
.light-theme .connection-status {
    background-color: var(--light-input-bg);
    border: 1px solid var(--light-border);
    color: var(--light-text);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Dark theme connection status */
.dark-theme .connection-status {
    background-color: var(--dark-input-bg);
    border: 1px solid var(--dark-border);
    color: var(--dark-text);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Connection spinner */
.connection-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid;
    border-radius: 50%;
    border-color: currentColor currentColor currentColor transparent;
    animation: spin 1s linear infinite;
}

/* Light theme spinner */
.light-theme .connection-spinner {
    border-color: var(--light-text) var(--light-text) var(--light-text) transparent;
}

/* Dark theme spinner */
.dark-theme .connection-spinner {
    border-color: var(--dark-text) var(--dark-text) var(--dark-text) transparent;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Error message styles (from previous suggestion) */
.error-message {
    color: #e74c3c;
    background-color: #2a2a2a;
    padding: 10px;
    margin: 10px 0;
    border-radius: 5px;
    border: 1px solid #e74c3c;
}

/* Utility Classes */
.hidden {
    display: none;
}


/* Email link styling */
.email-link {
    color: #4FC3F7; /* Light blue for better visibility on dark backgrounds */
    text-decoration: none; /* Optional: removes underline */
}

.email-link:hover {
    color: #29B6F6; /* A slightly darker light blue when hovered */
}

/* ID specific styles */

registerButton {
    position: absolute;
    bottom: 10px;
    left: 10px;
}  

aboutButton {
    position: absolute;
    bottom: 10px;
    right: 10px;
}  

/* Footer Styles */
footer {
    margin-bottom: 40px;
    text-align: center;
}

footer a {
    color: #e0e0e0;
    text-decoration: none;
    margin: 0 10px;
}

footer a:hover {
    text-decoration: underline;
}

footer .copyright {
    margin-top: 1.5rem;
    font-size: 0.75em;
    color: var(--text);
    opacity: 0.5;
}


/* How It Works Styles */
#howItWorks {
    font-size: 0.75em;
    margin: 40px 0;  /* Updated margin */
    text-align: center;
    width: 100%;
}

.features {
    display: flex;
    flex-wrap: wrap;  /* Added for better responsiveness */
    justify-content: space-between;
    gap: 20px;  /* Added for consistent spacing */
    margin-top: 20px;
}

.feature-box {
    flex: 1;
    min-width: 250px;  /* Added minimum width */
    background-color: var(--dark-input-bg);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

/* Light theme support */
.light-theme .feature-box {
    background-color: var(--light-input-bg);
    border-color: var(--light-border);
}

.feature-box h3 {
    color: var(--button-bg);
    margin-bottom: 15px;
}

.feature-box p {
    color: var(--text);
    line-height: 1.5;
}

/* Register Expert specific styles */
[contenteditable="true"] {
    border: 1px solid #ccc;
    padding: 10px;
}

/* Displays the form in register in one column */
input[type="text"],
input[type="submit"] {
    display: block;
    margin: 0 auto 15px auto;
    width: 50%;  
}

td[contenteditable="true"]:nth-child(1) {
/* Title */
    min-height: 20px;
    width: 20%;
    font-size: 0.75em;
}
  
td[contenteditable="true"]:nth-child(2) {
/* Abstract */
    min-height: 100px;
    width: 50%;
    overflow-y: auto;
    font-size: 0.75em;
}

td[contenteditable="true"]:nth-child(3) {
    /* DOI */
    min-height: 100px;
    width: 50%;
    overflow-y: auto;
    font-size: 0.75em;
}
  
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px #282828 inset;
    box-shadow: 0 0 0 1000px #282828 inset;
    -webkit-text-fill-color: #ffffff !important;
}


/* Home button styling */
.home-button {
    display: inline-block;
    padding: 10px 20px;
    margin-top: 10px;
    background-color: #007BFF; /* Blue background for visibility */
    color: white; /* White text */
    text-decoration: none; /* Removes underline */
    border-radius: 5px;
    transition: background-color 0.3s, color 0.3s;
}

.home-button:hover {
    background-color: #0056b3; /* Darker blue when hovered */
    color: #CCC; /* Light grey text on hover */
}

/* Style for the clickable links */
#response a {
    color: #4CAF50; /* Green color for links */
    text-decoration: none;
    transition: color 0.3s ease;
}

#response a:hover {
    color: #45a049; /* Slightly darker green on hover */
    text-decoration: underline;
}

/* Add these to your existing styles */
.search-container, .response-container {
    width: 100%;
    max-width: 800px;  /* or whatever width suits your design */
    margin: 0 auto;    /* center containers */
    padding: 15px;
    box-sizing: border-box;
}

#userInput {
    width: 100%;
    min-height: 100px;
    padding: 10px;
    margin-bottom: 15px;
    box-sizing: border-box;
    border-radius: 5px;
    transition: background-color 0.3s, border-color 0.3s, color 0.3s;
}

#response {
    width: 100%;
    padding: 15px;
    box-sizing: border-box;
    background-color: #282828;
    border-radius: 5px;
    margin-top: 20px;
    color: #fff;
    white-space: pre-wrap;  /* Preserve formatting */
}

#sendQuery {
    display: block;
    width: 200px;      /* Fixed width for button */
    margin: 15px auto; /* Center the button */
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    background-color: #4CAF50;
    color: white;
    cursor: pointer;
    transition: background-color 0.3s;
}

#sendQuery:hover {
    background-color: #45a049;
}

/* Progress container alignment */
#search-progress-container {
    margin: 10px auto;
    background-color: var(--dark-input-bg); /* Default/dark theme - keep this */
    padding: 10px;
}

/* Light theme override */
.light-theme #search-progress-container,
.light-theme #search-progress-container .progress-header {
    background-color: var(--light-input-bg);
    border: 1px solid var(--light-border);
    color: var(--light-text);
}

/* Progress bar specific styling for light theme */
.light-theme #search-progress {
    accent-color: var(--light-button); /* Makes progress bar match theme */
}

/* Status message color for light theme */
.light-theme #status-message {
    color: var(--light-text);
}

/* Theme-specific status message colors */
.dark-theme #status-message {
    color: #e0e0e0;
}

/* Progress bar styling */
progress {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
}

/* Style the progress bar for webkit browsers */
progress::-webkit-progress-bar {
    background-color: var(--dark-input-bg);
    border-radius: 4px;
}

progress::-webkit-progress-value {
    background-color: #4CAF50;
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* Style the progress bar for Firefox */
progress::-moz-progress-bar {
    background-color: #4CAF50;
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* For IE/Edge */
progress {
    color: var(--button-bg);
}

/* Progress container animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#search-progress-container {
    animation: fadeInUp 0.3s ease;
}

#search-progress-container.results-mode {
    background: transparent;
    border: none;
    padding: 10px 0;
}

/* Style for Possible Matches title */
.results-title {
    width: 100%;
    max-width: var(--container-width);
    margin: 15px auto;
    padding: 0;
    box-sizing: border-box;
    text-align: center;  /* Center the title */
}

.results-title h2 {
    color: var(--text);  /* Use theme text color */
    font-size: 1.5em;
    margin: 0;
    padding: 0;
}

/* Make the container blend with background */
#search-progress-container.results-mode {
    background: transparent;  /* Make container background transparent */
    border: none;            /* Remove border */
    padding: 10px 0;        /* Keep some vertical spacing */
}

:root {
    --container-width: 800px;
    --container-padding: 15px;
    --content-width: calc(var(--container-width) - 2 * var(--container-padding));
    --active-bg: #2a2a2a;  /* Same as input background */
    --inactive-bg: #1a1a1a; /* Darker background for inactive tabs */
    --dark-input-bg: #2a2a2a;    /* Card and active tab background */
    --dark-bg: #121212;          /* Softer black background */
    --hover-bg: #222;            /* Hover state background */
    --text: #fff;                /* Default text color */
    --text-muted: rgba(255, 255, 255, 0.7); /* Secondary text */
    --border: #333;
    
    /* Dark theme colors */
    --dark-text: #EAEAEA;        /* Off-white text */
    --dark-button: #6DCB78;      /* Softer green */
    --dark-button-hover: #5BB566;
    --dark-hover-bg: #2a2a2a;
    
    /* Light theme colors */
    --light-bg: #FAFAFA;         /* Off-white background */
    --light-input-bg: #F5F5F5;   /* Light gray for boxes */
    --light-text: #333333;       /* Darker gray text */
    --light-border: #ddd;
    --light-button: #6DCB78;     /* Matching green */
    --light-button-hover: #5BB566;
    --light-hover-bg: #EEEEEE;
}

/* Theme-specific variables */
.light-theme {
    --bg: #ffffff;
    --input-bg: #f5f5f5;
    --card-bg: #ffffff;
    --border: #ddd;
    --text: #333333;
    --button-bg: #4CAF50;
    --button-text: #ffffff;
    --button-hover: #45a049;
    --hover-bg: #e8e8e8;
    --link-color: #2e7d32;
    --link-hover: #1b5e20;
    --container-bg: #f5f5f5;
}

.dark-theme {
    --bg: #1a1a1a;
    --input-bg: #282828;
    --card-bg: #333333;
    --border: #444;
    --text: #e0e0e0;
    --button-bg: #4CAF50;
    --button-text: #ffffff;
    --button-hover: #45a049;
    --hover-bg: #3a3a3a;
    --link-color: #4CAF50;
    --link-hover: #45a049;
    --container-bg: #282828;
}

/* Theme class for body */
body {
    transition: background-color 0.3s, color 0.3s;
    margin: 0;
    padding: 20px;
}

body.light-theme {
    background-color: var(--light-bg);
    color: var(--light-text);
}

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

/* Theme toggle button */
#theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 10px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s;
}

/* Container styling for consistent width */
.search-container, 
.response-container {
    width: var(--container-width);
    max-width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
    /* Remove padding from containers */
    padding: 0;
}

/* Textarea styling */
#userInput,
#response {
    width: 100%;
    min-height: 100px;
    padding: var(--container-padding);
    margin: 0;  /* Remove margins */
    box-sizing: border-box;
    border-radius: 5px;
    transition: background-color 0.3s, border-color 0.3s, color 0.3s;
}

/* Response area styling */
#response {
    width: var(--container-width);
    max-width: 100%;
    padding: var(--container-padding);
    box-sizing: border-box;
    border-radius: 5px;
    margin-top: 20px;
    white-space: pre-wrap;
    transition: background-color 0.3s, border-color 0.3s, color 0.3s;
}

/* Button styling */
#sendQuery {
    display: inline-block;  /* Changed from block */
    width: 200px;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    background-color: var(--button-bg);
    color: white;
    cursor: pointer;
    transition: background-color 0.3s;
}

/* Progress container alignment */
#search-progress-container {
    width: 100%;
    max-width: var(--container-width);
    margin: 10px auto;
    padding: 10px;
    background-color: var(--dark-input-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    box-sizing: border-box;
    display: none; /* Keep the default hidden state */
}

/* Update the feature boxes styling */
.features {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin: 40px auto;
    width: var(--container-width);
    max-width: 100%;
}

.feature-box {
    flex: 1;
    padding: 20px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

/* Light theme */
.light-theme .feature-box {
    background-color: var(--container-bg);
    border: 1px solid var(--border);
    color: var(--text);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Dark theme */
.dark-theme .feature-box {
    background-color: var(--container-bg);
    border: 1px solid var(--border);
    color: var(--text);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Feature box headings */
.feature-box h3 {
    margin-top: 0;
    margin-bottom: 15px;
    transition: color 0.3s ease;
}

.light-theme .feature-box h3 {
    color: var(--text);
}

.dark-theme .feature-box h3 {
    color: var(--text);
}

/* Feature box paragraphs */
.feature-box p {
    margin: 0;
    line-height: 1.5;
    transition: color 0.3s ease;
}

/* Make sure input and output containers are exactly the same width */
.search-container,
.response-container,
#userInput,
#response {
    width: var(--content-width);
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

/* Update textarea and response area to use exact same dimensions */
#userInput,
#response {
    padding: var(--container-padding);
    border-radius: 5px;
    transition: background-color 0.3s, border-color 0.3s, color 0.3s;
}

/* Container wrapper to ensure alignment */
.container {
    width: 100%;
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 var(--container-padding);
    box-sizing: border-box;
}

/* Button container adjustments */
.button-container {
    margin: 0;        /* Remove all margins */
    padding: 0;       /* Remove all padding */
    line-height: 1;   /* Reduce line height */
    height: auto;     /* Let content determine height */
    display: flex;    /* Use flexbox for centering */
    justify-content: center; /* Center horizontally */
    align-items: center;     /* Center vertically */
}

/* Theme-specific borders */
.light-theme #userInput,
.light-theme #response {
    border: 1px solid var(--border);
    background-color: var(--input-bg);
    color: var(--text);
}

.dark-theme #userInput,
.dark-theme #response {
    border: 1px solid var(--border);
    background-color: var(--input-bg);
    color: var(--text);
}

/* Matches container alignment */
.matches-container {
    width: var(--content-width);
    max-width: 100%;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    background: var(--bg);
    border-radius: 8px;
    padding: 20px;
    margin: 0 auto;
}

.matches-container.visible {
    opacity: 1;
    visibility: visible;
}

/* Tab navigation container */
.tab-navigation {
    width: 100%;
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 0;
    overflow: visible;
}

/* Tab headers wrapper */
.tab-headers-wrapper {
    flex: 1;
    overflow-x: hidden;
    margin: 0;
    position: relative;
}

/* Tab headers container */
.tab-headers {
    display: flex;
    gap: 10px;
    padding: 0;
    transition: transform 0.3s ease;
}

/* Individual tab header */
.tab-header {
    flex: 0 0 auto;
    padding: 12px 20px;
    background-color: #1a1a1a !important;  /* Force darker background for inactive tabs */
    border: 1px solid var(--border);
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    min-width: 120px;
    margin-bottom: -1px;
}

/* Tab content styling */
.tab-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-weight: 400;
}

/* Score and ID styling */
.researcher-id, .match-score {
    color: var(--text);  /* Keep white for all states */
    opacity: 0.9;        /* Slight dimming for visual hierarchy */
}

/* Inactive tab state */
.tab-header:not(.active) {
    background-color: var(--dark-bg);  /* Changed: Darker background for inactive tabs */
}

/* Active tab state */
.tab-header.active {
    background-color: #282828 !important;  /* Force matching card background color */
    border-bottom-color: #282828;
    z-index: 1;
}

/* Hover state for inactive tabs */
.tab-header:hover:not(.active) {
    background-color: #222222 !important;  /* Force hover color */
}

/* Ensure text remains visible on hover */
.tab-header:hover .tab-info,
.tab-header:hover .researcher-id,
.tab-header:hover .match-score {
    color: var(--text);
    opacity: 1;
}

/* Tab panel - matching active tab */
.tab-panel {
    display: none;
    padding: 20px;
    background-color: #282828;  /* Matching the active tab */
    border: 1px solid var(--border);
    border-radius: 0 0 8px 8px;
    margin-top: -1px;
}

.tab-panel.active {
    display: block;
}

/* Remove debug outline styles */
.tab-header.active::after {
    content: none;  /* Remove debug outline */
}

/* Navigation buttons */
.nav-button {
    flex: 0 0 auto;
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 1.2em;
    cursor: pointer;
    padding: 8px;
    transition: opacity 0.3s ease;
}

.nav-button.disabled {
    opacity: 0.3;
    cursor: default;
}

/* Remove any vertical scrollbars */
.matches-container {
    overflow-y: visible;
}

.tab-headers-wrapper::-webkit-scrollbar {
    display: none;
}

/* Tab info styling in active state */
.tab-header.active .tab-info {
    color: var(--text-highlight);
}

/* Match card content */
.match-card-preview {
    margin-bottom: 20px;
    background: var(--dark-input-bg);
}

/* Section titles in cards */
.section-title {
    color: var(--dark-button);  /* Same green as query titles */
    font-weight: 500;
    font-size: 0.95em;
    margin-bottom: 10px;
    display: block;
}

/* Light theme support */
.light-theme .section-title {
    color: var(--light-button);
}

/* Match card content sections */
.match-motivation,
.researcher-expertise,
.researcher-short-bio {
    font-size: 1.0em;
    line-height: 1.6;
    color: var(--text);
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.match-motivation:last-child,
.researcher-expertise:last-child,
.researcher-short-bio:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

/* Tab header styling for both themes */
.light-theme .tab-header {
    background-color: #e8e8e8 !important; /* Lighter gray for inactive tabs */
    border: 1px solid #ddd;
    color: #333;
}

.light-theme .tab-header:hover {
    background-color: #f0f0f0 !important;
}

.light-theme .tab-header.active {
    background-color: #ffffff !important; /* White background for active tab */
    border-bottom-color: #ffffff;
    color: #333;
}

.light-theme .tab-panel {
    background-color: #ffffff;
    border: 1px solid #ddd;
    color: #333;
}

/* Ensure tab colors aren't overridden */
.light-theme .tab-header[style] {
    background-color: #e8e8e8 !important;
}

.light-theme .tab-header.active[style] {
    background-color: #ffffff !important;
}

/* Match card styling for light theme */
.light-theme .match-card-preview {
    background-color: var(--light-input-bg);
    border: 1px solid var(--light-border);
}

.light-theme .match-card-details {
    background-color: #ffffff;
    border-top: 1px solid #ddd;
}

.light-theme .show-more-btn {
    background-color: #f5f5f5;
    color: #333;
    border: 1px solid #ddd;
}

.light-theme .show-more-btn:hover {
    background-color: #e8e8e8;
}

.query-interpretation {
    background: var(--dark-input-bg);
    border-radius: 8px;
    padding: 20px;
    margin: 0 0 20px 0;
    border: 1px solid var(--dark-border);
    font-size: 1.0em;
    line-height: 1.5;
}

/* Query sections */
.original-query, .interpreted-query {
    margin-bottom: 15px;
}

.original-query strong, .interpreted-query strong {
    color: var(--dark-button);  /* Use theme green for headers */
    display: block;
    margin-bottom: 10px;
    font-size: 0.95em;
}

/* Query text styling */
.original-query p,
.interpreted-query p {
    margin: 0;
    line-height: 1.4;
    word-wrap: break-word;
    max-height: 4.2em;
    overflow-y: auto;
    padding-right: 10px;
    color: var(--dark-text);  /* Off-white for dark theme */
}

/* Interpretation components */
.interpreted-query > p {
    margin: 8px 0;
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 10px;
    align-items: start;
}

.interpreted-query label {
    color: var(--dark-button);  /* Theme green for labels */
    font-weight: 500;
    font-size: 0.9em;
}

.interpreted-query span {
    color: var(--dark-text);  /* Off-white for dark theme */
    line-height: 1.4;
    word-wrap: break-word;
}

/* Light theme overrides */
.light-theme .query-interpretation {
    background: var(--light-input-bg);
}

.light-theme .original-query strong,
.light-theme .interpreted-query strong,
.light-theme .interpreted-query label {
    color: var(--light-button);  /* Theme green for light mode */
}

.light-theme .original-query p,
.light-theme .interpreted-query p,
.light-theme .interpreted-query span {
    color: var(--light-text);  /* Dark gray for light theme */
}

.main-topic, .related-skills, .refined-query {
    display: flex;
    gap: 8px;
}

/* Highlight labels in both themes */
.query-interpretation .main-topic::before,
.query-interpretation .related-skills::before,
.query-interpretation .refined-query::before {
    color: var(--light-button);
}

.light-theme .query-interpretation .main-topic::before,
.light-theme .query-interpretation .related-skills::before,
.light-theme .query-interpretation .refined-query::before {
    color: var(--dark-button);
}

/* Logo styling - with more aggressive debug styles */
.logo-container {
    flex: 0 0 auto;
    margin-left: 20px;
    padding: 0;
    background: none;
}

/* Logo image */
.logo {
    width: 80px;
    height: auto;
    display: block;
    margin: 0;
    transition: filter 0.3s ease;
}

/* Theme-specific logo handling - adjusted for consistent thickness */
.light-theme .logo {
    filter: brightness(0.2); /* Subtle darkening for light theme */
}

.dark-theme .logo {
    filter: brightness(0) invert(0.9); /* More precise control over brightness */
}

/* Remove debug styles for header */
header {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    padding: 20px;
    margin-bottom: 15px;
}

/* Title styling */
h1 {
    margin: 0;
    text-align: left;
    flex: 0 1 auto;
}

/* Remove debug container */
#debug-output-container {
    display: none;  /* Hide debug container */
}

.search-progress {
    position: relative;
    margin: 20px 0;
    padding: 20px;
    background: var(--container-bg);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.stage-indicator {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
}

.stage {
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0.5;
    transition: opacity 0.3s;
}

.stage.active {
    opacity: 1;
}

.stage-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--button-bg);
    transition: transform 0.3s;
}

.stage.active .stage-dot {
    transform: scale(1.2);
}

.typing-animation {
    display: inline-flex;
    gap: 4px;
    margin-right: 8px;
}

.typing-animation .dot {
    width: 6px;
    height: 6px;
    background: var(--text);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-animation .dot:nth-child(2) { animation-delay: 0.2s; }
.typing-animation .dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-4px); }
}

.insight-item {
    padding: 8px 12px;
    background: var(--input-bg);
    border-radius: 4px;
    margin-top: 8px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.search-status {
    position: relative;
    margin: 20px 0;
    padding: 20px;
    background: var(--container-bg);
    border-radius: 8px;
    border: 1px solid var(--border);
    transition: opacity 0.3s ease;
    display: none; /* Force hidden by default */
}

.search-status.hidden {
    display: none !important; /* Use !important to ensure it stays hidden */
    opacity: 0;
}

/* Also ensure progress containers are hidden by default */
#search-progress-container,
#progress.progress-container {
    display: none;
}

/* Update the researcher-expertise styling */
.researcher-expertise {
    margin-bottom: 15px;
    position: relative;
    padding-bottom: 40px; /* Make room for the link */
}

/* Update profile link styling */
.researcher-profile-link {
    position: absolute;
    bottom: 10px;
    right: 0;
    color: #4CAF50;
    text-decoration: none;
    font-size: 0.9em;
    transition: color 0.3s ease;
}

.researcher-profile-link:hover {
    color: #45a049;
    text-decoration: underline;
}

/* Theme-specific link colors */
.light-theme .researcher-profile-link {
    color: var(--light-button);
}

.light-theme .researcher-profile-link:hover {
    color: var(--light-button-hover);
}

.dark-theme .researcher-profile-link {
    color: var(--dark-button);
}

.dark-theme .researcher-profile-link:hover {
    color: var(--dark-button-hover);
}

/* Update theme-specific text colors for light theme */
.light-theme textarea,
.light-theme input[type="text"],
.light-theme [contenteditable="true"] {
    background-color: var(--light-input-bg);
    color: var(--light-text);
    border: 1px solid var(--light-border);
}

.light-theme textarea::placeholder,
.light-theme input[type="text"]::placeholder {
    color: #666666;
}

.light-theme .match-motivation,
.light-theme .researcher-expertise,
.light-theme .researcher-short-bio,
.light-theme .query-interpretation,
.light-theme .original-query p,
.light-theme .interpreted-query p {
    color: var(--light-text);
}

/* Phinder Query container styling */
.phinder-query-container {
    width: 100%;
    max-width: var(--container-width);
    margin: 10px 0;
    padding: 15px;
    background-color: var(--dark-input-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.phinder-query-container.visible {
    opacity: 1;
    visibility: visible;
}

.phinder-query-content h3 {
    margin: 0 0 15px 0;
    color: var(--dark-button);
    font-size: 1.1em;
}

/* Theme-specific styles */
.light-theme .phinder-query-container {
    background-color: var(--light-input-bg);
    border-color: var(--light-border);
}

.dark-theme .phinder-query-container {
    background-color: var(--dark-input-bg);
    border-color: var(--dark-border);
}

/* Container width consistency */
.search-area,
.phinder-query-container,
.results-area,
.matches-container {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin: 20px 0;
    padding: 20px;
    border-radius: 8px;
}

/* Specific styling for matches container */
.matches-container {
    padding: 0; /* Remove padding from matches container as cards have their own padding */
    background: transparent; /* Remove background as cards have their own */
    border: none; /* Remove border as cards have their own */
}

/* Ensure tab panels (match cards) align with containers above */
.tab-panel {
    width: 100%;
    box-sizing: border-box;
    margin: 0; /* Remove margin as container handles spacing */
}

/* Adjust header alignment */
.matches-container h2,
.possible-matches {
    padding: 0 20px; /* Add padding to align with container edges */
    margin: 0 0 20px 0;
}

/* Ensure consistent border radius */
.search-area textarea,
.phinder-query-container,
.tab-panel {
    border-radius: 8px;
}

/* Base container width for all main sections */
.container {
    max-width: var(--container-width);
    margin: 50px auto;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Search area and Phinder Query containers */
.search-area,
.phinder-query-container,
#search-progress-container {
    width: 100%;
    max-width: var(--container-width);
    margin: 10px 0;
    box-sizing: border-box;
}

/* Specific styling for Phinder Query */
.phinder-query-container {
    background-color: var(--dark-input-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    padding: 15px;  /* Match textarea padding */
}

/* Remove any potential conflicting styles */
.phinder-query-container {
    margin-left: 0;
    margin-right: 0;
}

/* Base container width */
.search-area,
.phinder-query-container {
    width: 100%;
    max-width: var(--container-width);
    margin: 10px auto;
    box-sizing: border-box;
}

/* Remove padding from outer containers */
.search-area,
.phinder-query-container {
    padding: 0;
    background: transparent;
    border: none;
}

/* Style the inner containers */
.search-container,
.phinder-query-content {
    width: 100%;
    padding: var(--container-padding);
    background-color: var(--dark-input-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-sizing: border-box;
}

/* Ensure textarea takes full width */
#userInput {
    width: 100%;
    box-sizing: border-box;
    margin: 0;
}

/* Phinder Query container transitions */
.phinder-query-container {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.phinder-query-container.visible {
    opacity: 1;
    visibility: visible;
}

/* Theme-specific styles */
.light-theme .search-container,
.light-theme .phinder-query-content {
    background-color: var(--light-input-bg);
    border-color: var(--light-border);
}

.dark-theme .search-container,
.dark-theme .phinder-query-content {
    background-color: var(--dark-input-bg);
    border-color: var(--dark-border);
}

/* Base container widths and structure */
.search-area,
.phinder-query-container,
.search-progress-container {
    width: 100%;
    max-width: var(--container-width);
    margin: 10px auto;
    box-sizing: border-box;
    padding: 0;
    background: transparent;
    border: none;
}

/* Inner container styling */
.search-container,
.phinder-query-content,
#search-progress-container {
    width: 100%;
    padding: var(--container-padding);
    background-color: var(--dark-input-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-sizing: border-box;
}

/* Progress bar specific styling */
#search-progress-container {
    margin: 0;  /* Remove margin since parent container handles spacing */
}

#search-progress {
    width: 100%;
    height: 8px;
    margin-top: 10px;
}

/* Theme-specific styles */
.light-theme .search-container,
.light-theme .phinder-query-content,
.light-theme #search-progress-container {
    background-color: var(--light-input-bg);
    border-color: var(--light-border);
}

.dark-theme .search-container,
.dark-theme .phinder-query-content,
.dark-theme #search-progress-container {
    background-color: var(--dark-input-bg);
    border-color: var(--dark-border);
}

/* Phinder Query content styling */
.query-section {
    padding: 15px;
}

.query-section strong {
    display: block;
    color: var(--dark-button);
    margin-bottom: 10px;
    font-size: 0.95em;
}

.query-section p {
    margin: 8px 0;
    line-height: 1.4;
}

.query-section .interpreted-query p {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 10px;
    align-items: start;
}

.query-section label {
    color: var(--dark-button);
    font-weight: 500;
    font-size: 0.9em;
}

.query-section span {
    color: var(--text);
}

/* Theme-specific styles */
.light-theme .query-section strong,
.light-theme .query-section label {
    color: var(--light-button);
}

.light-theme .query-section span {
    color: var(--light-text);
}

/* Search area refinements */
.search-area {
    width: 100%;
    max-width: var(--container-width);
    margin: 10px auto;
}

.search-container {
    padding: 10px;  /* Reduced from 15px */
    gap: 5px;      /* Reduced from 10px */
}

.button-container {
    margin: 0;        /* Remove all margins */
    padding: 0;       /* Remove all padding */
    line-height: 1;   /* Reduce line height */
    height: auto;     /* Let content determine height */
}

#sendQuery {
    padding: 4px 20px;  /* Keep compact vertical padding */
    margin: 5px 0;      /* Small vertical margin */
    line-height: 1.2;   /* Tight line height */
}

/* Textarea refinements */
#userInput {
    padding: 8px;    /* Reduced from 15px */
    min-height: 40px;  /* Reduced from default */
    margin: 0;
}

/* Ensure consistent container widths */
.search-area,
.phinder-query-container,
#search-progress-container,
.results-area {
    width: 100%;
    max-width: var(--container-width);
    box-sizing: border-box;
}

/* Ensure results area doesn't constrain inner containers */
.results-area {
    width: 100%;
    max-width: var(--container-width);
    margin: 10px auto;
    padding: 0;  /* Remove padding that might affect inner containers */
    box-sizing: border-box;
}

/* Base container styles for consistent width and appearance */
.search-area,
.phinder-query-container,
.results-area,
#search-progress-container,
.matches-container {
    width: 100%;
    max-width: var(--container-width);
    margin: 10px auto;
    padding: 0;  /* Remove padding from outer containers */
    box-sizing: border-box;
}

/* Inner container styling */
.search-container,
.phinder-query-content,
#search-progress-container .progress-header,
.tab-panel {
    width: 100%;
    padding: 15px;
    background-color: var(--dark-input-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-sizing: border-box;
}

/* Matches title container */
.results-title {
    width: 100%;
    max-width: var(--container-width);
    margin: 15px auto;
    padding: 0;
    box-sizing: border-box;
}

/* Tab navigation container */
.tab-navigation {
    width: 100%;
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0;
    box-sizing: border-box;
}

/* Adjust spacing between major sections */
.search-area {
    margin-bottom: 10px;  /* Reduced */
}

.phinder-query-container {
    margin-top: 10px;
    margin-bottom: 10px;  /* Reduced spacing before results */
}

.results-area {
    margin-top: 10px;  /* Reduced */
}

/* Ensure search container maintains compact layout */
.search-container {
    margin-bottom: 10px;  /* Reduced spacing after search box */
}

/* Adjust button container spacing */
.button-container {
    margin: 0;        /* Remove all margins */
    padding: 0;       /* Remove all padding */
    line-height: 1;   /* Reduce line height */
    height: auto;     /* Let content determine height */
}

/* Results title spacing */
.results-title {
    margin: 15px auto;  /* Reduced from 20px */
}

/* Base container widths and structure */
.search-area,
.phinder-query-container,
.search-progress-container {
    width: 100%;
    max-width: var(--container-width);
    margin: 10px auto;
    box-sizing: border-box;
    padding: 0;
    background: transparent;
    border: none;
}

/* Tab navigation specific styles */
.tab-navigation {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.tab-headers-wrapper {
    flex: 1;
    overflow-x: hidden;
    margin: 0 10px;
}

.tab-headers {
    display: flex;
    gap: 10px;
    transition: transform 0.3s ease;
}

.nav-button {
    flex-shrink: 0;
    padding: 5px 10px;
    background-color: var(--dark-input-bg);
    border: 1px solid var(--dark-border);
    color: var(--dark-text);
    cursor: pointer;
}

.nav-button.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Add these styles after the existing button styles */
#sendQuery {
    min-width: 200px; /* Ensure button maintains width during animation */
    transition: background-color 0.3s, opacity 0.3s;
}

#sendQuery.animating {
    background-color: #45a049; /* Slightly darker shade during animation */
    cursor: wait;
}

#sendQuery:disabled {
    opacity: 0.7;
    cursor: wait;
}


