/* =========================================================
   DOCUMIND CHAT
========================================================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --navy-950: #061326;
    --navy-900: #081a33;
    --navy-800: #0d2748;
    --navy-700: #12365f;

    --blue-600: #2563eb;
    --blue-500: #3b82f6;
    --blue-100: #dbeafe;
    --blue-50: #eff6ff;

    --text: #172033;
    --text-light: #526176;
    --muted: #7b8798;

    --border: #e3e8ef;
    --background: #ffffff;
    --background-soft: #f7f9fc;

    --sidebar-width: 275px;
}

html,
body {
    width: 100%;
    height: 100%;
}

body {
    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Arial,
        sans-serif;

    color: var(--text);
    background: white;
}

button,
textarea,
input {
    font: inherit;
}

button {
    border: none;
    cursor: pointer;
}

a {
    text-decoration: none;
    color: inherit;
}


/* =========================================================
   APP
========================================================= */

.app {
    width: 100%;
    height: 100vh;

    display: flex;

    overflow: hidden;
}


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

.sidebar {
    width: var(--sidebar-width);

    flex-shrink: 0;

    display: flex;
    flex-direction: column;

    background: #f8fafc;

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

.sidebar {
    transition: margin-left 0.25s ease;
}


.sidebar.collapsed {
    margin-left: calc(-1 * var(--sidebar-width));
}

/* Expand button - hidden by default, shown when sidebar is collapsed */
.expand-btn {
    position: fixed;
    top: 20px;
    left: 14px;
    z-index: 10;

    width: 28px;
    height: 28px;

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

    border-radius: 6px;

    background: #f8fafc;
    border: 1px solid var(--border);

    color: #7d899a;

    font-size: 15px;

    box-shadow: 0 2px 6px rgba(8, 26, 51, 0.08);

    transition: 0.2s;
}

.expand-btn:hover {
    background: #e9eef5;
    color: var(--navy-900);
}

.expand-btn.visible {
    display: flex;
}



/* Sidebar Header */

.sidebar-header {
    height: 68px;

    padding: 0 17px;

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

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

.logo {
    display: flex;
    align-items: center;
    gap: 9px;

    color: var(--navy-900);

    font-size: 19px;
    font-weight: 800;
}

.logo > span > span {
    color: var(--blue-600);
}

.logo-icon {
    width: 31px;
    height: 31px;

    display: grid;
    place-items: center;

    border-radius: 7px;

    background: var(--navy-900);
    color: white;

    font-size: 14px;
    font-weight: 800;
}

.collapse-btn {
    width: 28px;
    height: 28px;

    display: grid;
    place-items: center;

    border-radius: 6px;

    background: transparent;

    color: #7d899a;

    font-size: 20px;
}

.collapse-btn:hover {
    background: #e9eef5;
}


/* New Chat */

.new-chat-wrapper {
    padding: 15px 14px 10px;
}

.new-chat {
    width: 100%;

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

    gap: 8px;

    padding: 10px 12px;

    border-radius: 7px;

    background: var(--navy-900);

    color: white;

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

    box-shadow: 0 5px 12px rgba(8, 26, 51, 0.12);

    transition: 0.2s;
}

.new-chat:hover {
    background: var(--navy-800);
}

.plus {
    font-size: 17px;
    font-weight: 300;
}


/* Search */

.chat-search {
    position: relative;

    margin: 5px 14px 12px;

    display: flex;
    align-items: center;

    height: 34px;

    padding: 0 9px;

    gap: 7px;

    background: white;

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

    border-radius: 6px;
}

.chat-search > span {
    color: #8995a6;
    font-size: 15px;
}

.chat-search input {
    width: 100%;

    border: none;
    outline: none;

    background: transparent;

    color: var(--text);

    font-size: 10px;
}

.chat-search input::placeholder {
    color: #9aa5b5;
}

.chat-search kbd {
    white-space: nowrap;

    padding: 2px 4px;

    border: 1px solid #dce2e9;

    border-radius: 3px;

    color: #98a3b2;

    background: #f8fafc;

    font-size: 7px;
}


/* Conversations */

.conversations {
    flex: 1;

    overflow-y: auto;

    padding: 3px 9px;
}

.conversation-section {
    margin-bottom: 20px;
}

.section-title {
    padding: 0 9px 7px;

    color: #9aa5b5;

    font-size: 9px;
    font-weight: 700;

    text-transform: uppercase;

    letter-spacing: 0.7px;
}

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

    gap: 8px;

    min-height: 35px;

    padding: 8px 9px;

    margin-bottom: 2px;

    border-radius: 6px;

    color: #617085;

    font-size: 10px;

    transition: 0.15s;
}

.conversation:hover {
    background: #edf2f7;

    color: var(--navy-900);
}

.conversation.active {
    background: #e7effb;

    color: var(--navy-900);

    font-weight: 650;
}

.conversation-icon {
    color: #8794a6;

    font-size: 12px;
}

.conversation.active .conversation-icon {
    color: var(--blue-600);
}

.conversation-name {
    overflow: hidden;

    white-space: nowrap;

    text-overflow: ellipsis;

    flex: 1;
}

.more {
    display: none;

    color: #8490a0;

    font-size: 9px;
}

.conversation:hover .more,
.conversation.active .more {
    display: block;
}


/* Sidebar Bottom */

.sidebar-bottom {
    padding: 9px 11px 11px;

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

.sidebar-link {
    display: flex;
    align-items: center;

    gap: 9px;

    padding: 8px 9px;

    color: #617085;

    border-radius: 6px;

    font-size: 10px;
}

.sidebar-link:hover {
    background: #edf2f7;

    color: var(--navy-900);
}


/* Account */

.account {
    display: flex;
    align-items: center;

    gap: 9px;

    padding: 11px 7px 3px;

    margin-top: 5px;

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

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

    flex-shrink: 0;

    display: grid;
    place-items: center;

    background: var(--navy-900);

    color: white;

    border-radius: 7px;

    font-size: 9px;
    font-weight: 750;
}

.account-info {
    min-width: 0;

    flex: 1;
}

.account-info strong {
    display: block;

    overflow: hidden;

    white-space: nowrap;

    text-overflow: ellipsis;

    color: var(--navy-900);

    font-size: 10px;
}

.account-info span {
    display: block;

    overflow: hidden;

    white-space: nowrap;

    text-overflow: ellipsis;

    color: #8995a6;

    font-size: 8px;

    margin-top: 1px;
}

.account-menu {
    color: #8793a4;

    background: transparent;

    font-size: 12px;

    padding: 5px;
}


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

.chat {
    min-width: 0;

    flex: 1;

    display: flex;
    flex-direction: column;

    background: white;
}


/* Chat Header */

.chat-header {
    height: 68px;

    flex-shrink: 0;

    display: flex;
    align-items: center;

    padding: 0 25px;

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

    background: white;
}

.mobile-logo {
    display: none;
}

.chat-title {
    display: flex;
    align-items: center;

    gap: 10px;
}

.title-icon {
    width: 34px;
    height: 34px;

    display: grid;
    place-items: center;

    background: var(--blue-50);

    color: var(--blue-600);

    border-radius: 7px;

    font-size: 16px;
}

.chat-title strong {
    display: block;

    color: var(--navy-900);

    font-size: 12px;
}

.chat-title span {
    display: block;

    color: #8a96a7;

    font-size: 9px;

    margin-top: 1px;
}

.header-actions {
    margin-left: auto;

    display: flex;
    gap: 5px;
}

.header-btn {
    width: 32px;
    height: 32px;

    display: grid;
    place-items: center;

    border-radius: 6px;

    background: transparent;

    color: #7d899a;

    font-size: 13px;
}

.header-btn:hover {
    background: #f0f3f7;

    color: var(--navy-900);
}


/* =========================================================
   CHAT CONTENT
========================================================= */

.chat-content {
    flex: 1;

    overflow-y: auto;
}

.messages {
    width: min(850px, calc(100% - 50px));

    margin: 0 auto;

    padding: 45px 0 35px;
}


/* Welcome */

.welcome {
    text-align: center;

    margin-bottom: 55px;
}

.welcome-icon {
    width: 48px;
    height: 48px;

    display: grid;
    place-items: center;

    margin: 0 auto 17px;

    background: var(--navy-900);

    color: white;

    border-radius: 11px;

    font-size: 18px;
    font-weight: 800;

    box-shadow:
        0 0 0 7px var(--blue-50),
        0 8px 20px rgba(8, 26, 51, 0.12);
}

.welcome h1 {
    color: var(--navy-900);

    font-size: 24px;

    letter-spacing: -0.5px;

    margin-bottom: 8px;
}

.welcome p {
    max-width: 450px;

    margin: 0 auto;

    color: #788598;

    font-size: 12px;

    line-height: 1.7;
}


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

.message-row {
    display: flex;

    margin-bottom: 30px;
}

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

.message {
    max-width: 70%;

    padding: 12px 15px;

    border-radius: 10px;

    font-size: 12px;

    line-height: 1.7;
}

.user-message {
    background: var(--navy-900);

    color: white;

    border-bottom-right-radius: 3px;
}

.assistant-row {
    align-items: flex-start;

    gap: 11px;
}

.assistant-avatar {
    width: 29px;
    height: 29px;

    flex-shrink: 0;

    display: grid;
    place-items: center;

    border-radius: 7px;

    background: var(--navy-900);

    color: white;

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

.assistant-content {
    max-width: 690px;

    min-width: 0;
}

.assistant-name {
    color: var(--navy-900);

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

    margin: 4px 0 8px;
}

.assistant-message {
    color: #48566a;

    font-size: 12px;

    line-height: 1.8;
}

.assistant-message p {
    margin-bottom: 12px;
}

.assistant-message p:last-child {
    margin-bottom: 0;
}

.assistant-message ol {
    padding-left: 20px;

    margin: 7px 0 13px;
}

.assistant-message li {
    margin-bottom: 5px;
}


/* Sources */

.sources {
    margin-top: 20px;

    padding: 11px;

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

    border-radius: 7px;

    background: #fbfcfe;
}

.sources-header {
    display: flex;
    align-items: center;

    gap: 6px;

    color: var(--navy-900);

    font-size: 9px;
    font-weight: 700;

    margin-bottom: 9px;
}

.sources-header span {
    color: var(--blue-600);

    font-size: 13px;
}

.source {
    display: flex;
    align-items: center;

    gap: 9px;

    padding: 8px;

    border: 1px solid #e6ebf1;

    border-radius: 5px;

    background: white;
}

.source-icon {
    width: 27px;
    height: 30px;

    display: grid;
    place-items: center;

    background: #fef2f2;

    color: #dc2626;

    border-radius: 4px;

    font-size: 7px;
    font-weight: 800;
}

.source strong {
    display: block;

    color: var(--navy-900);

    font-size: 9px;
}

.source span {
    display: block;

    color: #8995a6;

    font-size: 8px;
}


/* Message Actions */

.message-actions {
    display: flex;

    gap: 2px;

    margin-top: 7px;
}

.message-actions button {
    width: 27px;
    height: 27px;

    display: grid;
    place-items: center;

    border-radius: 5px;

    background: transparent;

    color: #9aa5b5;

    font-size: 12px;
}

.message-actions button:hover {
    background: #f0f3f7;

    color: var(--navy-900);
}


/* Typing */

.typing-message {
    display: flex;
    align-items: center;

    gap: 4px;

    width: fit-content;

    padding: 13px 15px;

    background: #f3f6fa;

    border-radius: 8px;

    border-bottom-left-radius: 2px;
}

.typing-message span {
    width: 5px;
    height: 5px;

    background: #8d9aab;

    border-radius: 50%;
}

.typing-message span:nth-child(2) {
    animation: typing 1.2s infinite 0.2s;
}

.typing-message span:nth-child(3) {
    animation: typing 1.2s infinite 0.4s;
}

@keyframes typing {
    0%,
    100% {
        opacity: 0.35;
    }

    50% {
        opacity: 1;
    }
}


/* =========================================================
   INPUT
========================================================= */

.input-area {
    flex-shrink: 0;

    width: min(850px, calc(100% - 50px));

    margin: 0 auto;

    padding-bottom: 16px;
}

.input-container {
    border: 1px solid #cfd8e4;

    border-radius: 11px;

    background: white;

    box-shadow:
        0 5px 20px rgba(8, 26, 51, 0.06);

    overflow: hidden;
}

.attached-document {
    display: flex;
    align-items: center;

    gap: 8px;

    width: fit-content;

    margin: 10px 12px 0;

    padding: 6px 8px;

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

    border-radius: 6px;

    background: #f8fafc;
}

.attached-icon {
    width: 24px;
    height: 26px;

    display: grid;
    place-items: center;

    background: #fef2f2;

    color: #dc2626;

    border-radius: 4px;

    font-size: 6px;
    font-weight: 800;
}

.attached-document strong {
    display: block;

    color: var(--navy-900);

    font-size: 8px;
}

.attached-document span {
    display: block;

    color: #8995a6;

    font-size: 7px;
}

.attached-document button {
    margin-left: 5px;

    color: #8995a6;

    background: transparent;

    font-size: 15px;
}

.input-container textarea {
    display: block;

    width: 100%;

    min-height: 55px;
    max-height: 180px;

    padding: 16px 15px 8px;

    resize: none;

    outline: none;

    border: none;

    background: transparent;

    color: var(--text);

    font-size: 12px;

    line-height: 1.6;
}

.input-container textarea::placeholder {
    color: #9ba6b5;
}

.input-bottom {
    height: 43px;

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

    padding: 0 9px 8px 10px;
}

.input-tools {
    display: flex;
    align-items: center;

    gap: 4px;
}

.input-tools button {
    width: 28px;
    height: 28px;

    display: grid;
    place-items: center;

    border-radius: 5px;

    background: transparent;

    color: #7e8a9b;

    font-size: 15px;
}

.input-tools button:hover {
    background: #f1f4f8;

    color: var(--navy-900);
}

.tool-label {
    color: #8b97a7;

    font-size: 8px;

    margin-left: 2px;
}

.send-area {
    display: flex;
    align-items: center;

    gap: 9px;
}

.send-area > span {
    color: #9aa5b5;

    font-size: 8px;
}

.send-btn {
    width: 29px;
    height: 29px;

    display: grid;
    place-items: center;

    border-radius: 6px;

    background: var(--navy-900);

    color: white;

    font-size: 15px;

    transition: 0.2s;
}

.send-btn:hover {
    background: var(--blue-600);

    transform: translateY(-1px);
}

.disclaimer {
    text-align: center;

    color: #9aa5b5;

    font-size: 8px;

    margin-top: 8px;
}


/* =========================================================
   SCROLLBAR
========================================================= */

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #d6dde6;

    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #b9c4d2;
}


/* =========================================================
   RESPONSIVE
========================================================= */

@media (max-width: 850px) {

    :root {
        --sidebar-width: 235px;
    }

    .messages,
    .input-area {
        width: calc(100% - 35px);
    }

    .message {
        max-width: 80%;
    }

    .chat-header {
        padding: 0 17px;
    }
}


@media (max-width: 700px) {

    .sidebar {
        display: none;
    }

    .mobile-logo {
        display: flex;
        align-items: center;

        gap: 8px;

        color: var(--navy-900);

        font-size: 13px;
    }

    .mobile-logo .logo-icon {
        width: 28px;
        height: 28px;

        font-size: 12px;
    }

    .chat-title {
        margin-left: 18px;
    }

    .chat-title .title-icon {
        display: none;
    }

    .header-actions .header-btn:nth-child(1) {
        display: none;
    }

    .messages,
    .input-area {
        width: calc(100% - 28px);
    }

    .messages {
        padding-top: 30px;
    }

    .welcome {
        margin-bottom: 40px;
    }

    .welcome h1 {
        font-size: 21px;
    }

    .message {
        max-width: 88%;
    }

    .input-area {
        padding-bottom: 10px;
    }

    .send-area > span {
        display: none;
    }
}


@media (max-width: 450px) {

    .chat-header {
        height: 60px;
    }

    .chat-title strong {
        max-width: 130px;

        overflow: hidden;

        text-overflow: ellipsis;

        white-space: nowrap;
    }

    .header-actions {
        gap: 0;
    }

    .messages,
    .input-area {
        width: calc(100% - 20px);
    }

    .message {
        max-width: 92%;
    }

    .assistant-content {
        max-width: calc(100% - 40px);
    }

    .attached-document {
        max-width: calc(100% - 20px);
    }

    .attached-document strong {
        max-width: 150px;

        overflow: hidden;

        text-overflow: ellipsis;

        white-space: nowrap;
    }
}


/* Code written by AI */
.assistant-message pre {
    background: #f3f6fa;
    padding: 10px 12px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 8px 0;
    font-size: 11px;
}

.assistant-message code {
    background: #f0f3f7;
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 11px;
}

.assistant-message pre code {
    background: transparent;
    padding: 0;
}

.assistant-message ul,
.assistant-message ol {
    padding-left: 20px;
    margin: 8px 0;
}

.assistant-message a {
    color: var(--blue-600);
    text-decoration: underline;
}

.no-conversations {
    padding: 14px 9px;

    color: #9aa5b5;

    font-size: 10px;

    line-height: 1.6;

    text-align: center;
}



.attached-pill {
    display: flex;
    align-items: center;

    gap: 10px;

    width: fit-content;

    margin: 10px 12px 0;
    padding: 8px 12px;

    background: var(--navy-900);

    border-radius: 20px;
}

.attached-pill-inline {
    margin: 0;
    margin-bottom: 4px;
}

.attached-pill-icon {
    display: grid;
    place-items: center;

    color: #ef4444;
}

.attached-pill-text {
    min-width: 0;
}

.attached-pill-text strong {
    display: block;

    max-width: 220px;

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

    color: white;

    font-size: 11px;
    font-weight: 650;
}

.attached-pill-text span {
    display: block;

    color: #9aa5b5;

    font-size: 9px;

    margin-top: 1px;
}

.attached-pill-remove {
    margin-left: 4px;

    color: #8995a6;

    background: transparent;

    font-size: 15px;

    line-height: 1;
}

.attached-pill-remove:hover {
    color: white;
}

.attached-pill-spinner {
    width: 14px;
    height: 14px;

    border: 2px solid #4b5568;
    border-top-color: #ef4444;

    border-radius: 50%;

    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}