:root {
    --chat-bg-main: #f4f7fa;
    --sidebar-bg: #ffffff;
    --chat-body-bg: #f8fafc;
    --primary-gradient: linear-gradient(135deg, #CC4017 0%, #b41f55 100%);
    --text-dark: #0f172a;
    --text-muted: #64748b;
    --border-color: #f1f5f9;
    --radius-msg: 16px;
    --theme-primary: #CC4017;
    --theme-light: #fee9f0;
}

.chat-wrapper {
    height: calc(100vh - 120px);
    background: #ffffff;
    overflow: hidden;
    border-radius: 24px;
    box-shadow: 0 20px 40px -15px rgba(15, 23, 42, 0.08);
    border: 1px solid rgba(226, 232, 240, 0.8);
}

.chat-view {
    height: 100%;
}

.chat-sidebar {
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.chat-sidebar-header {
    padding: 16px;
}

.chat-sidebar-header h4 {
    font-weight: 700;
    color: var(--text-dark);
    font-size: 20px;
    letter-spacing: -0.5px;
}

.chat-search {
    padding: 0 20px 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.chat-search .input-group-text {
    background-color: #f8fafc;
    border-right: none;
    border-radius: 12px 0 0 12px;
    color: var(--text-muted);
    border-color: #e2e8f0;
}

.chat-search .form-control {
    border-radius: 0 12px 12px 0;
    padding: 12px 16px 12px 0;
    border-left: none;
    border-color: #e2e8f0;
    background-color: #f8fafc;
    font-size: 14px;
    font-weight: 500;
}

.chat-search .form-control:focus {
    background-color: #fff;
    box-shadow: none;
    border-color: #e2e8f0;
}

.chat-users-list {
    overflow-y: auto;
    flex: 1;
    padding: 10px;
    scrollbar-width: none;
    -ms-overflow-style: none;

}

.chat-users-list::-webkit-scrollbar {
    display: none;
}

.chat-body::-webkit-scrollbar {
    display: none;
}

.chat-user {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px;
    border-radius: 16px;
    margin-bottom: 4px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.chat-user:hover {
    background: #f8fafc;
}

.chat-user.active {
    background: var(--theme-light);
}

.chat-user.active .chat-user-name {
    color: var(--theme-primary);
}

.avatar-container {
    position: relative;
}

.chat-user img,
.chat-header img {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    object-fit: cover;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.unread-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--theme-primary);
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 6px rgba(128, 14, 51, 0.4);
    z-index: 2;
}

.chat-user.active .unread-badge {
    border-color: var(--theme-light);
}

.chat-user-info {
    flex: 1;
    min-width: 0;
}

.chat-user-meta {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 4px;
}

.chat-user-name {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 17px;
}

.chat-user-time {
    font-size: 13px;
    color: var(--text-muted);
}

.chat-user-msg-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-user-msg {
    font-size: 15px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    margin-right: 8px;
}

.unread-badge-inline {
    background: var(--theme-primary);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-box {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--chat-body-bg);
}

.chat-header {
    background: #ffffff;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 10;
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.02);
}

.chat-header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.chat-header .user-meta h5 {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 2px;
}

.chat-header .user-status {
    font-size: 12px;
    color: #10b981;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 5px;
}

.chat-header .user-status::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background-color: #10b981;
    border-radius: 50%;
}

.chat-header-actions .btn-action {
    background: #fff1f5;
    border: 1px solid var(--theme-primary);
    color: var(--theme-primary);
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 35px;
    line-height: 1;
    transition: all .25s ease;
}

.chat-header-actions .btn-action i {
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.chat-header-actions .btn-action span {
    display: flex;
    align-items: center;
    line-height: 1;
}

.chat-header-actions .btn-action:hover {
    background: var(--theme-primary);
    color: #fff;
    border-color: var(--theme-primary);
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(128, 14, 51, 0.25);
}

.chat-body {
    flex: 1;
    padding: 28px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    background:
        linear-gradient(rgba(255, 255, 255, .75),
            rgba(255, 255, 255, .75)),
        url('/assets/img/chat-bg.jpg');

    scrollbar-width: none;
    -ms-overflow-style: none;

    background-size: 280px;
    background-repeat: repeat;
}

.message-group {
    display: flex;
    flex-direction: column;
    max-width: 65%;
    position: relative;
}

.message-group.received {
    margin-right: auto;
    align-items: flex-start;
}

.message-group.sent {
    margin-left: auto;
    align-items: flex-end;
}

.message {
    padding: 12px 18px;
    font-size: 14.5px;
    line-height: 1.5;
    box-shadow: 0 2px 4px rgba(15, 23, 42, 0.02);
    font-weight: 500;
}

.message-left {
    background: #ffffff;
    color: #334155;
    border-radius: 4px var(--radius-msg) var(--radius-msg) var(--radius-msg);
    border: 1px solid rgba(226, 232, 240, 0.6);
}

.message-right {
    background: var(--primary-gradient);
    color: #ffffff;
    border-radius: var(--radius-msg) 4px var(--radius-msg) var(--radius-msg);
}

.message-time {
    font-size: 11px;
    color: #202020;
    margin-top: 4px;
    display: block;
    padding: 0 4px;
}

.sent .message-time {
    text-align: right;
}

.chat-footer {
    background: #ffffff;
    padding: 18px 24px;
    border-top: 1px solid var(--border-color);
}

.chat-input-wrapper {
    background: #f8fafc;
    border-radius: 16px;
    padding: 6px 18px;
    border: 1px solid #e2e8f0;
    transition: all .2s ease;
}

/* .chat-input-wrapper:focus-within {
    background: #fff;
    border-color: var(--theme-primary);
    box-shadow: 0 0 0 4px rgba(128, 14, 51, 0.1);
} */

.chat-footer .form-control {
    border: none;
    background: transparent;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-dark);
    padding: 10px 0;
}

.chat-footer .form-control:focus {
    box-shadow: none;
    background: transparent;
}

.send-btn {
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 14px;
    background: var(--primary-gradient);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(128, 14, 51, 0.3);
    flex-shrink: 0;
}

.profile-count-box {
    background: #fff;
    padding: 6px 14px;
    border-radius: 12px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.profile-count-box i {
    color: #CC4017;
}

.profile-count-box span {
    color: #CC4017;
    font-weight: 600;
}

@media (min-width: 360px) and (max-width: 420px) {

    .chat-body {
        height: 63vh;
        flex: unset;
        padding: 12px;

        background-repeat: no-repeat;
        background-size: cover;
        background-position: center;
    }

    .chat-box {
        height: 100%;
        background: none;
    }

    .chat-wrapper {
        height: 50px;
    }

    .chat-view {
        height: 50%;
    }

    .chat-user img {
        width: 42px;
        height: 42px;
    }

    .chat-user-name {
        font-size: 14px;
    }

    .chat-user-msg {
        font-size: 12px;
    }

    .chat-header .user-meta h5 {
        font-size: 15px;
    }

    .chat-header {
        padding: 10px 12px;
    }

    .chat-footer {
        padding: 10px 12px;
    }

    .send-btn {
        width: 50px;
        height: 50px;
    }

    .send-btn i {
        font-size: 18px;
    }

    .chat-body {
        padding: 12px;
    }

    .message-group {
        max-width: 85%;
    }

    .chat-search {
        padding: 0 10px 10px 10px;
    }

    .chat-user {
        padding: 10px;
        gap: 10px;
    }

    .chat-header-actions .btn-action {
        padding: 8px 12px;
        font-size: 12px;
        border-radius: 10px;
        gap: 5px;
    }

    .chat-header-actions .btn-action i {
        font-size: 12px;
    }
}

@media (min-width: 992px) and (max-width: 1199px) {

    .chat-user img {
        width: 48px;
        height: 48px;
    }

    .chat-user-name {
        font-size: 15px;
    }

    .chat-user-msg {
        font-size: 13px;
    }

    .chat-header .user-meta h5 {
        font-size: 18px;
    }

    .chat-header {
        padding: 12px 16px;
    }

    .chat-footer {
        padding: 14px 16px;
    }

    .send-btn {
        width: 44px;
        height: 44px;
    }
}

@media(max-width:991px) {

    .chat-wrapper {
        height: 100vh;
        border-radius: 0;
    }

    .chat-sidebar,
    .chat-view {
        width: 100%;
        height: 100%;
    }

    .chat-view {
        display: none;
    }

    .chat-wrapper.show-chat .chat-sidebar {
        display: none;
    }

    .chat-wrapper.show-chat .chat-view {
        display: flex;
        flex-direction: column;
    }
}
