/* =========================
   BASIC RESET
========================= */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}


:root {

    --background: #ffffff;

    --sidebar: #f7f7f8;

    --border: #e5e5e5;

    --text: #1f1f1f;

    --muted: #777777;

    --hover: #eeeeee;

    --user-message: #f1f1f1;

    --input-background: #ffffff;

    --button: #111111;

    --button-text: #ffffff;

}


/* =========================
   DARK MODE
========================= */

body.dark {

    --background: #181818;

    --sidebar: #202020;

    --border: #353535;

    --text: #eeeeee;

    --muted: #aaaaaa;

    --hover: #2d2d2d;

    --user-message: #2b2b2b;

    --input-background: #242424;

    --button: #ffffff;

    --button-text: #111111;

}


/* =========================
   BODY
========================= */

body {

    font-family:
        Arial,
        Helvetica,
        sans-serif;

    background: var(--background);

    color: var(--text);

    height: 100vh;

    overflow: hidden;

}


/* =========================
   APP
========================= */

.app {

    display: flex;

    width: 100%;

    height: 100vh;

}


/* =========================
   SIDEBAR
========================= */

.sidebar {

    width: 270px;

    height: 100vh;

    background: var(--sidebar);

    border-right:
        1px solid var(--border);

    padding: 20px;

    display: flex;

    flex-direction: column;

    flex-shrink: 0;

}


/* LOGO */

.sidebar-header {

    display: flex;

    align-items: center;

    gap: 12px;

    margin-bottom: 25px;

}


.logo {

    width: 40px;

    height: 40px;

    border-radius: 12px;

    background: var(--button);

    color: var(--button-text);

    display: flex;

    align-items: center;

    justify-content: center;

    font-size: 21px;

}


.sidebar-header h2 {

    font-size: 17px;

}


.sidebar-header p {

    font-size: 12px;

    color: var(--muted);

    margin-top: 3px;

}


/* NEW CHAT */

.new-chat-btn {

    width: 100%;

    height: 44px;

    border: 1px solid var(--border);

    border-radius: 10px;

    background: var(--background);

    color: var(--text);

    cursor: pointer;

    font-size: 14px;

    display: flex;

    align-items: center;

    justify-content: center;

    gap: 8px;

}


.new-chat-btn:hover {

    background: var(--hover);

}


/* HISTORY */

.history-section {

    flex: 1;

    overflow-y: auto;

    margin-top: 28px;

}


.history-title {

    font-size: 11px;

    color: var(--muted);

    text-transform: uppercase;

    margin-bottom: 10px;

}


.history-item {

    width: 100%;

    border: 0;

    background: transparent;

    color: var(--text);

    text-align: left;

    padding: 10px;

    border-radius: 8px;

    font-size: 13px;

    white-space: nowrap;

    overflow: hidden;

    text-overflow: ellipsis;

    cursor: pointer;

}


.history-item:hover {

    background: var(--hover);

}


/* SIDEBAR BOTTOM */

.sidebar-bottom {

    display: flex;

    flex-direction: column;

    gap: 5px;

}


.side-btn {

    border: 0;

    background: transparent;

    color: var(--text);

    padding: 10px;

    border-radius: 8px;

    cursor: pointer;

    text-align: left;

    font-size: 13px;

}


.side-btn:hover {

    background: var(--hover);

}


.delete-btn {

    color: #e5484d;

}


/* =========================
   MAIN
========================= */

.main {

    flex: 1;

    min-width: 0;

    height: 100vh;

    display: flex;

    flex-direction: column;

}


/* =========================
   TOPBAR
========================= */

.topbar {

    height: 65px;

    border-bottom:
        1px solid var(--border);

    display: flex;

    align-items: center;

    justify-content: space-between;

    padding: 0 25px;

    flex-shrink: 0;

}


.topbar-title {

    display: flex;

    align-items: center;

    gap: 10px;

}


.online-dot {

    width: 8px;

    height: 8px;

    background: #22c55e;

    border-radius: 50%;

}


.topbar-title strong {

    display: block;

    font-size: 14px;

}


.topbar-title small {

    display: block;

    color: var(--muted);

    font-size: 11px;

    margin-top: 2px;

}


#modelSelect {

    background: var(--background);

    color: var(--text);

    border: 1px solid var(--border);

    border-radius: 8px;

    padding: 8px 10px;

    outline: none;

}


/* MOBILE MENU */

.mobile-menu {

    display: none;

    border: 0;

    background: transparent;

    color: var(--text);

    font-size: 20px;

}


/* =========================
   CHAT AREA
========================= */

.chat-area {

    flex: 1;

    overflow-y: auto;

    padding:
        30px
        20px
        150px;

}


/* WELCOME */

.welcome {

    max-width: 850px;

    margin: 0 auto;

    text-align: center;

    padding-top: 65px;

}


.welcome-icon {

    width: 60px;

    height: 60px;

    background: var(--button);

    color: var(--button-text);

    border-radius: 18px;

    display: flex;

    align-items: center;

    justify-content: center;

    margin: auto;

    font-size: 27px;

}


.welcome h1 {

    font-size: 30px;

    margin-top: 22px;

}


.welcome > p {

    color: var(--muted);

    font-size: 15px;

    margin-top: 10px;

    line-height: 1.6;

}


/* SUGGESTIONS */

.suggestions {

    display: grid;

    grid-template-columns: 1fr 1fr;

    gap: 12px;

    margin-top: 35px;

}


.suggestion {

    border: 1px solid var(--border);

    background: var(--background);

    color: var(--text);

    padding: 16px;

    border-radius: 12px;

    display: flex;

    align-items: flex-start;

    gap: 12px;

    text-align: left;

    cursor: pointer;

}


.suggestion:hover {

    background: var(--hover);

}


.suggestion-icon {

    font-size: 20px;

}


.suggestion strong {

    display: block;

    font-size: 13px;

    margin-bottom: 4px;

}


.suggestion small {

    color: var(--muted);

    font-size: 12px;

}


/* =========================
   MESSAGES
========================= */

#messages {

    max-width: 850px;

    margin: auto;

}


.message {

    display: flex;

    gap: 12px;

    margin: 25px 0;

}


.message.user {

    justify-content: flex-end;

}


.avatar {

    width: 32px;

    height: 32px;

    border-radius: 50%;

    background: var(--button);

    color: var(--button-text);

    display: flex;

    align-items: center;

    justify-content: center;

    flex-shrink: 0;

    font-size: 13px;

}


.message-content {

    max-width: 75%;

    font-size: 15px;

    line-height: 1.65;

}


.user .message-content {

    background: var(--user-message);

    padding: 11px 15px;

    border-radius: 15px;

}


/* AI RESPONSE */

.assistant .message-content {

    max-width: 800px;

}


/* =========================
   SIMPLE MARKDOWN
========================= */

.message-content p {

    margin-bottom: 10px;

}


.message-content ul {

    margin:
        10px
        0
        10px
        22px;

}


.message-content ol {

    margin:
        10px
        0
        10px
        22px;

}


.message-content strong {

    font-weight: 700;

}


.message-content code {

    font-family: Consolas, monospace;

    background: var(--user-message);

    padding: 2px 5px;

    border-radius: 4px;

}


.message-content pre {

    background: #111111;

    color: #ffffff;

    padding: 15px;

    border-radius: 10px;

    overflow-x: auto;

    margin: 12px 0;

}


.message-content pre code {

    background: transparent;

    padding: 0;

}


/* COPY BUTTON */

.copy-btn {

    margin-top: 8px;

    border: 1px solid var(--border);

    background: var(--background);

    color: var(--muted);

    padding: 5px 9px;

    border-radius: 6px;

    cursor: pointer;

    font-size: 11px;

}


.copy-btn:hover {

    background: var(--hover);

}


/* =========================
   LOADING
========================= */

.typing {

    display: flex;

    gap: 4px;

    padding: 10px 0;

}


.typing span {

    width: 7px;

    height: 7px;

    background: var(--muted);

    border-radius: 50%;

    animation: typing 1.2s infinite;

}


.typing span:nth-child(2) {

    animation-delay: .15s;

}


.typing span:nth-child(3) {

    animation-delay: .3s;

}


@keyframes typing {

    0%, 60%, 100% {

        opacity: .3;

        transform: translateY(0);

    }

    30% {

        opacity: 1;

        transform: translateY(-4px);

    }

}


/* =========================
   COMPOSER
========================= */

.composer-area {

    position: fixed;

    bottom: 0;

    left: 270px;

    right: 0;

    padding:
        15px
        20px
        18px;

    background:
        linear-gradient(
            transparent,
            var(--background) 30%
        );

}


.composer {

    max-width: 850px;

    margin: auto;

    border:
        1px solid var(--border);

    background: var(--input-background);

    border-radius: 16px;

    padding:
        8px
        8px
        8px
        15px;

    display: flex;

    align-items: flex-end;

    gap: 10px;

    box-shadow:
        0 5px 25px rgba(0,0,0,.06);

}


#messageInput {

    flex: 1;

    resize: none;

    border: 0;

    outline: 0;

    background: transparent;

    color: var(--text);

    font-size: 15px;

    line-height: 1.5;

    max-height: 150px;

    padding: 8px 0;

}


.send-btn {

    width: 40px;

    height: 40px;

    border: 0;

    border-radius: 10px;

    background: var(--button);

    color: var(--button-text);

    font-size: 20px;

    cursor: pointer;

}


.send-btn:hover {

    opacity: .85;

}


.send-btn:disabled {

    opacity: .4;

    cursor: not-allowed;

}


.disclaimer {

    text-align: center;

    color: var(--muted);

    font-size: 10px;

    margin-top: 7px;

}


/* =========================
   MOBILE
========================= */

@media (max-width: 800px) {

    .sidebar {

        position: fixed;

        left: -280px;

        top: 0;

        bottom: 0;

        z-index: 100;

        transition: left .25s ease;

    }


    .sidebar.open {

        left: 0;

    }


    .mobile-menu {

        display: block;

    }


    .topbar {

        padding: 0 15px;

    }


    .topbar-title {

        margin-right: auto;

        margin-left: 10px;

    }


    .composer-area {

        left: 0;

        padding:
            12px
            12px
            15px;

    }


    .chat-area {

        padding:
            20px
            12px
            140px;

    }


    .welcome {

        padding-top: 35px;

    }


    .welcome h1 {

        font-size: 25px;

    }


    .suggestions {

        grid-template-columns: 1fr;

    }


    .message-content {

        max-width: 85%;

    }


    #modelSelect {

        max-width: 120px;

    }

}