* {
    box-sizing: border-box;
}

:root {
    --bg: #ffffff;
    --sidebar-bg: #f7f7f8;
    --border: #e5e5e5;
    --text: #202123;
    --muted: #6f6f78;
    --hover: #ececee;
    --active: #e7e7e9;
    --user-message: #f0f0f0;
    --dark: #171717;
    --success: #21a366;
}

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Arial,
        Helvetica,
        sans-serif;
}

body {
    overflow: hidden;
}

button,
textarea,
input {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

button {
    cursor: pointer;
}

.app {
    display: flex;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}


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

.sidebar {
    width: 260px;
    min-width: 260px;
    height: 100vh;

    display: flex;
    flex-direction: column;

    padding: 14px 10px;

    background: var(--sidebar-bg);

    border-right: 1px solid var(--border);
}

.brand {
    display: flex;
    align-items: center;
    gap: 11px;

    padding: 7px 10px 19px;
}

.logo {
    width: 36px;
    height: 36px;

    display: flex;
    align-items: center;
    justify-content: center;

    flex-shrink: 0;

    border-radius: 10px;

    background: var(--dark);
    color: white;

    font-size: 17px;
    font-weight: 700;
}

.brand-name {
    color: var(--text);

    font-size: 15px;
    font-weight: 650;

    line-height: 1.2;
}

.brand-subtitle {
    margin-top: 3px;

    color: var(--muted);

    font-size: 11px;
}


/* NEW CHAT */

.new-chat {
    display: flex;
    align-items: center;
    gap: 10px;

    width: 100%;

    padding: 10px 12px;

    border: 1px solid #dadade;
    border-radius: 9px;

    background: #ffffff;

    color: var(--text);

    font-size: 13px;
    font-weight: 550;

    text-decoration: none;

    transition:
        background .15s ease,
        border-color .15s ease;
}

.new-chat:hover {
    background: #f2f2f3;
    border-color: #ccccd0;
}

.new-chat-icon {
    font-size: 20px;
    font-weight: 300;

    line-height: 1;
}

/* CONVERSATIONS */

.section-title {
    margin: 24px 10px 8px;

    color: #8a8a91;

    font-size: 10px;
    font-weight: 650;

    letter-spacing: .08em;
}

.conversation {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 9px 10px;
    border-radius: 8px;
    color: #343438;
    font-size: 13px;
    overflow: hidden;
}

.conversation.active {
    background: var(--active);    cursor: pointer;
}

.conversation-icon {
    width: 18px;

    flex-shrink: 0;

    color: #77777d;

    text-align: center;
}

.conversation span:last-child {
    overflow: hidden;

    text-overflow: ellipsis;
    white-space: nowrap;
}


.conversation-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
    overflow-y: auto;
    scrollbar-width: none;
}

.conversation-list::-webkit-scrollbar {
    display: none;
}

/* SIDEBAR BOTTOM */

.sidebar-bottom {
    display: flex;
    flex-direction: column;
    gap: 2px;

    margin-top: auto;
}

.sidebar-bottom button {
    display: flex;
    align-items: center;
    gap: 10px;

    width: 100%;

    padding: 9px 10px;

    border: 0;
    border-radius: 8px;

    background: transparent;

    color: #55555c;

    font-size: 13px;

    text-align: left;
}

.sidebar-bottom button:hover {
    background: var(--hover);
}

.menu-icon {
    width: 18px;

    display: inline-block;

    color: #66666c;

    text-align: center;
}


/* =========================
   MAIN CHAT
   ========================= */

.chat {
    position: relative;

    min-width: 0;
    height: 100vh;

    flex: 1;

    display: flex;
    flex-direction: column;

    background: #ffffff;
}


/* HEADER */

.topbar {
    height: 58px;
    min-height: 58px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 20px;

    border-bottom: 1px solid var(--border);

    background: rgba(255, 255, 255, .96);
}

.topbar > strong {
    font-size: 15px;
}

.model {
    display: flex;
    align-items: center;
    gap: 7px;

    color: #4e4e54;

    font-size: 13px;
    font-weight: 550;
}

.status-dot {
    width: 7px;
    height: 7px;

    display: inline-block;

    border-radius: 50%;

    background: var(--success);
}

.status-text {
    color: var(--muted);

    font-size: 12px;
    font-weight: 400;
}

.account {
    padding: 7px 36px;

    border: 1px solid #dddddf;
    border-radius: 8px;

    background: white;

    color: #3b3b40;

    font-size: 12px;

    transition: background .15s ease;
}

.account:hover {
    background: #f4f4f5;
}


/* =========================
   MESSAGES
   ========================= */

.messages {
    width: 100%;
    max-width: 860px;

    flex: 1;

    margin: 0 auto;

    padding:
        36px
        24px
        150px;

    overflow-x: hidden;
    overflow-y: auto;

    scroll-behavior: smooth;
}

.message-row {
    display: flex;
    align-items: flex-start;

    gap: 13px;

    width: 100%;

    margin-bottom: 28px;
}

.user-row {
    justify-content: flex-end;
}

.avatar {
    width: 32px;
    height: 32px;

    flex-shrink: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 9px;

    font-size: 10px;
    font-weight: 700;
}

.ai-avatar {
    background: var(--dark);
    color: white;

    font-size: 13px;
}

.user-avatar {
    background: #ebebed;
    color: #66666c;

    font-size: 8px;
}

.message {
    max-width: 700px;

    color: #29292d;

    font-size: 15px;
    line-height: 1.65;

    overflow-wrap: anywhere;
}

.ai-message {
    padding: 3px 0;
}

.user-message {
    max-width: 70%;

    padding: 10px 14px;

    border-radius:
        16px
        16px
        4px
        16px;

    background: var(--user-message);
}

.stop-button {
    background: #111111;
}

.stop-button::after {
    content: "";
}

.stop-button:hover {
    background: #333333;
}
/* =========================
   TYPING INDICATOR
   ========================= */

.typing {
    height: 32px;

    display: flex;
    align-items: center;

    gap: 5px;
}

.typing span {
    width: 6px;
    height: 6px;

    border-radius: 50%;

    background: #88888e;

    animation: typingPulse 1.1s infinite ease-in-out;
}

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

.typing span:nth-child(3) {
    animation-delay: .3s;
}

@keyframes typingPulse {
    0%,
    60%,
    100% {
        opacity: .3;
        transform: translateY(0);
    }

    30% {
        opacity: 1;
        transform: translateY(-3px);
    }
}


/* =========================
   COMPOSER
   ========================= */

.composer-area {
    position: absolute;

    right: 0;
    bottom: 0;
    left: 0;

    padding:
        28px
        22px
        16px;

    background:
        linear-gradient(
            to bottom,
            rgba(255, 255, 255, 0),
            rgba(255, 255, 255, .96) 25%,
            #ffffff 55%
        );
}

.composer {
    width: 100%;
    max-width: 820px;

    min-height: 54px;

    margin: 0 auto;

    display: flex;
    align-items: flex-end;

    gap: 8px;

    padding:
        8px
        8px
        8px
        15px;

    border: 1px solid #d6d6da;
    border-radius: 18px;

    background: white;

    box-shadow:
        0 2px 10px
        rgba(0, 0, 0, .055);
}

.composer:focus-within {
    border-color: #b8b8bd;

    box-shadow:
        0 2px 13px
        rgba(0, 0, 0, .075);
}

.composer textarea {
    width: 100%;
    min-height: 34px;
    max-height: 160px;

    flex: 1;

    padding: 8px 3px;

    border: 0;
    outline: 0;

    resize: none;

    background: transparent;

    color: var(--text);

    font-size: 15px;
    line-height: 1.4;
}

.composer textarea::placeholder {
    color: #929298;
}

.send {
    width: 36px;
    height: 36px;

    flex-shrink: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    border: 0;
    border-radius: 10px;

    background: var(--dark);
    color: white;

    font-size: 21px;
    line-height: 1;

    transition:
        opacity .15s ease,
        transform .1s ease;
}

.send:hover:not(:disabled) {
    transform: translateY(-1px);
}

.send:disabled {
    cursor: default;

    opacity: .25;
}

.notice {
    margin-top: 8px;

    color: #94949a;

    font-size: 10px;

    text-align: center;
}

.hidden {
    display: none !important;
}

.logout-button {
    width: 40px;
    height: 40px;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0;

    border: none;
    border-radius: 8px;

    background: transparent;

    cursor: pointer;
}

.logout-icon {
    width: 22px;
    height: 22px;

    fill: currentColor;
}

.logout-button:hover {
    background: rgba(128, 128, 128, 0.15);
}

#currentConversationButton {
    transition:
        background-color 0.15s ease,
        filter 0.15s ease;
}


#currentConversationButton:hover {
    background-color: rgba(0, 0, 0, 0.18);
    cursor: pointer;
}

/* =========================================================
   CONVERSATION TITLE / DELETE BUTTON
   ========================================================= */

.conversation-item {
    display: flex;
    align-items: center;

    width: 100%;
    min-width: 0;

    padding: 9px 10px;
    flex-shrink: 0;

    border: none;
    border-radius: 7px;

    background: transparent;

    font: inherit;
    text-align: left;

    cursor: pointer;

    overflow: hidden;
}

.conversation-item:hover {
    background: rgba(128, 128, 128, 0.12);
}

.conversation-item.active {
    background: rgba(128, 128, 128, 0.20);
    font-weight: 600;
}

.conversation-title {
    flex: 1;
    width: 0;
    min-width: 0;

    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;

    text-align: left;
}

.conversation-delete {
    flex: 0 0 auto;

    width: 0;
    margin-left: 0;
    padding: 0;

    overflow: hidden;

    font-size: 18px;
    line-height: 1;

    opacity: 0;

    cursor: pointer;

    transition:
        width 0.15s ease,
        margin-left 0.15s ease,
        opacity 0.15s ease,
        color 0.15s ease;
}

.conversation-item.active:hover .conversation-delete {
    width: 18px;
    margin-left: 8px;
    opacity: 0.7;
}

.conversation-item.active:hover .conversation-delete:hover {
    opacity: 1;
}

.conversation-delete.armed {
    width: 18px;
    margin-left: 8px;
    opacity: 0.8;
    color: #d93025;
    transform: scale(1);

    transition:
        opacity 0.15s ease,
        color 0.15s ease,
        transform 0.15s ease;
}

.conversation-item.active .conversation-delete.armed {
    width: 18px;
    margin-left: 8px;
    opacity: 0.8;
    color: #d93025;
}

.conversation-item.active .conversation-delete.armed:hover {
    opacity: 1;
    transform: scale(1.075);
}

/* =========================
   MOBILE
   ========================= */

@media (max-width: 760px) {

    .sidebar {
        display: none;
    }

    .chat {
        width: 100%;
    }

    .topbar {
        height: 54px;
        min-height: 54px;

        padding: 0 14px;
    }

    .model {
        margin-left: auto;
        margin-right: 12px;
    }

    .messages {
        padding:
            24px
            15px
            135px;
    }

    .message-row {
        gap: 9px;

        margin-bottom: 23px;
    }

    .avatar {
        width: 29px;
        height: 29px;
    }

    .message {
        max-width: calc(100% - 45px);

        font-size: 14px;
    }

    .user-message {
        max-width: 80%;
    }

    .composer-area {
        padding:
            20px
            10px
            10px;
    }

    .composer {
        min-height: 50px;

        padding:
            6px
            6px
            6px
            12px;

        border-radius: 16px;
    }

    .composer textarea {
        font-size: 16px;
    }

    .notice {
        font-size: 9px;
    }
}


/* VERY SMALL PHONES */

@media (max-width: 420px) {

    .account {
        padding: 6px 9px;
    }

    .status-text {
        display: none;
    }

    .messages {
        padding-left: 11px;
        padding-right: 11px;
    }
}