* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --black: #000000;
    --white: #ffffff;
    --grey-50: #fafafa;
    --grey-100: #f2f2f2;
    --grey-200: #e5e5e5;
    --grey-300: #d1d1d1;
    --grey-500: #777777;
    --grey-700: #444444;
}

body {
    font-family:
        Inter,
        Arial,
        Helvetica,
        sans-serif;

    background: var(--grey-100);
    color: var(--black);
    height: 100vh;
    overflow: hidden;
}

button,
input {
    font: inherit;
}

button {
    border: 0;
    background: none;
    cursor: pointer;
}

.app {
    width: 100%;
    height: 100vh;
    display: flex;
    background: var(--white);
}


/* SIDEBAR */

.sidebar {
    width: 380px;
    min-width: 380px;
    height: 100vh;
    border-right: 1px solid var(--grey-200);
    background: var(--white);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    height: 70px;
    padding: 12px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--grey-200);
}

.profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.profile small,
.chat-header-info small {
    display: block;
    color: var(--grey-500);
    margin-top: 3px;
}


/* AVATAR */

.avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--grey-200);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--black);
    flex-shrink: 0;
}


/* BUTTONS */

.icon-button {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 22px;
}

.icon-button:hover {
    background: var(--grey-100);
}


/* SEARCH */

.search-box {
    margin: 12px;
    height: 44px;
    background: var(--grey-100);
    border-radius: 8px;
    display: flex;
    align-items: center;
    padding: 0 14px;
    gap: 10px;
}

.search-box span {
    font-size: 22px;
    color: var(--grey-500);
}

.search-box input {
    width: 100%;
    border: 0;
    outline: none;
    background: transparent;
}


/* CHAT LIST */

.chat-list {
    flex: 1;
    overflow-y: auto;
}

.chat-item {
    padding: 12px 16px;
    display: flex;
    gap: 12px;
    cursor: pointer;
}

.chat-item:hover,
.chat-item.active {
    background: var(--grey-100);
}

.chat-info {
    flex: 1;
    min-width: 0;
}

.chat-top,
.chat-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.chat-top small {
    color: var(--grey-500);
}

.chat-bottom {
    margin-top: 5px;
    color: var(--grey-500);
    font-size: 14px;
}

.chat-bottom span {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.unread {
    min-width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--black);
    color: var(--white);
    font-size: 11px;
    display: grid;
    place-items: center;
}


/* CHAT */

.chat-area {
    flex: 1;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--grey-50);
}

.chat-header {
    height: 70px;
    background: var(--white);
    border-bottom: 1px solid var(--grey-200);
    display: flex;
    align-items: center;
    padding: 10px 18px;
    gap: 12px;
}

.chat-header-info {
    flex: 1;
}

.chat-actions {
    display: flex;
    gap: 4px;
}

.mobile-back {
    display: none;
}


/* MESSAGES */

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 25px 7%;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.message {
    display: flex;
}

.message.received {
    justify-content: flex-start;
}

.message.sent {
    justify-content: flex-end;
}

.bubble {
    max-width: 65%;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--white);
    border: 1px solid var(--grey-200);
    line-height: 1.45;
}

.message.sent .bubble {
    background: var(--black);
    color: var(--white);
    border-color: var(--black);
}

.time {
    display: block;
    text-align: right;
    font-size: 10px;
    margin-top: 4px;
    opacity: .6;
}


/* INPUT */

.message-input {
    min-height: 70px;
    background: var(--white);
    border-top: 1px solid var(--grey-200);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
}

.message-input input {
    flex: 1;
    height: 46px;
    border: 1px solid var(--grey-200);
    border-radius: 24px;
    padding: 0 18px;
    outline: none;
}

.message-input input:focus {
    border-color: var(--grey-500);
}

.send-button {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--black);
    color: var(--white);
    display: grid;
    place-items: center;
}


/* MOBILE */

@media (max-width: 768px) {

    .sidebar {
        width: 100%;
        min-width: 100%;
    }

    .chat-area {
        display: none;
    }

    .app.chat-open .sidebar {
        display: none;
    }

    .app.chat-open .chat-area {
        display: flex;
    }

    .mobile-back {
        display: grid;
        place-items: center;
        width: 40px;
        height: 40px;
        font-size: 22px;
    }

    .messages {
        padding: 20px 12px;
    }

    .bubble {
        max-width: 85%;
    }

    .message-input {
        padding: 8px 10px;
    }

    .chat-header {
        padding: 8px 10px;
    }
}
/* =========================================================
   SEARCH RESULTS
========================================================= */

.search-results {
    display: none;
    max-height: 300px;
    overflow-y: auto;
    border-bottom: 1px solid var(--grey-200);
}

.search-results.show {
    display: block;
}

.search-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
}

.search-user:hover {
    background: var(--grey-100);
}

.search-user-info {
    min-width: 0;
}

.search-user-info strong {
    display: block;
}

.search-user-info small {
    color: var(--grey-500);
}


/* =========================================================
   EMPTY CHAT
========================================================= */

.empty-chats {
    padding: 50px 25px;
    text-align: center;
    color: var(--grey-500);

    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.empty-icon {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    background: var(--grey-100);
    display: grid;
    place-items: center;
    font-size: 22px;
    margin-bottom: 8px;
}

.empty-chats strong {
    color: var(--black);
}


/* =========================================================
   CONVERSATION ITEM
========================================================= */

.chat-item {
    position: relative;
}

.chat-item .avatar {
    position: relative;
}

.online-dot {
    position: absolute;
    right: 0;
    bottom: 2px;

    width: 12px;
    height: 12px;

    background: var(--black);

    border: 2px solid var(--white);
    border-radius: 50%;
}


/* =========================================================
   CHAT WELCOME
========================================================= */

.chat-welcome {
    margin: auto;
    text-align: center;
    color: var(--grey-500);
}

.chat-welcome-icon {
    width: 80px;
    height: 80px;
    background: var(--black);
    color: var(--white);
    border-radius: 50%;

    display: grid;
    place-items: center;

    font-size: 30px;
    font-weight: 800;

    margin: 0 auto 20px;
}

.chat-welcome h2 {
    color: var(--black);
    margin-bottom: 8px;
}

.chat-welcome p {
    font-size: 14px;
}


/* =========================================================
   NO SEARCH RESULT
========================================================= */

.no-search-results {
    padding: 20px;
    text-align: center;
    color: var(--grey-500);
    font-size: 14px;
}


/* =========================================================
   DISABLED INPUT
========================================================= */

.message-input input:disabled {
    background: var(--grey-100);
    cursor: not-allowed;
}

.send-button:disabled {
    opacity: .4;
    cursor: not-allowed;
}
/* =========================================================
   APP NOTIFICATION
========================================================= */

.app-notification {
    position: fixed;

    top: 22px;
    right: 22px;

    z-index: 2000;

    width: min(380px, calc(100vw - 30px));

    min-height: 68px;

    padding: 12px 13px;

    display: flex;
    align-items: center;

    gap: 11px;

    background: #ffffff;

    border: 1px solid #e5e5e5;

    border-radius: 14px;

    box-shadow:
        0 15px 45px rgba(0, 0, 0, 0.16);

    opacity: 0;

    transform:
        translateY(-15px)
        scale(0.97);

    pointer-events: none;

    transition:
        opacity 0.22s ease,
        transform 0.22s ease;
}

.app-notification.show {
    opacity: 1;

    transform:
        translateY(0)
        scale(1);

    pointer-events: auto;
}


/* Icon */

.notification-icon {
    width: 40px;
    height: 40px;

    flex: 0 0 40px;

    border-radius: 11px;

    background: #000000;
    color: #ffffff;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 15px;
    font-weight: 800;
}


/* Content */

.notification-content {
    min-width: 0;

    flex: 1;

    display: flex;
    flex-direction: column;

    gap: 3px;
}

.notification-content strong {
    color: #111111;

    font-size: 13px;
    font-weight: 700;
}

.notification-content span {
    color: #777777;

    font-size: 12px;

    line-height: 1.4;
}


/* Close */

.notification-close {
    width: 30px;
    height: 30px;

    flex: 0 0 30px;

    padding: 0;

    border: 0;
    border-radius: 50%;

    background: transparent;

    color: #999999;

    font-size: 19px;

    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-close:hover {
    background: #f1f1f1;
    color: #000000;
}


/* Mobile */

@media (max-width: 768px) {

    .app-notification {

        top: 14px;
        right: 15px;
        left: 15px;

        width: auto;

        border-radius: 15px;

    }

}
/* =========================================================
   FLOATING BOTTOM NAVIGATION
========================================================= */

.floating-nav {
    position: fixed;

    left: 50%;
    bottom: 18px;

    transform: translateX(-50%);

    width: min(520px, calc(100vw - 30px));
    height: 68px;

    padding: 7px;

    display: grid;
    grid-template-columns: repeat(4, 1fr);
    align-items: center;

    background: rgba(255, 255, 255, 0.96);

    border: 1px solid #e5e5e5;
    border-radius: 22px;

    box-shadow:
        0 12px 35px rgba(0, 0, 0, 0.14);

    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);

    z-index: 1500;
}


/* =========================================================
   NAV ITEM
========================================================= */

.floating-nav-item {
    height: 54px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    gap: 3px;

    color: #888;
    text-decoration: none;

    border-radius: 17px;

    transition:
        background 0.2s ease,
        color 0.2s ease,
        transform 0.2s ease;
}

.floating-nav-item:hover {
    color: #111;
}


/* =========================================================
   ICON
========================================================= */

.floating-nav-icon {
    width: 25px;
    height: 25px;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 17px;

    transition: transform 0.2s ease;
}


/* =========================================================
   LABEL
========================================================= */

.floating-nav-label {
    font-size: 10px;
    font-weight: 600;

    line-height: 1;

    letter-spacing: 0.1px;
}


/* =========================================================
   ACTIVE
========================================================= */

.floating-nav-item.active {
    background: #000;
    color: #fff;
}

.floating-nav-item.active .floating-nav-icon {
    transform: translateY(-1px);
}


/* =========================================================
   HOVER
========================================================= */

.floating-nav-item:not(.active):hover {
    background: #f3f3f3;
}


/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 768px) {

    .floating-nav {
        bottom: 12px;

        width: calc(100vw - 20px);
        height: 64px;

        border-radius: 20px;
    }

    .floating-nav-item {
        height: 50px;
        border-radius: 15px;
    }

    .floating-nav-icon {
        font-size: 16px;
    }

    .floating-nav-label {
        font-size: 9px;
    }
}
/* =========================================================
   FLOATING APP NAVIGATION
========================================================= */

.floating-nav {
    position: fixed;
    left: 50%;
    bottom: 18px;

    transform: translateX(-50%);

    width: min(520px, calc(100vw - 30px));
    height: 68px;

    padding: 7px;

    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;

    background: rgba(255, 255, 255, 0.96);

    border: 1px solid #e5e5e5;
    border-radius: 22px;

    box-shadow:
        0 15px 45px rgba(0, 0, 0, 0.16);

    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);

    z-index: 1500;
}


/* =========================================================
   NAV ITEM
========================================================= */

.floating-nav-item {
    height: 54px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    gap: 4px;

    border-radius: 17px;

    color: #888;
    text-decoration: none;

    transition:
        background 0.2s ease,
        color 0.2s ease,
        transform 0.2s ease;
}

.floating-nav-item:hover {
    background: #f3f3f3;
    color: #000;
}


/* =========================================================
   ICON
========================================================= */

.floating-nav-icon {
    width: 25px;
    height: 25px;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 17px;
}


/* =========================================================
   LABEL
========================================================= */

.floating-nav-label {
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
}


/* =========================================================
   ACTIVE
========================================================= */

.floating-nav-item.active {
    background: #000;
    color: #fff;
}

.floating-nav-item.active:hover {
    background: #000;
    color: #fff;
}


/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 768px) {

    .floating-nav {
        left: 10px;
        right: 10px;
        bottom: 10px;

        transform: none;

        width: auto;
        height: 64px;

        border-radius: 20px;
    }

    .floating-nav-item {
        height: 50px;
        border-radius: 15px;
    }

    .floating-nav-icon {
        font-size: 16px;
    }

    .floating-nav-label {
        font-size: 9px;
    }
}
/* =========================================================
   START CHAT BUTTON
========================================================= */

.start-chat-button {
    position: fixed;
    right: 20px;
    bottom: 105px;
    z-index: 1600;

    width: 58px;
    height: 58px;

    padding: 0;

    border: 0;
    border-radius: 50%;

    background: #000000;
    color: #ffffff;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 30px;
    font-weight: 300;
    line-height: 1;

    cursor: pointer;


    box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.20);

    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        opacity 0.2s ease;
}

.start-chat-button:hover {
    transform: translateY(-3px);

    box-shadow:
        0 15px 35px rgba(0, 0, 0, 0.25);
}

.start-chat-button:active {
    transform: scale(0.94);
}

.start-chat-button:focus-visible {
    outline: 3px solid #777777;
    outline-offset: 3px;
}


/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 768px) {

    .start-chat-button {
        right: 18px;
        bottom: 88px;

        width: 55px;
        height: 55px;

        font-size: 28px;

        z-index: 1600;
    }

}
/* =========================================================
   CHAT OPEN / CLOSED STATE
========================================================= */

/* No chat selected */
.app:not(.chat-open) .message-input {
    display: none;
}

/* Chat is open */
.app.chat-open .message-input {
    display: flex;
}

/* Hide floating navigation when a chat is open */
body:has(.app.chat-open) .floating-nav {
    display: none;
}


/* =========================================================
   CHAT OPEN - COMPOSER POSITION
========================================================= */

.app.chat-open .chat-area {
    position: relative;
}

.app.chat-open .messages {
    padding-bottom: 20px;
}

.app.chat-open .message-input {
    flex-shrink: 0;
    min-height: 70px;
    position: relative;
    z-index: 10;
}


/* =========================================================
   MOBILE CHAT
========================================================= */

@media (max-width: 768px) {

    /* Footer visible on chat list */
    .app:not(.chat-open) + .floating-nav {
        display: grid;
    }

    /* Footer hidden inside conversation */
    body:has(.app.chat-open) .floating-nav {
        display: none;
    }

    .app.chat-open .chat-area {
        height: 100vh;
        height: 100dvh;
    }

    .app.chat-open .messages {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        padding: 15px 12px;
    }

    .app.chat-open .message-input {
        min-height: 62px;
        padding: 7px 10px;
        flex-shrink: 0;
    }

    .app.chat-open .message-input input {
        height: 46px;
    }

    .app.chat-open .send-button {
        width: 46px;
        height: 46px;
    }
}
.conversation-preview-row {
    margin-top: 5px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.conversation-preview-row .conversation-preview {
    margin-top: 0;
    min-width: 0;
    flex: 1;
}

.unread-badge {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    flex: 0 0 auto;

    border-radius: 999px;

    background: #000000;
    color: #ffffff;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    font-size: 10px;
    font-weight: 700;
    line-height: 1;
}