/* --- Global & Base Styles --- */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600&family=Roboto:ital,wght@0,100..900;1,100..900&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Poppins", sans-serif;
}

/* --- Color Variables (Dark & Light Themes) --- */
:root {
    /* Dark Theme (Default) */
    --text-color: #f8f8f8;
    --subheading-color: #a0a4ac;
    --placeholder-color: #6c707a;
    --primary-color: #0b0b0d;
    --secondary-color: #1a1a1d;
    --secondary-hover-color: #2a2a2e;
    --scrollbar-color: #444548;
    --accent-blue: #00BFFF;
    --accent-green: #39FF14;
    --accent-yellow: #FFC107;
    --accent-purple: #9B59B6;
    --accent-red: #d62939;
}

body.light-theme {
    /* Light Theme (Complementary) */
    --text-color: #0b0b0d;
    --subheading-color: #55585E;
    --placeholder-color: #888A8E;
    --primary-color: #FFFFFF;
    --secondary-color: #F0F0F0;
    --secondary-hover-color: #E0E0E0;
    --scrollbar-color: #d0d0d0;
    --accent-red: #c0202d;
}

body {
    color: var(--text-color);
    background: var(--primary-color);
}

/* --- Layout & Utility Classes --- */
.container {
    overflow-y: auto;
    padding: 32px 0 60px;
    max-height: calc(100vh - 27px);
    scrollbar-color: var(--scrollbar-color) transparent;
    scroll-behavior: smooth;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
}

.container :where(.app-header, .suggestions, .message, .prompt-wrapper, .disclaimer-text) {
    margin: 0 auto;
    width: 100%;
    padding: 0 20px;
    max-width: 980px;
}

/* Hides content when a chat has started */
body.chats-active .container :where(.app-header, .suggestions) {
    display: none;
}

/* --- App Header & Suggestions --- */
.app-header {
    margin-top: 4vh;
}

.app-header .heading {
    font-size: 3rem;
    width: fit-content;
    background: linear-gradient(to right, var(--accent-blue), var(--accent-purple));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.app-header .sub-heading {
    font-size: 2.6rem;
    margin-top: -5px;
    color: var(--subheading-color);
}

.suggestions {
    display: flex;
    gap: 15px;
    margin-top: 9.5vh;
    list-style: none;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.suggestions::-webkit-scrollbar {
    display: none;
}

.suggestions .suggestions-list {
    width: 228px;
    padding: 18px;
    flex-shrink: 0;
    display: flex;
    cursor: pointer;
    flex-direction: column;
    align-items: flex-end;
    justify-content: space-between;
    border-radius: 12px;
    background: var(--secondary-color);
    transition: 0.3s ease;
}

.suggestions .suggestions-list:hover {
    background: var(--secondary-hover-color);
}

.suggestions .suggestions-list .text {
    font-size: 1.1rem;
}

.suggestions .suggestions-list span {
    height: 45px;
    width: 45px;
    font-size: 1.1rem;
    display: flex;
    align-self: flex-end;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--primary-color);
}

/* Individual accent colors for suggestions */
.suggestions .suggestions-list:nth-child(1) span { color: var(--accent-blue); }
.suggestions .suggestions-list:nth-child(2) span { color: var(--accent-green); }
.suggestions .suggestions-list:nth-child(3) span { color: var(--accent-yellow); }
.suggestions .suggestions-list:nth-child(4) span { color: var(--accent-purple); }


/* --- Chat Container & Messages --- */
.chats-container {
    display: flex;
    gap: 20px;
    flex-direction: column;
    margin: 100px auto;
    width: 100%;
    max-width: 980px;
    padding: 0px 4px;
}

.chats-container .message {
    display: flex;
    gap: 11px;
    align-items: center;
}

.chats-container .bot-message {
    margin: 9px auto;
}

.chats-container .bot-message .avatar {
    height: 43px;
    width: 43px;
    flex-shrink: 0;
    padding: 6px;
    align-self: flex-start;
    margin-right: -7px;
    border-radius: 50%;
    background: var(--secondary-color);
    border: 1px solid var(--secondary-hover-color);
}

.chats-container .bot-message.loading .avatar {
    animation: rotate 3s linear infinite;
}

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

.chats-container .message .message-text {
    padding: 3px 1px;
    word-wrap: break-word;
    white-space: pre-line;
}

.chats-container .user-message {
    flex-direction: column;
    align-items: flex-end;
    width: 100%;
}

.chats-container .user-message .message-text {
    padding: 12px 16px;
    max-width: 75%;
    border-radius: 13px 13px 3px 13px;
    background: var(--secondary-color);
}

.chats-container .user-message .img-attachment {
    width: 50%;
    margin-top: -7px;
    border-radius: 13px 3px 13px 13px;
}

.chats-container .user-message .file-attachment {
    display: flex;
    gap: 6px;
    align-items: center;
    padding: 10px;
    margin-top: -7px;
    border-radius: 13px 3px 13px 13px;
    background: var(--secondary-color);
}

.chats-container .user-message .file-attachment span {
    color: var(--accent-blue);
}


/* --- Prompt Area --- */
.prompt-container {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 16px 0;
    background: var(--primary-color);
    z-index: 10;
}

.prompt-container :where(.prompt-wrapper, .prompt-form, .prompt-actions) {
    display: flex;
    gap: 12px;
    height: 56px;
    align-items: center;
}

.prompt-wrapper .prompt-form {
    width: 100%;
    height: 100%;
    border-radius: 130px;
    background: var(--secondary-color);
}

.prompt-form .prompt-input {
    height: 100%;
    width: 100%;
    background: none;
    outline: none;
    border: none;
    font-size: 1rem;
    padding-left: 24px;
    color: var(--text-color);
}

.prompt-form .prompt-input::placeholder {
    color: var(--placeholder-color);
}

.prompt-wrapper button {
    width: 56px;
    height: 100%;
    border: none;
    cursor: pointer;
    font-size: 1.4rem;
    color: var(--text-color);
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--secondary-color);
    transition: 0.3s ease;
}

.prompt-wrapper :is(button:hover, .file-icon, #cancel-file-btn) {
    background: var(--secondary-hover-color);
}

.prompt-form .prompt-actions {
    gap: 5px;
    margin-right: 7px;
}

.prompt-wrapper .prompt-form :where(.file-upload-wrapper, button, img) {
    position: relative;
    height: 45px;
    width: 45px;
}

.prompt-form #send-prompt-btn {
    color: #fff;
    background: var(--accent-blue);
    display: none;
}

.prompt-form #send-prompt-btn:hover {
    background: #0264e3;
}

.prompt-form .file-upload-wrapper :where(button, img) {
    position: absolute;
    border-radius: 50%;
    object-fit: cover;
    display: none;
}

.prompt-form .file-upload-wrapper #add-file-btn,
.prompt-form .file-upload-wrapper.active.img-attached img,
.prompt-form .file-upload-wrapper.active.file-attached .file-icon,
.prompt-form .file-upload-wrapper.active:hover #cancel-file-btn {
    display: block;
}

.prompt-form .file-upload-wrapper.active #add-file-btn {
    display: none;
}

.prompt-form :is(#cancel-file-btn, #stop-response-btn:hover) {
    color: var(--accent-red);
}

.prompt-form .file-icon {
    color: var(--accent-blue);
}

.prompt-form #stop-response-btn,
body.bot-responding .prompt-form .file-upload-wrapper {
    display: none;
}

body.bot-responding .prompt-form #stop-response-btn {
    display: block;
}

.prompt-container .disclaimer-text {
    text-align: center;
    font-size: 0.9rem;
    padding: 16px 20px 0;
    color: var(--placeholder-color);
}

.prompt-form .prompt-input:valid ~ .prompt-actions #send-prompt-btn {
    display: block;
}


/* --- Mobile Responsiveness --- */
/* Common adjustments for screens up to 768px */
@media (max-width: 768px) {
    .container { padding: 20px 0 100px; }
    .app-header { margin-top: 2vh; }
    .app-header :is(.heading, .sub-heading) { font-size: 2rem; line-height: 1.4; }
    .app-header .sub-heading { font-size: 1.7rem; }
    .suggestions { margin-top: 5vh; padding-bottom: 10px; }
    .suggestions .suggestions-list { width: 180px; padding: 15px; }
    .suggestions .suggestions-list .text { font-size: 0.95rem; }
    .suggestions .suggestions-list span { height: 40px; width: 40px; font-size: 1rem; }
    .chats-container { gap: 15px; margin: 50px auto; }
    .chats-container .bot-message { margin: 4px auto ;  }
    .chats-container .bot-message .avatar { height: 38px; width: 38px; padding: 5px; display: none; }
    .chats-container .user-message .message-text { max-width: 95%; }
    .chats-container .user-message .img-attachment { width: 70%; }
    .prompt-container { padding: 12px 0; }
    .prompt-container :where(.prompt-wrapper, .prompt-form, .prompt-actions) { gap: 8px; height: 50px; }
    .prompt-wrapper button { width: 50px; height: 50px; }
    .prompt-form :is(.file-upload-wrapper, button, img) { height: 38px; width: 38px; }
    .prompt-form .prompt-input { padding-left: 15px; font-size: 0.95rem; }
    .prompt-wrapper.hide-controls :where(#theme-toggle-btn, #delete-chats-btn) { display: none; }
    .prompt-container .disclaimer-text { font-size: 0.8rem; padding: 12px 15px 0; }
    .message-text{
        font-size: 16px;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    .app-header .heading { font-size: 1.8rem; }
    .app-header .sub-heading { font-size: 1.5rem; }
    .suggestions .suggestions-list { width: 160px; min-height: 100px; }
    .chats-container .user-message .message-text { max-width: 100%; }
    .chats-container .user-message .img-attachment { width: 85%; }
    .prompt-wrapper button { width: 45px; height: 45px; font-size: 1.2rem; }
    .prompt-form .prompt-actions { gap: 3px; margin-right: 5px; }
    .prompt-form :is(.file-upload-wrapper, button, img) { height: 35px; width: 35px; }
    .container :where(.app-header, .suggestions, .message, .prompt-wrapper, .disclaimer-text) { padding: 0 15px; }
}

/* For very small screens */
@media (max-width: 320px) {
    .app-header .heading { font-size: 1.6rem; }
    .app-header .sub-heading { font-size: 1.3rem; }
    .suggestions .suggestions-list { width: 140px; padding: 12px; }
    .suggestions .suggestions-list .text { font-size: 0.85rem; }
    .suggestions .suggestions-list span { height: 35px; width: 35px; }
    .prompt-wrapper button:not(#send-prompt-btn) { display: none; }
    .prompt-wrapper.hide-controls .prompt-form { width: 100%; }
}