* {
    box-sizing: border-box;
    margin:0;
    padding:0;
    font-family:'Segoe UI',Tahoma,Geneva,Verdana,sans-serif;
}

body {
    background:#1e1e2e;
    color:#cdd6f4;
    min-height:100vh;
    overflow:hidden;
}

.layout {
    display:flex;
    height:100vh;
}

/* ==========================
   LEFT SIDEBAR
   ========================== */

.sidebar {
    width:280px;
    background:#11111b;
    border-right:1px solid #313244;
    display:flex;
    flex-direction:column;
}

.sidebar-header {
    padding:15px;
    font-size:18px;
    font-weight:bold;
    border-bottom:1px solid #313244;
}

#history-list {
    flex:1;
    overflow-y:auto;
}

.history-item {
    padding:12px;
    cursor:pointer;
    border-bottom:1px solid #313244;
    transition:background .2s;
}

.history-item:hover {
    background:#313244;
}

.history-item.active {
    background:#45475a;
}

.history-title {
    font-size:14px;
    font-weight:bold;
    color:#cdd6f4;
    margin-bottom:4px;
}

.history-date {
    font-size:11px;
    color:#888;
}

.chat-container {
    flex:1;
    display:flex;
    flex-direction:column;
    overflow:hidden;
}

.chat-header {
    padding:15px 20px;
    background:#11111b;
    display:flex;
    justify-content:space-between;
    align-items:center;
    border-bottom:1px solid #313244;
}

.controls {
    display:flex;
    gap:10px;
    align-items:center;
}

select,
button {
    background:#313244;
    color:#cdd6f4;
    border:1px solid #45475a;
    padding:8px 12px;
    border-radius:6px;
    cursor:pointer;
}

button.new-chat-btn {
    background:#f38ba8;
    color:#11111b;
    font-weight:bold;
    border:none;
}

button.send-btn {
    background:#89b4fa;
    color:#11111b;
    font-weight:bold;
    border:none;
}

.chat-messages {
    flex:1;
    overflow-y:auto;
    padding:20px;
    display:flex;
    flex-direction:column;
    gap:15px;
}

.message {
    max-width:90%;
    padding:12px 16px;
    border-radius:8px;
    word-break:break-word;
    line-height:1.5;
    white-space: pre-wrap;
}

.message.user {
    align-self:flex-end;
    background:#89b4fa;
    color:#11111b;
}

.message.system {
    align-self:center;
    color:#999;
    background:transparent;
    font-style:italic;
}

.message pre {
    background:#11111b;
    padding:10px;
    overflow:auto;
    border-radius:5px;
}

.message code {
    background:#11111b;
    padding:2px 5px;
    border-radius:3px;
}

.message ul,
.message ol {
    margin-left:20px;
}

.chat-input-area {
    display:flex;
    gap:10px;
    padding:15px;
    background:#11111b;
    border-top:1px solid #313244;
}

textarea {
    flex:1;
    resize:none;
    height:60px;
    background:#313244;
    color:white;
    border:1px solid #45475a;
    border-radius:6px;
    padding:12px;
}

textarea:focus {
    outline:none;
    border-color:#89b4fa;
}

@property --border-angle {
    syntax:'<angle>';
    inherits:false;
    initial-value:0deg;
}

@keyframes rotate-border {
    to {
        --border-angle:360deg;
    }
}

.message.assistant { 
    align-self: flex-start; 
    background-color: #313244; 
    color: #cdd6f4; 
    border-bottom-left-radius: 2px;
    border: 3px solid transparent; /* Platzhalter für den Rahmen */
}

.message.assistant.thinking-state {
  background-image: linear-gradient(#313244, #313244), 
                conic-gradient(from var(--border-angle), #00ffff, #000000, #ff00ff, #000000, #ffffff, #000000, #00ffff);
  background-origin: border-box;
  background-clip: padding-box, border-box;
  animation: rotate-border 1s linear infinite; /* Von 3s auf 1s verkürzt für mehr Speed */
}

.thinking-text span {
  animation:blink 1.4s infinite both;
}

.thinking-text span:nth-child(2){
  animation-delay:.2s;
}

.thinking-text span:nth-child(3){
  animation-delay:.4s;
}

@keyframes blink{
  0%{opacity:.2;}
  20%{opacity:1;}
  100%{opacity:.2;}
}

@media screen and (max-width: 900px) {
    body {
        overflow:auto;
    }

    .layout {
        flex-direction:column;
        height:auto;
        min-height:100vh;
    }

    .sidebar {
        width:100%;
        max-height:320px;
        border-right:none;
        border-bottom:1px solid #313244;
    }

    .chat-container {
        height:auto;
    }

    .chat-header {
        flex-wrap:wrap;
        gap:10px;
    }

    .controls {
        width:100%;
        justify-content:space-between;
        flex-wrap:wrap;
    }

    .chat-messages {
        padding:16px;
        min-height:280px;
    }

    .chat-input-area {
        flex-direction:column;
        gap:10px;
    }

    textarea {
        height:100px;
    }

    button.send-btn,
    button.new-chat-btn,
    select {
        width:100%;
    }
}

/* Monospace font for inline code and pre blocks */
code,
pre,
kbd,
samp,
tt,
.message code,
.message pre {
    font-family: Consolas, "Andale Mono", "Lucida Console", Monaco, "Courier New", monospace;
}


