@import url('https://fonts.googleapis.com/css2?family=VT323&display=swap');

:root {
    --background-color: #f0f0f0;
    --text-color: #333;
    --accent-color: #ff6b6b;
    --secondary-color: #4ecdc4;
    --chat-bar-bg: white;
    --code-bg-color: #282c34;
    --code-text-color: #abb2bf;
    --code-border-color: #3e4451;
    --user-message-bg: #f9e8e8;
    --bot-message-bg: #e8f6f5;
    --user-message-border: #ff6b6b;
    --bot-message-border: #4ecdc4;
}

body, html {
    height: 100%;
    margin: 0;
    font-family: 'VT323', monospace;
    background-color: var(--background-color);
    color: var(--text-color);
    font-size: 22px;
    line-height: 1.6;
}

#chat-area {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    bottom: 90px;
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    padding: 30px 20px;
    box-sizing: border-box;
    overflow-y: auto;
}

#chat-area::after {
    content: '';
    display: block;
    height: var(--padding-bottom);
    width: 100%;
}

#message-container {
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 1.5rem;
    box-sizing: border-box;
}

.message-wrapper {
    max-width: 85%;
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.message {
    max-width: 85%;
    text-align: left;
    transition: all 0.3s ease-in-out;
    opacity: 0;
    padding: 15px 20px;
    box-sizing: border-box;
    border-radius: 5px;
    line-height: 1.6;
    font-size: 24px;
    word-wrap: break-word;
    overflow-x: auto;
    border: 4px solid;
    position: relative;
    margin-bottom: 20px;
}

.message::before {
    pointer-events: none;
}

.user-message {
    background-color: var(--user-message-bg);
    color: var(--text-color);
    border-color: var(--user-message-border);
    align-self: flex-end;
}

.bot-message {
    background-color: var(--bot-message-bg);
    color: var(--text-color);
    border-color: var(--bot-message-border);
    align-self: flex-start;
}

#chat-bar {
    position: fixed;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%);
    width: 92%;
    max-width: 820px;
    display: flex;
    align-items: center;
    background-color: var(--chat-bar-bg);
    border-radius: 5px;
    border: 4px solid var(--text-color);
    transition: all 0.3s ease-in-out;
    z-index: 1000;
    padding: 10px;
    box-sizing: border-box;
}

#chat-bar::before {
    pointer-events: none;
}

#input-area {
    flex-grow: 1;
    border: none;
    outline: none;
    font-size: 25px;
    padding-left: 5px;
    background: transparent;
    color: var(--text-color);
    font-family: 'VT323', monospace;
    min-width: 0;
}

#input-area::placeholder {
    color: var(--text-color);
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

#input-area:focus::placeholder {
    opacity: 0;
}

#send-btn {
    background-color: var(--accent-color);
    color: white;
    border: 3px solid var(--text-color);
    width: 44px;
    height: 44px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease-in-out;
    font-size: 18px;
    border-radius: 5px;
    flex-shrink: 0;
}

#send-btn:hover {
    background-color: var(--secondary-color);
}

#send-btn svg {
    width: 22px;
    height: 22px;
    fill: white;
}

.typing-indicator {
    background-color: var(--bot-message-bg);
    align-self: flex-start;
    border-radius: 5px;
    padding: 12px 18px;
    display: inline-flex;
    align-items: center;
    margin-bottom: 15px;
    opacity: 0;
    transition: opacity 0.3s ease-out;
    border: 4px solid var(--bot-message-border);
    position: relative;
}

.typing-indicator::before {
    pointer-events: none;
}

.typing-indicator span {
    height: 8px;
    width: 8px;
    background-color: var(--bot-message-border);
    border-radius: 50%;
    display: inline-block;
    margin-right: 5px;
    animation: typing 1s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
    margin-right: 0;
}

@keyframes typing {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

body::after {
    content: 'pansophic-1™ by newport/ab';
    position: fixed;
    bottom: 5px;
    right: 10px;
    font-size: 8px;
    color: var(--text-color);
    opacity: 0.7;
    font-weight: 300;
}

.message p {
    margin-bottom: 0px;
    margin-top: 0px;
}

.message h1, .message h2, .message h3, .message h4, .message h5, .message h6 {
    margin-top: 0px;
    margin-bottom: 0px;
    font-weight: bold;
}

.message h1 { font-size: 1.5em; }
.message h2 { font-size: 1.3em; }
.message h3 { font-size: 1.1em; }

.message ul, .message ol {
    margin-bottom: 1em;
    padding-left: 2em;
}

.message li {
    margin-bottom: 0.5em;
}

.message code {
    font-family: 'Courier New', Courier, monospace;
    background-color: var(--code-bg-color);
    color: var(--code-text-color);
    border: 1px solid var(--code-border-color);
    border-radius: 3px;
    padding: 2px 4px;
    font-size: 0.65em;
}

.message pre {
    background-color: var(--code-bg-color);
    border: 1px solid var(--code-border-color);
    border-radius: 5px;
    padding: 1em;
    overflow-x: auto;
    margin-bottom: 1em;
}

.message pre code {
    background-color: transparent;
    border: none;
    padding: 0;
    font-size: 0.65em;
    line-height: 1.5;
    color: var(--code-text-color);
}

.message blockquote {
    border-left: 4px solid var(--accent-color);
    padding-left: 1em;
    margin-left: 0;
    margin-bottom: 1em;
    font-style: italic;
    color: #666;
}

.message table {
    border-collapse: collapse;
    margin-bottom: 1em;
    width: 100%;
}

.message th, .message td {
    border: 1px solid var(--code-border-color);
    padding: 0.5em;
    text-align: left;
}

.message th {
    background-color: var(--code-bg-color);
    font-weight: bold;
}

.message a {
    color: var(--accent-color);
    text-decoration: underline;
}

.message a:hover {
    text-decoration: none;
}

/* Prism.js theme customization */
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
    color: #5c6370;
    font-style: italic;
}

.token.punctuation {
    color: #abb2bf;
}

.token.selector,
.token.tag {
    color: #e06c75;
}

.token.property,
.token.boolean,
.token.number,
.token.constant,
.token.symbol,
.token.attr-name,
.token.deleted {
    color: #d19a66;
}

.token.string,
.token.char,
.token.attr-value,
.token.builtin,
.token.inserted {
    color: #98c379;
}

.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string {
    color: #56b6c2;
}

.token.atrule,
.token.keyword {
    color: #c678dd;
}

.token.function {
    color: #61afef;
}

.token.regex,
.token.important,
.token.variable {
    color: #c678dd;
}

.token.important,
.token.bold {
    font-weight: bold;
}

.token.italic {
    font-style: italic;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    body, html {
        font-size: 18px;
    }

    #chat-area {
        bottom: 80px;
        padding: 20px 10px;
    }

    .message {
        max-width: 90%;
        font-size: 20px;
        padding: 12px 15px;
        border-width: 3px;
    }

    #chat-bar {
        bottom: 15px;
        width: 95%;
        padding: 8px;
    }

    #input-area {
        font-size: 18px;
        padding-left: 3px;
    }

    #send-btn {
        width: 38px;
        height: 38px;
        border-width: 2px;
    }

    #send-btn svg {
        width: 18px;
        height: 18px;
    }

    .typing-indicator {
        padding: 10px 14px;
        border-width: 3px;
    }

    .typing-indicator span {
        height: 6px;
        width: 6px;
    }

    body::after {
        font-size: 6px;
    }

    .message pre {
        padding: 0.8em;
    }

    .message code {
        font-size: 0.7em;
    }
}

@media (max-width: 480px) {
    #chat-bar {
        bottom: 10px;
        width: 98%;
        padding: 6px;
    }

    #input-area {
        font-size: 16px;
        width: calc(100% - 40px);
    }

    #send-btn {
        width: 34px;
        height: 34px;
    }

    .message {
        max-width: 95%;
        font-size: 18px;
        padding: 6px 8px;
    }

    .message pre {
        padding: 0.6em;
    }

    .message code {
        font-size: 0.65em;
    }
}

#responsibility-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: var(--chat-bar-bg);
    color: var(--text-color);
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    max-width: 80%;
    z-index: 1000;
    font-size: 32px;
    font-family: 'VT323', monospace;
    transition: opacity 0.3s ease-in-out;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border: 4px solid var(--accent-color);
}

/* Mobile optimization for the responsibility message */
@media (max-width: 768px) {
    #responsibility-message {
        font-size: 28px;
        padding: 25px;
    }
}

@media (max-width: 480px) {
    #responsibility-message {
        font-size: 24px;
        padding: 20px;
    }
}
