@font-face {
    font-family: 'Roboto';
    src: url('../fonts/roboto/Roboto-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: 'Roboto';
    src: url('../fonts/roboto/Roboto-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
}

@font-face {
    font-family: 'Roboto';
    src: url('../fonts/roboto/Roboto-Italic.ttf') format('truetype');
    font-weight: 400;
    font-style: italic;
}
:root {
    --bg-color: #f0f0f0;
    --bg-hover: #e9e9e9;
    --text-color: #333;
    --text-light: #999;
    --prompt-bg: white;
    --prompt-placeholder: #bdbdbd;
    --prompt-submit: #e0e0e0;
    --button-bg: #007bff;
    --button-color: white;
    --button-hover: #0056b3;
    --user-message-bg: #e1e1e1;
    --system-message-color: #888;
    --sidebar-bg: #fff;
    --sidebar-text: #333;
    --sidebar-button: #f2f2f2;
    --logo-image: url('/static/images/epsog-logo.png');
}

body.dark-theme {
    --bg-color: #222;
    --bg-hover: #333;
    --text-color: #f0f0f0;
    --text-light: #666;
    --prompt-bg: #333;
    --prompt-placeholder: #616161;
    --prompt-submit: #424242;
    --button-bg: #0056b3;
    --button-color: #f0f0f0;
    --button-hover: #003d82;
    --user-message-bg: #343434;
    --system-message-color: #888;
    --sidebar-bg: #1c1c1c;
    --sidebar-text: #ffffff;
    --sidebar-button: #282828;
    --logo-image: url('/static/images/epsog-logo.png');
}
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}
ul, li{
    padding:0;
    margin:0;
}
body {
    display: flex;
    font-family: "Roboto", Arial, sans-serif;
    font-size:16px;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s, color 0.3s;
}
#sidebar {
    width: 250px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out;
    z-index: 2000;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    height:140px;
    display: flex;
    padding: 15px 20px;
}
.sidebar-content .logo img {
    content: var(--logo-image);
    margin:10px 0px 20px 0px;
    pointer-events: none;
}
.sidebar-content {
    flex-grow: 1;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    margin-top: 35px;
    overflow-y: auto;
}
.sidebar-content h3 {
    padding:0px;
    margin:0px;
    margin-bottom:10px;
    font-size:0.8em;
    color:var(--text-light);
    font-weight: normal;
}
.sidebar-content ul {
    margin-bottom:20px;
}
.sidebar-footer {
    padding: 10px 20px 45px 20px;
    display: flex;
}
.close-sidebar {
    color: var(--prompt-placeholder);
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    position:absolute;
    top:26px;
    right:20px;
    z-index:1002;
}
#recent-chats {
    list-style-type: none;
    padding: 0;
}

#recent-chats li {
    font-size:0.85em;
    padding: 7px 10px;
    cursor: pointer;
    border-radius:2px;
}

#recent-chats li:hover {
    background-color: var(--sidebar-button);
}
#recent-chats li a {
    color:var(--text-color);
}
#theme-switch {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: var(--sidebar-button);
    color: var(--text-color);
    border: none;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size:1.2em
}


#mainbar {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100%;
    transition: margin-left 0.3s ease-in-out;
}

.header {
    height: 80px;
    display: flex;
    align-items: center;
    padding: 0 20px 0 80px;
    width: 100%;
    box-sizing: border-box;
    transition: padding 0.3s;
}
.header h1 {
    padding:0;
    margin:0;
    font-size:1.4em;
    font-weight: normal;
}
.header .anotation{
    font-size:0.6em;
}
.content-wrapper {
    flex: 1;
    display: flex;
    justify-content: center;
    width: 100%;
    overflow-y: auto;
    position: relative;
}
.prepared-wrapper {
    margin-top: 20px;
    margin-bottom: 40px;
    width: 100%;
}
.prepared-title{
    text-align:center;
    font-weight: bold;
    font-size:1em;
    margin-bottom:40px;
}
.prepared-title strong{
    display:block;
    font-weight: normal;
    font-size:1.4em;
    margin-bottom:7px;
}
.prepared-title em{
    display:block;
    font-weight: normal;
    font-size:0.85em;
    font-style: normal;
    color: var(--system-message-color);
}
.prepared-prompts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    margin-top: 20px;
    width: 100%;
}

.prompt-block {
    border: 1px solid var(--prompt-submit);
    color: var(--system-message-color);
    border-radius: 5px;
    padding: 10px;
    cursor: pointer;
    transition: background-color 0.3s;
    font-size:0.85em;
    line-height:1.4em;
}
.prompt-block svg {
    display: block;
    margin-bottom: 10px;
}
.prompt-block:hover {
    background-color: var(--bg-hover);
}
.user-message {
    text-align: right;
    margin: 10px 0px 10px 70px;
}
.user-message .message-content{
    font-size:0.95em;
    line-height:1.5em;
    display:inline-block;
    padding: 10px 20px;
    border-radius: 5px;
    background-color: var(--user-message-bg);
    max-width: 440px;
    text-align:left;
}

.assistant-message {
    text-align: left;
    margin: 10px 0px;
    position:relative;
    padding-bottom:30px;
}
.assistant-message .message-content{
    font-size:0.95em;
    line-height:1.5em;
    display:inline-block;
    padding: 10px 0px 10px 35px;
    white-space: pre-line;
}
.assistant-message svg {
    position: absolute;
    top: 12px;
    left: 0px;
    font-size: 16px;
    color: var(--system-message-color);
}
.system-message {
    text-align: center;
    color: var(--system-message-color);
    font-size: 0.8em;
    padding-bottom:10px;
    display: flex;
    justify-content: center;
    align-items: center;
}
.system-message .message-content {
    display: flex;
    align-items: center;
}
.system-message .message-content svg {
    width: 14px;
    height: 14px;
    margin-right: 8px;
    flex-shrink: 0;
    color:var(--prompt-submit);
}
#scroll-to-bottom {
    position: absolute;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--bg-color);
    color: var(--text-color);
    border: 1px solid var(--prompt-submit);
    border-radius: 50%;
    width: 35px;
    height: 35px;
    font-size: 1em;
    cursor: pointer;
    z-index: 1003;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select:none;
    user-select: none;
}
#scroll-to-bottom svg {
    margin-top: 3px;
}
#content {
    max-width: 640px;
    width: 100%;
    padding: 0px 20px;
    box-sizing: border-box;
}

.footer {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}
.footer-content {
    max-width: 680px;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 10px 15px 25px 15px;
    box-sizing: border-box;
    position:relative;
}

#prompt-form {
    background-color: var(--prompt-bg);
    margin-top: auto;
    border-radius: 10px;
    display: flex;
    align-items: center;
    padding: 10px 15px;
    width: 100%;
    max-width: 650px;
    box-sizing: border-box;
}
#prompt-input {
    background-color: transparent;
    color: var(--text-color);
    border: none;
    flex-grow: 1;
    font-size: 16px;
    outline: none;
}
#prompt-input::placeholder {
    color: var(--prompt-placeholder);
}
.submit-button {
    background-color: var(--prompt-submit);
    color: var(--prompt-bg);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1em;
    height: 30px;
    width: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s, color 0.3s;
}
.submit-button.active {
    background-color: var(--text-color);
}
.disclaimer {
    color: #9f9f9f;
    font-size: 0.8em;
    text-align: center;
    margin-top: 7px;
}

#sidebar-toggle {
    display: none;
}

.sidebar-toggle-label {
    position: fixed;
    top: 16px;
    left: 15px;
    z-index: 1000;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: var(--prompt-bg);
    color: var(--text-color);
    border: none;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size:1.2em
}

#sidebar-toggle:checked ~ #sidebar {
    transform: translateX(0);
}

/* Desktop styles */
@media screen and (min-width: 768px) {
    #sidebar-toggle:checked ~ #mainbar .header {
        padding: 0 20px;
        transition: padding 0.3s;
    }
    #sidebar-toggle:checked ~ #mainbar {
        margin-left: 250px;
    }
    
}

/* Mobile styles */
@media screen and (max-width: 767px) {
    .header{padding: 0 20px;}
    .header .header-wrapper {
        margin: 0 auto;
    }
    #sidebar {
        width: 100%;
        max-width: 300px;
    }

}
@media screen and (max-width: 620px) {
    .prepared-prompts {
        max-width: 400px;
        margin: 0 auto;
    }
}
@media screen and (max-width: 419px) {
    .prepared-prompts {
        max-width: 100%;
    }
}

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

#thinking-indicator.hidden {
    display: none;
}
@keyframes thinking {
    0% { content: '.'; }
    25% { content: '.'; }
    50% { content: '..'; }
    75% { content: '...'; }
    100% { content: '....'; }
}

.thinking-dots::after {
    content: '...';
    display: inline-block;
    animation: thinking 1.5s infinite;
    width: 1em;
    text-align: left;
}

.message-content {
  white-space: normal !important;
  line-height: 1.5;
}

.message-content p,
.message-content ul,
.message-content ol,
.message-content pre {
  margin: 0.4em 0 0.4em 0 !important;
}

.message-content li {
  margin: 0.2em 0 !important;
  padding: 0;
}
.message-content ul,
.message-content ol {
  padding-left: 1.2em !important;
}

.message-content > :first-child {
  margin-top: 0 !important;
}
.message-content > :last-child {
  margin-bottom: 0 !important;
}

.message-content code {
  background: #f6f6f6;
  padding: 1px 4px;
  border-radius: 4px;
  font-size: 0.98em;
}

.message-content pre {
  background: #f6f6f6;
  padding: 0.7em;
  border-radius: 5px;
  overflow-x: auto;
}

.assistant-message .message-content{
    font-size:0.95em;
    display:inline-block;
    padding: 10px 0px 10px 35px;
    white-space: normal;
}