:root {
    --primary-color: #2196F3;
    --secondary-color: #1976D2;
    --background-color: #f5f5f5;
    --panel-background: #ffffff;
    --text-color: #333333;
    --border-color: #e0e0e0;
    --shadow-color: rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    color: var(--primary-color);
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

header p {
    color: #666;
    font-size: 1.1rem;
}

.small-font {
    font-size: 12px;
}

.main-content {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 2rem;
    background-color: var(--panel-background);
    border-radius: 10px;
    box-shadow: 0 2px 10px var(--shadow-color);
    padding: 2rem;
}

.controls-panel {
    border-right: 1px solid var(--border-color);
    padding-right: 2rem;
}

.file-upload, .clustering-params {
    margin-bottom: 2rem;
}

h2 {
    color: var(--primary-color);
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.file-input-wrapper {
    position: relative;
    margin-bottom: 1rem;
}

.file-input-wrapper input[type="file"] {
    display: none;
}

.file-label {
    display: block;
    padding: 0.8rem 1.5rem;
    background-color: var(--primary-color);
    color: white;
    border-radius: 5px;
    cursor: pointer;
    text-align: center;
    transition: background-color 0.3s;
}

.file-label:hover {
    background-color: var(--secondary-color);
}

.sheet-name-input {
    margin-bottom: 1rem;
}

.sheet-name-input input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.upload-btn, .update-btn {
    width: 100%;
    padding: 0.8rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s;
}

.upload-btn:hover, .update-btn:hover {
    background-color: var(--secondary-color);
}

.update-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.method-selector {
    margin-bottom: 1.5rem;
}

.method-selector select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
}

.parameter-sliders {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.slider-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.slider-group label {
    font-size: 0.9rem;
    color: #666;
}

.slider-group input[type="range"] {
    width: 100%;
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
}

.slider-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.3s;
}

.slider-group input[type="range"]::-webkit-slider-thumb:hover {
    background: var(--secondary-color);
}

.slider-value {
    font-size: 0.9rem;
    color: #666;
}

.visualization-panel {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.plot-container {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 5px var(--shadow-color);
    padding: 1rem;
    min-height: 400px;
}

.plot {
    width: 100%;
    height: 100%;
    min-height: 400px;
}

@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .controls-panel {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding-right: 0;
        padding-bottom: 2rem;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .main-content {
        padding: 1rem;
    }

    header h1 {
        font-size: 2rem;
    }

    .plot-container {
        min-height: 300px;
    }

    .plot {
        min-height: 300px;
    }
}

/* Notification styles */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 4px;
    color: white;
    font-weight: 500;
    z-index: 1000;
    animation: slideIn 0.3s ease-out;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.notification.success {
    background-color: #4CAF50;
}

.notification.error {
    background-color: #f44336;
}

.notification.warning {
    background-color: #ff9800;
}

.notification.info {
    background-color: #2196F3;
}

.github-link {
    position: absolute;
    top: 20px;
    right: 20px;
}
.github-link img {
    width: 32px;
    height: 32px;
    transition: transform 0.3s ease;
    mix-blend-mode: multiply; /* Makes white background transparent on light backgrounds */
}
.github-link img:hover {
    transform: scale(1.1);
}

/* Search Sidebar Styles */
.search-sidebar {
    position: fixed;
    right: 0;
    top: 0;
    height: 100vh;
    width: 400px; /* Slightly wider */
    background: var(--panel-background);
    box-shadow: -2px 0 10px var(--shadow-color);
    padding: 2rem;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.search-sidebar.active {
    transform: translateX(0);
}

.search-toggle {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 50px;
    height: 50px;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 10px var(--shadow-color);
    z-index: 1001;
    transition: background-color 0.3s ease;
}

.search-toggle:hover {
    background: var(--secondary-color);
}

.search-toggle i {
    color: white;
    font-size: 24px;
}

.search-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.search-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.search-tab {
    padding: 0.5rem 1rem;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 1rem;
    color: #666;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
}

.search-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.search-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    padding-bottom: 3rem;
}

.search-input-container {
    display: flex;
    flex-direction: column;
    position: relative;
    margin-bottom: 0; /* Remove bottom margin since it's now part of a container */
}

.search-input {
    width: 100%;
    padding: 0.8rem 1rem;
    padding-right: 50px; /* Space for the button */
    border: none; /* Remove border */
    font-size: 1rem;
    transition: all 0.3s ease;
}

.search-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.2);
    outline: none;
}

.search-button {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.search-button:hover {
    background-color: var(--secondary-color);
}

/* Stop button styles */
.stop-button {
    border: none;
    background: transparent;
    color: #666;
    cursor: pointer;
    padding: 0.5rem 1rem;
    font-size: 0.5rem; /* Match dropdown text size */
    display: none; /* Hidden by default */
    width: 100%;
    text-align: left;
    transition: background-color 0.2s;
}

.stop-button:hover {
    background-color: #f5f9ff;
}

.stop-button i {
    margin-right: 0.5rem;
}

/* Container for stop button */
.stop-button-container {
    border-top: 1px solid #eee;
}

.model-dropdown-container {
    position: relative;
    margin-top: 0;
    margin-bottom: 0;
    display: none; /* Hidden by default, shown for AI tab */
}

.model-dropdown-button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.5rem 1rem;
    background: transparent;
    border: none; /* Remove border */
    cursor: pointer;
    font-size: 0.5rem; /* Half the size of search input */
    color: #555;
    transition: all 0.2s;
}

.model-dropdown-button:hover {
    background: #e5edf5;
}

.model-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 10;
    display: none;
    overflow: hidden;
    font-size: 0.5rem; /* Match dropdown button font size */
}

.model-dropdown-menu.show {
    display: block;
}

.model-option {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.model-option:hover {
    background-color: #f5f9ff;
}

.model-option.selected {
    background-color: #e5edf5;
    font-weight: 500;
}

.search-results {
    flex: 1;
    overflow-y: auto;
    padding-right: 0.5rem;
    margin-bottom: 1rem;
}

.search-result-item {
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
    background-color: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.search-result-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.search-result-item.error {
    border-color: #f44336;
    background-color: #ffebee;
}

.search-result-title {
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.search-result-title a {
    text-decoration: none;
    color: var(--primary-color);
}

.search-result-title a:hover {
    text-decoration: underline;
}

.search-result-content {
    font-size: 0.9rem;
    color: #666;
    line-height: 1.5;
}

/* AI Result Styles */
.ai-result {
    padding: 0;
    overflow: hidden;
}

.model-info {
    padding: 0.5rem 1rem;
    background-color: #f0f4f8;
    color: #555;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 1px solid #e0e9f5;
}

.model-info i {
    color: #5c6bc0;
}

.thinking-section, .answer-section {
    padding: 1rem;
}

.thinking-section {
    background-color: #f5f9ff;
    border-bottom: 1px solid #e0e9f5;
}

.thinking-header, .answer-header {
    font-weight: 500;
    margin-bottom: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.thinking-header i {
    color: #5c6bc0;
}

.answer-header i {
    color: var(--primary-color);
}

.thinking-content, .answer-content {
    line-height: 1.6;
    color: #444;
    font-size: 1rem; /* Explicit normal font size for contrast */
}

.thinking-content {
    font-style: italic;
    color: #666;
    font-size: 0.9rem; /* Smaller font size */
    line-height: 1.5; /* Adjusted line height for better readability */
}

/* Code Formatting */
.ai-result pre {
    background-color: #f8f8f8;
    padding: 1rem;
    border-radius: 4px;
    margin: 0.8rem 0;
    overflow-x: auto;
}

.ai-result code {
    font-family: monospace;
    font-size: 0.9rem;
}

.ai-result code:not(pre code) {
    background-color: #f0f0f0;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
}

/* LaTeX Equation Styling */
.latex-equation {
    margin: 1rem 0;
    overflow-x: auto;
    text-align: center;
}

.latex-inline {
    display: inline-block;
    vertical-align: middle;
}

.close-sidebar {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-sidebar:hover {
    color: var(--primary-color);
}

/* Loading indicator */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

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

/* Adjust main content for sidebar */
.container {
    transition: margin-right 0.3s ease;
}

.container.sidebar-active {
    margin-right: 400px; /* Match sidebar width */
}

/* Mobile Responsive Adjustments */
@media (max-width: 768px) {
    .search-sidebar {
        width: 100%;
    }
    
    .container.sidebar-active {
        margin-right: 0;
    }
}

/* New container for search input and model dropdown */
.ai-search-container {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.ai-search-container .search-input:focus {
    outline: none;
}

/* Search footnotes */
.search-footnote {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    text-align: center;
    font-size: 0.7rem;
    color: #666;
    padding: 0.5rem 2rem;
    border-top: 1px solid var(--border-color);
    background-color: var(--panel-background);
    z-index: 1;
    display: none; /* Hidden by default */
}

.search-footnote.active {
    display: block; /* Show when active */
}

/* Remove the old ai-search-footnote class as it's replaced by search-footnote */
.ai-search-footnote {
    display: none;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Wavy Loading Animation */
.wavy-loader {
    display: inline-block;
    height: 24px;
    margin-left: 8px;
    vertical-align: middle;
    position: relative;
    line-height: 1;
}

.wavy-loader::before {
    content: "...";
    display: inline-block;
    font-size: 20px;
    letter-spacing: 2px;
    font-weight: bold;
    color: #666;
    animation: wave 1.5s infinite;
    text-align: left;
}

@keyframes wave {
    0%, 100% {
        transform: translateY(0);
    }
    25% {
        transform: translateY(-6px);
    }
    50% {
        transform: translateY(0);
    }
    75% {
        transform: translateY(6px);
    }
}

/* Streaming content styles */
.thinking-content, .answer-content {
    transition: all 0.2s ease;
    word-wrap: break-word;
    overflow-wrap: break-word;
    overflow-y: auto;
    max-height: 400px;
}

/* Improved LaTeX rendering during streaming */
.latex-equation, .latex-inline {
    display: inline-block;
    min-height: 1em;
}

.latex-equation {
    width: 100%;
    margin: 0.5em 0;
    text-align: center;
} 
