:root {
    --primary-color: #4a90e2;
    --secondary-color: #2c3e50;
    --background-color: #f5f6fa;
    --text-color: #2c3e50;
    --border-radius: 8px;
    --box-shadow: 0 2px 4px rgb(0 0 0 / 10%);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    background-color: var(--background-color);
    color: var(--text-color);
    padding: 2rem;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

h1 {
    color: var(--primary-color);
    text-align: center;
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.form-group input, textarea {
    width: 100%;
    padding: 0.8rem;
    border: 2px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

div.session-id-init-container {
    display: flex;
    flex-direction: row;
}

div.session-id-init-container > div.container-item {
    flex: 1;
}

@media (width <= 400px) {
    div.session-id-init-container {
        flex-direction: column;
    }
    
    div.session-id-init-container > div.container-item {
        margin-bottom: 1rem;
    }
}

.form-group input#input_session_id {
    max-width: 200px;
    min-width: 50px;
}

.form-group input#input_token {
    max-width: 200px;
    min-width: 50px;
}

.form-group div.container-item button {
    margin: 0;
    max-width: 200px;
    min-width: 50px;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
}

button {
    background-color: var(--primary-color);
    color: white;
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
    width: 100%;
}

button#submitBtn {
    width: 80%;
    margin: auto;
    min-width: 200px;
}

button:hover {
    background-color: #357abd;
}

button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

form#mottoForm {
    margin-bottom: 2rem;
}

.result {
    margin-top: 0;
    padding: 0;

    /* background-color: #f8f9fa;
    border-radius: var(--border-radius); */
    display: none;
}

.result.visible {
    display: block;
}

.poem, .history-answer {
    font-style: italic;
    padding: 1rem;
    overflow: auto hidden;
}

.poem ul, .history-answer ul {
    margin-top: 0.5rem;
    margin-left: 1rem;
}

.poem li, .history-answer li {
    margin-top: 1rem;
    margin-bottom: 1rem;
}

.poem div.references-list-container {
    background-color: var(--primary-color);
    color: #eee;
    border-radius: 20px;
    padding: 1rem;
    overflow: auto hidden;
}

.poem div.references-list-container li {
    margin-top: 0.1rem;
    margin-bottom: 0.1rem;
}

.poem p, .history-answer p {
    margin-top: 1rem;
    margin-bottom: 1rem;
}

.poem {
    margin-bottom: 1rem;
    background-color: #98cbff;

    /* border-left: 4px solid var(--primary-color); */
    border-radius: 20px;
    display: none;
}

.poem {
    transition: max-height 0.3s ease-out;
    overflow: auto hidden;
    max-height: 0;
}

.poem.visible {
    display: block;
}

.submit-loading {
    height: 40px;
}

.loading {
    height: 40px;
    padding: 0.5rem;
    color: var(--primary-color);
    font-weight: bold;
    display: none;
    text-align: center;
    margin: 1rem 0;
    transition: display 0.3s ease-out;
}

.loading::after {
    content: "";
    animation: loading_dots 1.4s infinite;
    position: absolute;
    margin-left: 4px;
}

@keyframes loading_dots {
    0%, 20% { content: ""; }
    40% { content: "."; }
    60% { content: ".."; }
    80% { content: "..."; }
}

.loading.visible {
    display: block;
}

.error {
    color: #dc3545;
    padding: 1rem;
    background-color: #f8d7da;
    border-radius: var(--border-radius);
    margin-top: 1rem;
    display: none;
}

.error.visible {
    display: block;
}

.history-query {
    font-weight: bold;
}

.history-answer {
    margin-left: 1rem;
    background-color: #c0c0c0;
    margin-bottom: 0.5rem;
    border-radius: var(--border-radius);
}