/* ============================================================
   GLOBAL
   ============================================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    background: #ffffff;
    color: #111111;
    overflow: hidden;
}

button,
textarea {
    font-family: inherit;
}


/* ============================================================
   MAIN APP
   ============================================================ */

.app {
    width: 100%;
    height: 100vh;

    display: flex;

    background: #ffffff;
}


/* ============================================================
   SIDEBAR
   ============================================================ */

.sidebar {
    width: 290px;
    height: 100vh;

    display: flex;
    flex-direction: column;

    background: #eef7fc;
    border-right: 1px solid #e3e6e8;

    flex-shrink: 0;

    overflow: hidden;
}


/* ============================================================
   SIDEBAR HEADER
   ============================================================ */

.sidebar-header {
    height: 72px;

    display: flex;
    align-items: center;

    padding: 0 18px;

    gap: 12px;

    border-bottom: 1px solid #e5e7e9;

    flex-shrink: 0;
}


/* ============================================================
   BRAND
   ============================================================ */

.brand {
    display: flex;
    align-items: center;

    gap: 10px;

    min-width: 0;
}

.brand-logo {
    width: 36px;
    height: 36px;
    object-fit: contain;
    flex-shrink: 0;
}

.brand h1 {
    font-size: 20px;
    font-weight: 700;

    white-space: nowrap;
}


/* ============================================================
   ICON BUTTON
   ============================================================ */

.icon-button {
    width: 34px;
    height: 34px;

    border: none;
    background: transparent;

    border-radius: 8px;

    cursor: pointer;

    font-size: 19px;

    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-button:hover {
    background: #e9edf0;
}


/* ============================================================
   SIDEBAR NAVIGATION
   ============================================================ */

.sidebar-nav {
    padding: 14px 12px 8px;
}

.nav-item {
    width: 100%;

    min-height: 40px;

    display: flex;
    align-items: center;

    gap: 11px;

    padding: 8px 11px;

    margin-bottom: 3px;

    border: none;
    border-radius: 8px;

    background: transparent;

    color: #222222;

    font-size: 14px;

    text-align: left;

    cursor: pointer;
}

.nav-item:hover {
    background: #e9edf0;
}

.nav-item.active {
    background: #e1e9ef;
    font-weight: 600;
}

.nav-icon {
    width: 20px;

    display: flex;
    justify-content: center;

    font-size: 16px;

    flex-shrink: 0;
}

.agent-item {
    margin-top: 7px;

    color: #a47b12;

    font-weight: 600;

    letter-spacing: 0.3px;

    background: transparent;
}

.agent-item:hover {
    background: #f0ead8;
}


/* ============================================================
   CONVERSATIONS
   ============================================================ */

.conversation-section {
    flex: 1;

    min-height: 0;

    overflow-y: auto;

    padding: 10px 12px;
}

.section-title {
    padding: 10px 8px 7px;

    color: #737b82;

    font-size: 11px;
    font-weight: 700;

    letter-spacing: 0.7px;
}

.recent-title {
    margin-top: 12px;

    border-top: 1px solid #e1e4e6;
}


.conversation-list {
    display: flex;
    flex-direction: column;

    gap: 2px;
}


.conversation-item {
    width: 100%;

    display: flex;
    flex-direction: column;

    align-items: flex-start;

    gap: 4px;

    padding: 9px 9px;

    border: none;
    border-radius: 8px;

    background: transparent;

    cursor: pointer;

    text-align: left;
}

.conversation-item:hover {
    background: #e9edf0;
}

.conversation-title {
    width: 100%;

    overflow: hidden;

    text-overflow: ellipsis;

    white-space: nowrap;

    font-size: 13px;
    font-weight: 600;

    color: #202428;
}

.conversation-meta {
    font-size: 11px;

    color: #7d858c;
}


/* ============================================================
   SIDEBAR FOOTER
   ============================================================ */

.sidebar-footer {
    padding: 8px 12px 14px;

    border-top: 1px solid #e3e6e8;

    flex-shrink: 0;
}


/* ============================================================
   MAIN CONTENT
   ============================================================ */

.main-content {
    flex: 1;

    min-width: 0;
    min-height: 0;

    height: 100vh;

    display: flex;
    flex-direction: column;

    background: #ffffff;
}


/* ============================================================
   CONVERSATION HEADER
   ============================================================ */

.conversation-header {
    height: 72px;

    display: flex;
    align-items: center;

    padding: 0 28px;

    border-bottom: 1px solid #e5e7e9;

    flex-shrink: 0;
}

.conversation-header h2 {
    font-size: 16px;
    font-weight: 600;

    color: #222222;
}


/* ============================================================
   CHAT MESSAGES
   ============================================================ */

.chat-messages {
    flex: 1;

    min-height: 0;

    overflow-y: auto;

    padding: 36px 7% 150px;

    display: flex;
    flex-direction: column;

    gap: 24px;
}


/* ============================================================
   MESSAGE
   ============================================================ */

.message {
    display: flex;

    width: 100%;

    min-width: 0;
}

.message.assistant {
    justify-content: flex-start;
}

.message.user {
    justify-content: flex-end;
}


/* ============================================================
   ASSISTANT AVATAR
   ============================================================ */

.message-avatar {
    width: 34px;
    height: 34px;

    margin-right: 11px;

    border-radius: 50%;

    background: #e8f1f7;

    color: #1671a8;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 14px;
    font-weight: 700;

    flex-shrink: 0;
}


/* ============================================================
   MESSAGE CONTENT
   ============================================================ */

.message-content {
    max-width: min(760px, 78%);

    min-width: 0;

    line-height: 1.55;

    font-size: 15px;

    overflow-wrap: break-word;
    word-break: break-word;
}


/* ============================================================
   MESSAGE AUTHOR
   ============================================================ */

.message-author {
    margin-bottom: 5px;

    font-size: 14px;
    font-weight: 700;

    color: #202428;
}


/* ============================================================
   MESSAGE TEXT
   ============================================================ */

.message-text {
    white-space: pre-wrap;

    overflow-x: auto;

    overflow-wrap: break-word;
    word-break: break-word;
}


/* ============================================================
   USER MESSAGE
   ============================================================ */

.message.user .message-content {
    max-width: min(700px, 75%);

    padding: 12px 16px;

    border-radius: 14px 14px 4px 14px;

    background: #287fbd;

    color: #ffffff;
}


/* ============================================================
   ASSISTANT MESSAGE
   ============================================================ */

.message.assistant .message-content {
    padding: 2px 0;

    color: #17191b;
}


/* ============================================================
   INPUT AREA
   ============================================================ */

.chat-input-area {
    width: 100%;

    padding: 12px 7% 18px;

    background: #ffffff;

    flex-shrink: 0;
}


/* ============================================================
   FORM
   ============================================================ */

.chat-form {
    width: 100%;
}


/* ============================================================
   FILE PREVIEW
   ============================================================ */

.file-preview {
    display: flex;

    flex-wrap: wrap;

    gap: 8px;

    margin-bottom: 8px;
}


/* ============================================================
   COMPOSER
   ============================================================ */

.composer {
    width: 100%;

    min-height: 58px;

    display: flex;
    align-items: center;

    gap: 7px;

    padding: 7px 8px;

    border: 1px solid #bfcbd3;

    border-radius: 18px;

    background: #ffffff;

    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}


/* ============================================================
   TEXTAREA
   ============================================================ */

#message-input {
    flex: 1;

    width: 100%;

    min-width: 0;

    min-height: 42px;
    max-height: 220px;

    padding: 11px 7px;

    border: none;
    outline: none;

    resize: none;

    background: transparent;

    color: #17191b;

    font-size: 14px;

    line-height: 1.45;

    overflow-y: auto;

    white-space: pre-wrap;

    overflow-wrap: break-word;
}

#message-input::placeholder {
    color: #858d93;
}


/* ============================================================
   COMPOSER BUTTONS
   ============================================================ */

.composer-button {
    width: 38px;
    height: 38px;

    border: none;

    border-radius: 50%;

    background: transparent;

    color: #333b40;

    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: center;

    flex-shrink: 0;

    font-size: 17px;
}

.composer-button:hover {
    background: #edf1f3;
}


/* ============================================================
   SEND BUTTON
   ============================================================ */

.send-button {
    min-width: 76px;
    height: 40px;

    padding: 0 14px;

    display: flex;
    align-items: center;
    justify-content: center;

    gap: 6px;

    border: none;

    border-radius: 20px;

    background: #287fbd;

    color: #ffffff;

    cursor: pointer;

    font-size: 13px;
    font-weight: 600;

    flex-shrink: 0;
}

.send-button:hover {
    background: #216d9f;
}

.send-button:disabled {
    opacity: 0.55;

    cursor: not-allowed;
}


/* ============================================================
   INPUT DISCLAIMER
   ============================================================ */

.input-disclaimer {
    padding-top: 8px;

    text-align: center;

    color: #858d93;

    font-size: 10px;
}


/* ============================================================
   SCROLLBARS
   ============================================================ */

.sidebar::-webkit-scrollbar,
.conversation-section::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar,
#message-input::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-thumb,
.conversation-section::-webkit-scrollbar-thumb,
.chat-messages::-webkit-scrollbar-thumb,
#message-input::-webkit-scrollbar-thumb {
    background: #cbd1d5;

    border-radius: 10px;
}


/* ============================================================
   MOBILE
   ============================================================ */

@media (max-width: 800px) {

    .sidebar {
        width: 240px;
    }

    .chat-messages {
        padding-left: 5%;
        padding-right: 5%;
    }

    .chat-input-area {
        padding-left: 5%;
        padding-right: 5%;
    }

}


@media (max-width: 600px) {

    .sidebar {
        width: 72px;
    }

    .sidebar-header {
        justify-content: center;

        padding: 0 10px;
    }

    .sidebar-header .brand-text,
    .sidebar-nav .nav-item span:not(.nav-icon),
    .conversation-section,
    .sidebar-footer .nav-item span:not(.nav-icon) {
        display: none;
    }

    .sidebar-header .icon-button {
        display: none;
    }

    .sidebar-header .brand {
        justify-content: center;
    }

    .sidebar-nav {
        padding-left: 10px;
        padding-right: 10px;
    }

    .nav-item {
        justify-content: center;

        padding-left: 0;
        padding-right: 0;
    }

    .sidebar-footer {
        padding-left: 10px;
        padding-right: 10px;
    }

    .conversation-header {
        height: 60px;

        padding: 0 18px;
    }

    .chat-messages {
        padding: 24px 16px 130px;
    }

    .message-content {
        max-width: 85%;
    }

    .message.user .message-content {
        max-width: 85%;
    }

    .chat-input-area {
        padding: 10px 12px 14px;
    }

    .composer {
        border-radius: 16px;
    }

    .send-button {
        min-width: 42px;

        width: 42px;

        padding: 0;

        border-radius: 50%;
    }

    .send-button span:last-child {
        display: none;
    }

    .input-disclaimer {
        font-size: 9px;
    }

}
/* ============================================================
   AUTHENTICATION SCREEN
   ============================================================ */

.auth-screen {
    position: fixed;
    inset: 0;
    z-index: 9999;

    display: flex;
    align-items: center;
    justify-content: center;

    background: #eef7fc;
}


.auth-card {
    width: min(420px, calc(100% - 40px));

    padding: 36px;

    background: #ffffff;

    border: 1px solid #dceaf2;
    border-radius: 20px;

    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.08);

    text-align: center;
}


.auth-logo {
    width: 64px;
    height: 64px;

    object-fit: contain;

    margin-bottom: 18px;
}


.auth-card h1 {
    margin: 0;

    font-size: 24px;
    color: #111827;
}


.auth-subtitle {
    margin: 8px 0 24px;

    color: #6b7280;
    font-size: 14px;
}


.google-login-button,
.email-auth-button {
    width: 100%;
    height: 46px;

    border: none;
    border-radius: 10px;

    cursor: pointer;

    font-size: 14px;
    font-weight: 600;
}


.google-login-button {
    background: #ffffff;

    border: 1px solid #d1d5db;

    color: #111827;
}


.google-login-button span {
    margin-right: 8px;

    font-weight: 700;
    font-size: 17px;
}


.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;

    margin: 22px 0;

    color: #9ca3af;

    font-size: 13px;
}


.auth-divider::before,
.auth-divider::after {
    content: "";

    flex: 1;

    height: 1px;

    background: #e5e7eb;
}


#email-auth-form {
    display: flex;
    flex-direction: column;

    gap: 10px;
}


#email-auth-form input {
    width: 100%;
    height: 46px;

    padding: 0 14px;

    border: 1px solid #d1d5db;
    border-radius: 10px;

    outline: none;

    font-size: 14px;
}


#email-auth-form input:focus {
    border-color: #287fbd;
}


.email-auth-button {
    margin-top: 4px;

    background: #287fbd;

    color: #ffffff;
}


.auth-mode-button {
    margin-top: 18px;

    border: none;
    background: transparent;

    color: #287fbd;

    cursor: pointer;

    font-size: 13px;
}


.auth-error {
    min-height: 18px;

    margin-top: 14px;

    color: #dc2626;

    font-size: 12px;
}