/* Global Styles */
body {
    font-family: 'Segoe UI', Roboto, Arial, sans-serif;
    background: #181818; /* VS Code dark */
    margin: 0;
    padding: 0;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: stretch;
    color: #d4d4d4; /* VS Code text color */
}

/* App Container */
.app-container {
    display: flex;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: #252526;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #3c3c3c;
    padding: 15px;
    box-sizing: border-box;
    transition: all 0.3s ease;
}

.sidebar-header {
    margin-bottom: 12px;
    font-size: 18px;
    font-weight: 600;
    color: #ffffff;
}

.new-chat-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.new-chat-row button {
    flex: 1;
    padding: 12px;
    background: #007acc; /* VS Code blue */
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: all 0.2s ease;
}

.new-chat-row button:hover {
    background: #005f9e;
    transform: translateY(-1px);
}

.new-chat-row select {
    background-color: #3c3c3c;
    color: white;
    border: none;
    padding: 10px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.new-chat-row select:hover {
    background-color: #505050;
}

.sidebar-label {
    font-size: 12px;
    text-transform: uppercase;
    color: #9e9e9e;
    margin: 14px 0 8px 0;
}

.chat-history {
    flex-grow: 1;
    overflow-y: auto;
    font-size: 14px;
    scrollbar-width: thin;
    scrollbar-color: #3c3c3c transparent;
}

.chat-history::-webkit-scrollbar {
    width: 6px;
}

.chat-history::-webkit-scrollbar-thumb {
    background-color: #3c3c3c;
    border-radius: 3px;
}

.chat-item {
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    background-color: transparent;
    transition: background 0.2s ease, transform 0.1s ease;
    opacity: 0;
    transform: translateX(-20px);
    animation: slideIn 0.3s forwards;
}

.chat-item:hover {
    background-color: #2d2d2d;
    transform: translateX(0);
}

/* Main Chat Area */
.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    flex: 1;
    background: #181818;
}

.chatbox {
    flex-grow: 1;
    overflow-y: auto;
    padding: 24px;
    scrollbar-width: thin;
    scrollbar-color: #3c3c3c transparent;
}

.message {
    display: flex;
    margin-bottom: 20px;
    opacity: 0;
    transform: translateY(20px);
    animation: messageIn 0.4s forwards;
}

.message.user {
    justify-content: flex-end;
}

.message.assistant {
    justify-content: flex-start;
}

.message p {
    padding: 14px 18px;
    border-radius: 14px;
    max-width: 70%;
    line-height: 1.5;
    white-space: pre-wrap;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    transition: background 0.2s ease;
}

.message.user p {
    background: #0e639c; /* dark VS Code blue */
    color: white;
}

.message.assistant p {
    background: #252526;
    color: #d4d4d4;
}

/* Error Messages */
.message.assistant p.error {
    background-color: #f44747;
    color: white;
    font-weight: bold;
    border: 1px solid #e51400;
}

/* Typing Animation */
.typing {
    display: inline-block;
    font-weight: bold;
    letter-spacing: 2px;
    animation: pulseDots 1s infinite;
}

@keyframes pulseDots {
    0%, 80%, 100% { opacity: 0.3; }
    40% { opacity: 1; }
}

/* Input Area */
.input-area {
    display: flex;
    padding: 12px;
    border-top: 1px solid #3c3c3c;
    background: #181818;
}

textarea {
    flex: 1;
    resize: none;
    padding: 14px;
    border: none;
    border-radius: 12px;
    background-color: #252526;
    color: #d4d4d4;
    font-size: 14px;
    outline: none;
    overflow: hidden;
    transition: background 0.2s ease;
}

textarea:focus {
    background-color: #3c3c3c;
}

#sendBtn {
    margin-left: 12px;
    background: #007acc;
    color: white;
    border: none;
    border-radius: 12px;
    padding: 0 18px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

#sendBtn:hover {
    background: #005f9e;
    transform: translateY(-1px);
}

/* Animations */
@keyframes slideIn {
    to { opacity: 1; transform: translateX(0); }
}

@keyframes messageIn {
    to { opacity: 1; transform: translateY(0); }
}

.generated-image {
    max-width: 80%;         /* at most 80% of chat container width */
    max-height: 400px;
    width: auto;
    height: auto;
    border-radius: 8px;
    margin-top: 5px;
    display: block;
}

.footer {
    padding: 10px 15px;
    font-size: 0.9em;
    color: #aaa;
    background-color: #2c2c2c;
    position: fixed;
    bottom: 0;
    width: 100%;
    display: flex;
    justify-content: center; /* centers text block */
    align-items: center;
}

.footer-content {
    flex-grow: 1;
    text-align: center;
}

.footer a {
    color: #66aaff;
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

/* Close button */
.footer-close {
    background: none;
    border: none;
    color: #aaa;
    font-size: 1.2em;
    cursor: pointer;
    margin-left: auto; /* pushes ❌ to the far right */
}

.footer-close:hover {
    color: #fff;
}
