* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #070812;
    --bg2: #0b0d1a;
    --panel: rgba(16, 18, 34, 0.82);
    --panel2: rgba(23, 26, 46, 0.75);
    --border: rgba(255,255,255,0.08);
    --text: #f4f5ff;
    --muted: #9296ad;
    --accent: #765cff;
    --accent2: #4e8cff;
    --danger: #ff5577;
}

body {
    font-family:
        Inter,
        Arial,
        Helvetica,
        sans-serif;

    background:
        radial-gradient(
            circle at 20% 10%,
            rgba(118, 92, 255, 0.16),
            transparent 30%
        ),
        radial-gradient(
            circle at 80% 80%,
            rgba(78, 140, 255, 0.12),
            transparent 30%
        ),
        var(--bg);

    color: var(--text);

    height: 100vh;

    overflow: hidden;
}


/* APP */

.app {
    display: flex;

    width: 100%;
    height: 100vh;
}


/* SIDEBAR */

.sidebar {
    width: 270px;

    display: flex;
    flex-direction: column;

    padding: 22px 16px;

    background:
        rgba(7, 8, 18, 0.86);

    border-right:
        1px solid var(--border);

    backdrop-filter:
        blur(25px);
}


/* BRAND */

.brand {
    display: flex;
    align-items: center;

    gap: 12px;

    padding:
        4px 8px 24px;
}

.brand-logo,
.welcome-logo {
    display: flex;
    align-items: center;
    justify-content: center;

    background:
        linear-gradient(
            135deg,
            var(--accent),
            var(--accent2)
        );

    box-shadow:
        0 0 30px rgba(118,92,255,0.35);

    color: white;

    font-weight: 900;
}

.brand-logo {
    width: 42px;
    height: 42px;

    border-radius: 12px;

    font-size: 21px;
}

.brand-name {
    font-size: 17px;
    font-weight: 800;
    letter-spacing: 2px;
}

.brand-subtitle {
    color: var(--muted);
    font-size: 9px;
    letter-spacing: 2px;
    margin-top: 2px;
}


/* NEW CHAT */

.new-chat {
    border: 1px solid var(--border);

    background:
        linear-gradient(
            135deg,
            rgba(118,92,255,0.2),
            rgba(78,140,255,0.12)
        );

    color: white;

    border-radius: 12px;

    padding: 13px;

    font-size: 14px;
    font-weight: 700;

    cursor: pointer;

    transition: 0.2s;
}

.new-chat:hover {
    transform: translateY(-1px);

    border-color:
        rgba(118,92,255,0.5);

    background:
        linear-gradient(
            135deg,
            rgba(118,92,255,0.3),
            rgba(78,140,255,0.18)
        );
}

.new-chat span {
    font-size: 20px;
    vertical-align: -1px;
    margin-right: 6px;
}


/* SIDEBAR TITLE */

.sidebar-title {
    color: #62667d;

    font-size: 10px;

    letter-spacing: 2px;

    font-weight: 800;

    margin:
        28px 10px 10px;
}


/* SIDEBAR ITEMS */

.sidebar-item {
    display: flex;

    align-items: center;

    gap: 12px;

    padding: 12px;

    margin-bottom: 4px;

    border-radius: 10px;

    color: var(--muted);

    font-size: 13px;

    cursor: pointer;

    transition: 0.2s;
}

.sidebar-item:hover {
    background:
        rgba(255,255,255,0.04);

    color: white;
}

.sidebar-item.active {
    background:
        rgba(118,92,255,0.12);

    color: white;

    border:
        1px solid rgba(118,92,255,0.16);
}

.sidebar-item span {
    width: 18px;
    text-align: center;
}


/* SPACER */

.sidebar-spacer {
    flex: 1;
}


/* STATUS */

.status-card {
    display: flex;

    align-items: center;

    gap: 10px;

    padding: 12px;

    background:
        rgba(255,255,255,0.025);

    border:
        1px solid var(--border);

    border-radius: 12px;

    margin-bottom: 15px;
}

.status-dot {
    width: 9px;
    height: 9px;

    border-radius: 50%;

    background: #38e58a;

    box-shadow:
        0 0 12px #38e58a;
}

.status-title {
    font-size: 12px;
    font-weight: 700;
}

.status-text {
    color: var(--muted);
    font-size: 10px;
    margin-top: 2px;
}

.sidebar-footer {
    color: #45495e;

    font-size: 8px;

    letter-spacing: 1.5px;

    line-height: 1.6;

    padding: 0 4px;
}


/* MAIN */

.main {
    flex: 1;

    min-width: 0;

    display: flex;

    flex-direction: column;

    position: relative;
}


/* TOPBAR */

.topbar {
    height: 72px;

    display: flex;

    align-items: center;

    justify-content: space-between;

    padding:
        0 28px;

    border-bottom:
        1px solid var(--border);

    background:
        rgba(7,8,18,0.65);

    backdrop-filter:
        blur(20px);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.top-title {
    font-size: 15px;
    font-weight: 800;
}

.top-status {
    display: flex;
    align-items: center;
    gap: 5px;

    color: #747990;

    font-size: 10px;

    margin-top: 3px;
}

.online-dot {
    width: 6px;
    height: 6px;

    border-radius: 50%;

    background: #38e58a;

    box-shadow:
        0 0 8px #38e58a;
}

.mobile-logo {
    display: none;

    width: 35px;
    height: 35px;

    align-items: center;
    justify-content: center;

    border-radius: 10px;

    background:
        linear-gradient(
            135deg,
            var(--accent),
            var(--accent2)
        );

    font-weight: 900;
}

.topbar-actions {
    display: flex;
    gap: 8px;
}

.header-button {
    width: 38px;
    height: 38px;

    border: 1px solid var(--border);

    border-radius: 10px;

    background:
        rgba(255,255,255,0.03);

    color: #aaaec1;

    cursor: pointer;

    transition: 0.2s;
}

.header-button:hover {
    color: white;

    border-color:
        rgba(118,92,255,0.4);

    background:
        rgba(118,92,255,0.1);
}


/* CHAT */

.chat {
    flex: 1;

    overflow-y: auto;

    padding:
        40px 20px 150px;
}

.chat::-webkit-scrollbar {
    width: 6px;
}

.chat::-webkit-scrollbar-thumb {
    background:
        rgba(255,255,255,0.08);

    border-radius: 10px;
}


/* WELCOME */

.welcome {
    max-width: 760px;

    margin:
        8vh auto 0;

    text-align: center;
}

.welcome-logo {
    width: 70px;
    height: 70px;

    margin:
        0 auto 24px;

    border-radius: 22px;

    font-size: 34px;
}

.welcome h1 {
    font-size: clamp(28px, 4vw, 42px);

    letter-spacing: -1.5px;

    margin-bottom: 12px;
}

.welcome p {
    color: var(--muted);

    font-size: 14px;
}

.welcome strong {
    color: white;
}


/* SUGGESTIONS */

.suggestions {
    display: grid;

    grid-template-columns:
        repeat(3, 1fr);

    gap: 10px;

    margin-top: 35px;
}

.suggestion {
    min-height: 76px;

    padding: 14px;

    border-radius: 14px;

    border:
        1px solid var(--border);

    background:
        rgba(255,255,255,0.025);

    color: #b7bbcd;

    cursor: pointer;

    text-align: left;

    font-size: 12px;

    transition: 0.2s;
}

.suggestion:hover {
    color: white;

    border-color:
        rgba(118,92,255,0.4);

    background:
        rgba(118,92,255,0.08);

    transform: translateY(-2px);
}


/* MESSAGE */

.message {
    width: 100%;
    max-width: 850px;

    margin:
        0 auto 25px;

    display: flex;

    gap: 12px;
}

.message.user {
    justify-content: flex-end;
}

.message-avatar {
    width: 32px;
    height: 32px;

    flex: 0 0 32px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 10px;

    font-size: 12px;
    font-weight: 800;

    background:
        linear-gradient(
            135deg,
            var(--accent),
            var(--accent2)
        );
}

.message.user .message-avatar {
    order: 2;

    background:
        rgba(255,255,255,0.08);
}

.message-content {
    max-width: 75%;

    padding: 13px 16px;

    border-radius: 15px;

    background:
        rgba(255,255,255,0.04);

    border:
        1px solid var(--border);

    color: #e9eaf2;

    font-size: 14px;

    line-height: 1.6;

    white-space: pre-wrap;
}

.message.user .message-content {
    background:
        linear-gradient(
            135deg,
            rgba(118,92,255,0.25),
            rgba(78,140,255,0.16)
        );

    border-color:
        rgba(118,92,255,0.2);
}


/* TYPING */

.typing {
    display: flex;

    gap: 5px;

    padding: 4px;
}

.typing span {
    width: 6px;
    height: 6px;

    border-radius: 50%;

    background: #8589a0;

    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: .25;
        transform: translateY(0);
    }

    30% {
        opacity: 1;
        transform: translateY(-3px);
    }

}


/* INPUT */

.input-area {
    position: absolute;

    bottom: 0;
    left: 0;
    right: 0;

    padding:
        20px 24px 16px;

    background:
        linear-gradient(
            transparent,
            var(--bg) 35%
        );
}

.input-box {
    max-width: 850px;

    margin: auto;

    display: flex;

    align-items: flex-end;

    gap: 10px;

    padding: 10px;

    border:
        1px solid rgba(255,255,255,0.1);

    border-radius: 17px;

    background:
        rgba(16,18,34,0.9);

    box-shadow:
        0 15px 50px rgba(0,0,0,0.35);

    backdrop-filter:
        blur(20px);
}

#messageInput {
    flex: 1;

    resize: none;

    max-height: 160px;

    border: none;

    outline: none;

    background: transparent;

    color: white;

    padding:
        9px 8px;

    font-family: inherit;

    font-size: 14px;

    line-height: 1.5;
}

#messageInput::placeholder {
    color: #656a80;
}

.send-button {
    width: 40px;
    height: 40px;

    border: none;

    border-radius: 11px;

    background:
        linear-gradient(
            135deg,
            var(--accent),
            var(--accent2)
        );

    color: white;

    cursor: pointer;

    font-size: 17px;

    transition: 0.2s;
}

.send-button:hover {
    transform: scale(1.05);

    box-shadow:
        0 0 20px rgba(118,92,255,0.3);
}

.send-button:disabled {
    opacity: .45;

    cursor: not-allowed;

    transform: none;
}

.input-info {
    max-width: 850px;

    margin:
        7px auto 0;

    text-align: center;

    color: #4f5367;

    font-size: 9px;
}


/* MODAL */

.modal {
    position: fixed;

    inset: 0;

    z-index: 100;

    display: flex;

    align-items: center;
    justify-content: center;

    padding: 20px;
}

.modal.hidden {
    display: none;
}

.modal-background {
    position: absolute;

    inset: 0;

    background:
        rgba(0,0,0,.65);

    backdrop-filter:
        blur(8px);
}

.modal-box {
    position: relative;

    width: 100%;

    max-width: 550px;

    max-height: 80vh;

    overflow: auto;

    background:
        #111326;

    border:
        1px solid var(--border);

    border-radius: 18px;

    box-shadow:
        0 30px 100px rgba(0,0,0,.5);

    padding: 22px;
}

.modal-header {
    display: flex;

    justify-content: space-between;

    align-items: flex-start;

    margin-bottom: 20px;
}

.modal-title {
    font-size: 18px;
    font-weight: 800;
}

.modal-subtitle {
    color: var(--muted);
    font-size: 11px;
    margin-top: 4px;
}

.modal-close {
    width: 32px;
    height: 32px;

    border: 1px solid var(--border);

    border-radius: 8px;

    background:
        rgba(255,255,255,.03);

    color: #aaaec0;

    cursor: pointer;

    font-size: 20px;
}

.modal-close:hover {
    color: white;
}


/* MEMORY */

.memory-list {
    display: flex;

    flex-direction: column;

    gap: 8px;
}

.memory-item {
    padding: 12px;

    border:
        1px solid var(--border);

    border-radius: 10px;

    background:
        rgba(255,255,255,.025);

    color: #c7cad7;

    font-size: 12px;

    line-height: 1.5;
}

.loading {
    color: var(--muted);

    font-size: 12px;

    padding: 20px 0;
}

.modal-actions {
    margin-top: 20px;
}

.danger-button {
    width: 100%;

    padding: 11px;

    border:
        1px solid rgba(255,85,119,.25);

    border-radius: 10px;

    background:
        rgba(255,85,119,.08);

    color:
        #ff7e98;

    cursor: pointer;
}

.danger-button:hover {
    background:
        rgba(255,85,119,.14);
}


/* KNOWLEDGE */

.knowledge-content {
    text-align: center;

    padding:
        30px 10px;
}

.knowledge-icon {
    width: 60px;
    height: 60px;

    display: flex;
    align-items: center;
    justify-content: center;

    margin:
        0 auto 18px;

    border-radius: 18px;

    background:
        rgba(118,92,255,.12);

    color:
        #8d79ff;

    font-size: 25px;
}

.knowledge-content h2 {
    font-size: 19px;

    margin-bottom: 8px;
}

.knowledge-content p {
    color: var(--muted);

    font-size: 12px;

    line-height: 1.6;
}

.knowledge-status {
    display: inline-block;

    margin-top: 20px;

    padding: 8px 12px;

    border-radius: 8px;

    background:
        rgba(56,229,138,.07);

    color:
        #59e99a;

    font-size: 11px;
}


/* RESPONSIVE */

@media (max-width: 800px) {

    .sidebar {
        display: none;
    }

    .mobile-logo {
        display: flex;
    }

    .topbar {
        padding: 0 15px;
    }

    .suggestions {
        grid-template-columns: 1fr;
    }

    .welcome {
        margin-top: 5vh;
    }

    .message-content {
        max-width: 85%;
    }

    .chat {
        padding:
            30px 12px 140px;
    }

    .input-area {
        padding:
            15px 10px 12px;
    }

}