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

body {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f7f7f7;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
}

/* Header */
header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    color: #202020;
    margin-bottom: 10px;
    font-size: 2.5rem;
}

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

/* Search Form */
.search-container {
    margin-bottom: 30px;
}

#search-form {
    display: flex;
    gap: 10px;
}

#query-input {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

#query-input:focus {
    border-color: #007bff;
    outline: none;
}

#search-button {
    background-color: #202020;
    color: white;
    border: none;
    border-radius: 5px;
    padding: 12px 25px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s;
}

#search-button:hover {
    background-color: #444;
}

/* Example queries */
.examples {
    margin-top: 15px;
}

.examples p {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.example-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.example-chip {
    background-color: #f1f1f1;
    border-radius: 20px;
    padding: 8px 15px;
    font-size: 0.9rem;
    color: #444;
    cursor: pointer;
    transition: background-color 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.example-chip:hover {
    background-color: #e0e0e0;
}

/* Loader */
.loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 20px 0;
}

.spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top: 4px solid #202020;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Reasoning Section */
.reasoning-section {
    margin-bottom: 30px;
    border: 1px solid #ddd;
    border-radius: 5px;
    overflow: hidden;
}

.reasoning-header {
    background-color: #f1f1f1;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.reasoning-header h3 {
    margin: 0;
    font-size: 1.2rem;
}

.toggle-icon {
    font-size: 1.2rem;
    transition: transform 0.3s;
}

.reasoning-content {
    padding: 20px;
    max-height: 500px;
    overflow-y: auto;
    background-color: #f9f9f9;
    border-top: 1px solid #ddd;
}

#reasoning-output {
    white-space: pre-wrap;
    font-family: "Consolas", "Courier New", monospace;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Answer Section */
.answer-section {
    margin-bottom: 30px;
    padding: 20px;
    background-color: #f0f8ff;
    border-radius: 5px;
    border-left: 5px solid #007bff;
}

.answer-section h2 {
    margin-bottom: 15px;
    color: #007bff;
}

.answer-content {
    line-height: 1.7;
}

/* Markdown styling */
.answer-content p {
    margin-bottom: 15px;
}

.answer-content h1,
.answer-content h2,
.answer-content h3 {
    margin-top: 20px;
    margin-bottom: 10px;
    color: #333;
}

.answer-content ul,
.answer-content ol {
    margin-left: 25px;
    margin-bottom: 15px;
}

.answer-content code {
    background-color: #f5f5f5;
    padding: 2px 5px;
    border-radius: 3px;
    font-family: "Consolas", "Courier New", monospace;
    font-size: 0.9em;
}

.answer-content pre {
    background-color: #f5f5f5;
    padding: 10px;
    border-radius: 5px;
    overflow-x: auto;
    margin-bottom: 15px;
}

.answer-content pre code {
    padding: 0;
    background-color: transparent;
}

.answer-content a {
    color: #007bff;
    text-decoration: none;
}

.answer-content a:hover {
    text-decoration: underline;
}

.answer-content strong {
    font-weight: bold;
}

.answer-content em {
    font-style: italic;
}

/* Images Section */
.images-section {
    margin-bottom: 30px;
}

.images-section h2 {
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

.image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.image-item {
    border: 1px solid #ddd;
    border-radius: 5px;
    overflow: hidden;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s;
}

.image-item:hover {
    transform: scale(1.03);
}

.image-item img {
    width: 100%;
    display: block;
}

.image-caption {
    padding: 10px;
    background-color: #f9f9f9;
    text-align: center;
    font-size: 0.9rem;
    color: #666;
}

/* Image loading states */
.image-item.loading img {
    opacity: 0.5;
}

.image-loader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.5);
}

.image-spinner {
    width: 30px;
    height: 30px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: #202020;
    animation: spin 1s linear infinite;
}

.image-item.loading .image-loader {
    display: flex;
}

.image-item:not(.loading) .image-loader {
    display: none;
}

.image-item.error {
    border-color: #ffcccc;
    background-color: #fff5f5;
}

.image-item .error-message {
    color: #d8000c;
    padding: 20px;
    text-align: center;
}

/* Image modal */
.image-modal {
    display: flex;
    position: fixed;
    z-index: 1000;
    padding-top: 30px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.8);
    justify-content: center;
    align-items: flex-start;
}

.modal-content {
    position: relative;
    background-color: transparent;
    margin: auto;
    padding: 0;
    max-width: 90%;
    max-height: 90vh;
}

.modal-content img {
    max-width: 100%;
    max-height: 85vh;
    display: block;
    margin: 0 auto;
    border: 3px solid white;
    border-radius: 5px;
}

.modal-close {
    position: absolute;
    top: -25px;
    right: 0;
    color: white;
    font-size: 35px;
    font-weight: bold;
    cursor: pointer;
}

.modal-close:hover {
    color: #ccc;
}

/* Collapsed state */
.collapsed .reasoning-content {
    display: none;
}

.collapsed .toggle-icon {
    transform: rotate(-90deg);
}
