:root {
    --background: #101019;
    --sidebar: #151520;
    --surface: #1c1c29;
    --surface-hover: #252536;
    --text: #f5f5fa;
    --muted: #9292a8;
    --border: #292938;
    --accent: #9270ff;
    --accent-light: #b59cff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--background);
    color: var(--text);
    height: 100dvh;
    overflow: hidden;
}

button {
    font-family: inherit;
    cursor: pointer;
    color: inherit;
    border: none;
}

.app-container {
    display: flex;
    height: 100dvh;
    width: 100%;
}

/* SIDEBAR */

.sidebar {
    width: 270px;
    min-width: 270px;
    background: var(--sidebar);
    border-right: 1px solid var(--border);
    padding: 22px 15px;
    display: flex;
    flex-direction: column;
    z-index: 20;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 35px;
    padding-left: 5px;
}

.brand-icon,
.mobile-logo,
.avatar,
.welcome-logo {
    background: linear-gradient(135deg, #a68aff, #6543df);
    display: grid;
    place-items: center;
    color: white;
    font-weight: 800;
}

.brand-icon {
    width: 37px;
    height: 37px;
    border-radius: 12px;
    font-size: 21px;
}

.close-sidebar {
    display: none;
    margin-left: auto;
    background: transparent;
    font-size: 25px;
}

.new-chat {
    background: linear-gradient(120deg, #805df2, #a17cff);
    padding: 14px;
    border-radius: 12px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 30px;
    transition: .2s;
}

.new-chat:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px #805df244;
}

.new-chat span {
    font-size: 19px;
    margin-right: 10px;
}

.section-label {
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.3px;
    margin: 15px 8px;
}

.nav-item {
    width: 100%;
    background: transparent;
    padding: 12px;
    text-align: left;
    border-radius: 9px;
    font-size: 12px;
    color: var(--muted);
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 5px;
}

.nav-item span {
    font-size: 18px;
}

.nav-item:hover,
.nav-item.active {
    background: var(--surface-hover);
    color: var(--text);
}

.history-area {
    flex: 1;
    overflow-y: auto;
    margin-top: 20px;
}

.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 9px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    color: var(--muted);
    gap: 8px;
}

.history-item:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.history-title {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.delete-chat {
    background: transparent;
    color: var(--muted);
    font-size: 16px;
    opacity: 0;
}

.history-item:hover .delete-chat {
    opacity: 1;
}

.sidebar-bottom {
    border-top: 1px solid var(--border);
    padding-top: 15px;
}

.profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 5px 0;
    margin-top: 10px;
}

.avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
}

.profile strong,
.profile small {
    display: block;
    font-size: 11px;
}

.profile small {
    color: var(--muted);
    margin-top: 4px;
}

.profile-menu {
    margin-left: auto;
    color: var(--muted);
}

/* MAIN */

.main-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    position: relative;
}

.topbar {
    height: 68px;
    min-height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 35px;
    border-bottom: 1px solid var(--border);
}

.top-brand {
    font-size: 15px;
    font-weight: 700;
}

.menu-button {
    display: none;
    background: transparent;
    font-size: 21px;
}

.online-status {
    color: #70dca0;
    font-size: 9px;
    letter-spacing: 1px;
    font-weight: 700;
}

.online-status span {
    display: inline-block;
    width: 7px;
    height: 7px;
    background: #55d58d;
    border-radius: 50%;
    margin-right: 6px;
}

/* CHAT AREA */

.chat-area {
    flex: 1;
    overflow-y: auto;
    padding: 30px 20px;
    scroll-behavior: smooth;
}

.welcome-screen {
    max-width: 750px;
    margin: 45px auto;
    text-align: center;
    animation: appear .7s ease;
}

@keyframes appear {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.welcome-symbol {
    position: relative;
    width: 90px;
    height: 90px;
    margin: 0 auto 25px;
}

.welcome-logo {
    width: 75px;
    height: 75px;
    border-radius: 25px;
    font-size: 43px;
    position: relative;
    z-index: 2;
    margin: auto;
    box-shadow: 0 0 40px #9470ff55;
}

.glow {
    position: absolute;
    width: 100px;
    height: 100px;
    background: #8a66ff;
    filter: blur(55px);
    top: 0;
    left: 0;
    opacity: .4;
}

.welcome-label {
    color: var(--accent-light);
    font-size: 10px;
    letter-spacing: 2px;
    font-weight: 700;
    margin-bottom: 20px;
}

.welcome-screen h1 {
    font-size: clamp(35px, 5vw, 55px);
    line-height: 1.17;
    letter-spacing: -2px;
}

.welcome-screen h1 span {
    background: linear-gradient(90deg, #a58aff, #6c9bff);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
}

.welcome-description {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.8;
    max-width: 440px;
    margin: 20px auto 35px;
}

.suggestions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    max-width: 550px;
    margin: auto;
}

.suggestion {
    text-align: left;
    padding: 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 13px;
    transition: .2s;
}

.suggestion:hover {
    border-color: var(--accent);
    transform: translateY(-3px);
    background: var(--surface-hover);
}

.suggestion span {
    color: var(--accent-light);
    font-size: 20px;
    display: block;
    margin-bottom: 13px;
}

.suggestion strong,
.suggestion small {
    display: block;
}

.suggestion strong {
    font-size: 12px;
    margin-bottom: 6px;
}

.suggestion small {
    color: var(--muted);
    font-size: 10px;
}

/* MESSAGES */

.messages {
    max-width: 850px;
    margin: auto;
}

.message {
    display: flex;
    gap: 13px;
    margin: 25px 0;
    animation: appear .3s ease;
}

.message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: var(--surface-hover);
    color: var(--accent-light);
    font-weight: 800;
    font-size: 12px;
}

.message.user .message-avatar {
    background: #7053d5;
    color: white;
}

.message-content {
    max-width: 85%;
    min-width: 0;
    font-size: 13px;
    line-height: 1.8;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.message.user .message-content {
    background: var(--surface-hover);
    padding: 12px 17px;
    border-radius: 15px 4px 15px 15px;
}

.message-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.message-actions button {
    background: transparent;
    color: var(--muted);
    font-size: 11px;
}

.message-actions button:hover {
    color: var(--accent-light);
}

.typing {
    color: var(--muted);
    font-size: 12px;
    padding: 15px 0;
}

/* COMPOSER */

.composer-area {
    padding: 15px 25px 18px;
}

.composer {
    max-width: 850px;
    margin: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 17px;
    padding: 15px;
    transition: .2s;
}

.composer:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 20px #9470ff13;
}

.composer textarea {
    background: transparent;
    color: var(--text);
    width: 100%;
    border: none;
    outline: none;
    resize: none;
    font-family: inherit;
    font-size: 13px;
    min-height: 35px;
    max-height: 150px;
    line-height: 1.6;
}

.composer textarea::placeholder {
    color: var(--muted);
}

.composer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.composer-tools {
    display: flex;
    align-items: center;
    gap: 12px;
}

.composer-tools button {
    background: transparent;
    font-size: 18px;
    color: var(--muted);
}

.composer-hint {
    color: var(--muted);
    font-size: 10px;
}

.tool-divider {
    height: 17px;
    width: 1px;
    background: var(--border);
}

.send-button {
    width: 37px;
    height: 37px;
    border-radius: 11px;
    background: linear-gradient(135deg, #9d7bff, #6744dc);
    font-size: 23px;
    font-weight: 700;
    transition: .2s;
}

.send-button:hover {
    transform: scale(1.08);
}

.send-button:disabled {
    opacity: .4;
}

.footer-note {
    text-align: center;
    color: var(--muted);
    font-size: 9px;
    margin-top: 12px;
}

.footer-note strong {
    color: var(--accent-light);
}

/* TOAST */

.toast {
    position: fixed;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 12px 20px;
    border-radius: 10px;
    background: #292938;
    color: white;
    font-size: 12px;
    opacity: 0;
    pointer-events: none;
    transition: .3s;
    z-index: 100;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.mobile-overlay {
    display: none;
}

/* LIGHT MODE */

body.light {
    --background: #f5f5fa;
    --sidebar: #ffffff;
    --surface: #ffffff;
    --surface-hover: #ededf6;
    --text: #222230;
    --muted: #77778b;
    --border: #e4e4ef;
}

/* MOBILE */

@media(max-width: 750px) {

    .sidebar {
        position: fixed;
        left: -290px;
        top: 0;
        bottom: 0;
        height: 100dvh;
        transition: left .3s ease;
    }

    .sidebar.open {
        left: 0;
    }

    .close-sidebar {
        display: block;
    }

    .mobile-overlay.active {
        display: block;
        position: fixed;
        inset: 0;
        background: #0009;
        z-index: 15;
    }

    .menu-button {
        display: block;
    }

    .topbar {
        padding: 0 16px;
        gap: 12px;
    }

    .top-brand {
        margin-right: auto;
    }

    .chat-area {
        padding: 15px;
    }

    .welcome-screen {
        margin: 35px auto;
    }

    .welcome-screen h1 {
        font-size: 37px;
    }

    .suggestions {
        gap: 9px;
    }

    .suggestion {
        padding: 13px;
    }

    .composer-area {
        padding: 10px 12px 14px;
    }

    .composer {
        padding: 12px;
    }

    .online-status {
        font-size: 8px;
    }
}

@media(max-width: 380px) {

    .suggestions {
        grid-template-columns: 1fr;
    }

    .welcome-screen h1 {
        font-size: 32px;
    }

    .composer-hint {
        font-size: 8px;
    }
}