:root {
    --primary-color: #6C63FF;
    --secondary-color: #4CAF50;
    --text-color: #333;
    --card-background: #ffffffc2;
    --background-color: #F0F2F5;
    --border-radius: 12px;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Poppins', sans-serif;
    color: var(--text-color);
    height: auto;
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
    background-size: 400% 400%;
    animation: gradient 15s ease infinite;
}

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

h1, h2, h3 {
    color: var(--primary-color);
}

h1 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 2rem;
}

h1 a, h2 a, h3 a {
    text-decoration: none;
    color: inherit;
}

#searchFormGroup {
    margin-bottom: 0px;
}

.card, #chat-container {
    background-color: var(--card-background);
    border-radius: var(--border-radius);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--box-shadow);
}


#searchResultsContainer {
    background-color: var(--card-background);
    border-top-right-radius: var(--border-radius);
    border-top-left-radius: var(--border-radius);
    border-bottom-right-radius: 0px;
    border-bottom-left-radius: 0px;
    padding: 0.5rem 2rem;
    margin-bottom: 0rem;
    box-shadow: var(--box-shadow);
}

#searchFormExpanded {
    max-height: 1px;
    overflow-y: hidden;
    transition: max-height 0.3s ease-out;
}

#searchFormExpanded.expanded {
    max-height: 400px;
    overflow-y: auto;
}

#showMoreHistory{
    margin-bottom: 1rem;
}

#results {
    max-height: 600px;
    overflow-y: auto;
}

#results.collapsed {
    max-height: 60px;
    overflow-y:hidden;
}

#chatToSearchInput, #searchTerm, #chatMessage {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--primary-color);
    border-radius: calc(var(--border-radius) / 2);
    resize: vertical;
    font-size: 1rem;
    margin-bottom: 0rem;
    background-color: var(--background-color);
    color: var(--text-color);
}

#chatToSearchInput {
    height: 150px;
}

.options, .row {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.option-group, .col {
    flex: 1;
    min-width: 200px;
}

.option-group label, .col label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
    font-size: 1.1rem;
    color: var(--primary-color);
}

select, input[type="number"], input[type="text"] {
    width: 100%;
    padding: 0.8rem;
    border: 2px solid var(--primary-color);
    border-radius: calc(var(--border-radius) / 2);
    background-color: var(--background-color);
    color: var(--text-color);
    font-size: 1rem;
}

.year-range {
    display: flex;
    align-items: center;
}

.year-separator {
    margin: 0 0.5rem;
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--primary-color);
}

button {
    display: inline-block;
    width: 100%;
    padding: 1rem;
    background-color: var(--primary-color);
    color: var(--card-background);
    border: none;
    border-radius: calc(var(--border-radius) / 2);
    font-size: 1.1rem;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.1s;
    text-align: center;
}

button:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
}

#historyList {
    list-style-type: none;
    padding: 0;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--primary-color);
}

.history-item:last-child {
    border-bottom: none;
}

.delete-history {
    background-color: #e74c3c;
    color: var(--card-background);
    border: none;
    padding: 0.1rem 0.1rem;
    cursor: pointer;
    border-radius: calc(var(--border-radius) / 2);
    font-size: 0.9rem;
    width: 50px;
}


#chat-messages {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 2rem;
}

.user-message, .assistant-message {
    margin-bottom: 1rem;
    padding: 1rem;
    border-radius: var(--border-radius);
    max-width: 80%;
}

.user-message {
    background-color: var(--primary-color);
    color: var(--card-background);
    margin-left: auto;
}

.assistant-message {
    background-color: var(--secondary-color);
    color: var(--card-background);
    margin-right: auto;
}

@media (max-width: 768px) {
    .options, .row {
        flex-direction: column;
    }

    .option-group, .col {
        margin-bottom: 1.5rem;
    }

    h1 {
        font-size: 2rem;
    }
}

@keyframes gradient {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}