.tg_wrapper {
    display: flex;
    flex-direction: column;
    font-family: 'Inter', sans-serif;
    overflow: hidden;
    border-radius: 8px;
    color: #212121;
    font-size: 16px;
    outline: 1px solid #00000033; /* 3px solid green outline */
    outline-offset: -1px; /* Pulls the outline inside by 3px */

    --tg-color-primary: #24A1DE;
}

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

.tg_header {
    background: var(--tg-color-primary);
    height: 50px;
    padding: 0 16px;
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    color: #fff;
}
.tg_header > * {
    display: flex;
    align-items: center;
}

.tg_header h2 {
    border: none;
    font-size: 20px;
    font-weight: 700;
}
.tg_header-left img {
    height: 20px;
    margin-right: 8px;
}

.tg_header-user {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    user-select: none;
    cursor: pointer;
    border-radius: 8px;
    padding: 8px 10px;
    margin-right: -10px;
}
.tg_header-user:hover {
    background: #0002;
}
.tg_header-user img {
    height: 24px;
    width: 24px;
    border-radius: 50%;
}
.tg_header-user::after {
    content: '🢓';
    height: 12px;
}



.tg_chat-navbar {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    background: #fff;
}

.tg_chat-navbar-icon {
    height: 42px;
    width: 42px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 12px;
}

.tg_chat-navbar-info h4 {
    font-weight: 600;
}
.tg_chat-navbar-info p {
    color: #999;
}

.tg_chat-box {
    position: relative;
    background: linear-gradient(135deg, #f2f7ae, #a8de9a);
    min-height: 600px;
    z-index: -1;
}
.tg_chat-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('/assets/tg_bg_01.png');
    opacity: 0.1;
    background-size: 400px;
}
.tg_chat-box-inner {
    position: relative;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 10px 16px;
    overflow-y: auto;
}

.tg_message-wrapper {
    display: flex;
    align-items: flex-end;
    margin-bottom: 6px;
}
.tg_message-wrapper.b {
    margin-bottom: 12px;
}

.tg_message {
    background: #fff;
    padding: 8px 12px;
    width: fit-content;
    max-width: 90%;
    display: flex;
    flex-direction: column;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    position: relative;
    
    border-top-left-radius: 4px;
    border-bottom-left-radius: 4px;
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
}
.tg_message.t {
    border-top-left-radius: 8px !important;
    border-bottom-left-radius: 4px;
    border-top-right-radius: 8px !important;
    border-bottom-right-radius: 8px;
}
.tg_message.b {
    border-top-left-radius: 4px;
    border-bottom-left-radius: 0px !important;
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px !important;
}

.tg_message.sticker {
    background: none;
    box-shadow: none;
    filter: drop-shadow(0 1px 2px rgba(4, 100, 40, 0.2));
}
.tg_message.sticker .tg_message-image {
    max-height: 200px;
}
.tg_message.sticker .tg_message-bottom {
    position: absolute;
    bottom: 0;
    right: 0;
}
.tg_message.sticker .tg_message-info {
    color: #45a32d;
}

.tg_message-wrapper.self {
    justify-content: flex-end;
}
.tg_message.self {
    background: #effdde;
    --tg-color-primary: #45a32d;
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
}

.tg_message.self.t {
    border-top-left-radius: 8px !important;
    border-bottom-left-radius: 8px;
    border-top-right-radius: 8px !important;
    border-bottom-right-radius: 4px;
}
.tg_message.self.b {
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px !important;
    border-top-right-radius: 4px;
    border-bottom-right-radius: 0px !important;
}

.tg_message-avatar-wrapper {
    margin-right: 8px;
    width: 42px;
    position: relative;
}
.tg_message-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    position: absolute;
    bottom: 0;
}

.tg_message-author {
    font-weight: 600;
    color: var(--tg-color-primary);
}
.nat .tg_message-author {
    color: #e73a12;
}

.tg_message-text {
    font-weight: 400;
    position: relative;
}

.tg_message-bottom {
    margin-top: 4px;
    display: flex;
}
.tg_message-info {
    font-size: 12px;
    color: #999;
    display: flex;
    width: 100%;
    justify-content: flex-end;
    align-items: flex-end;
    gap: 8px;
}
.self .tg_message-info {
    color: #5fcb44;
}
.tg_message-text > .tg_message-info {
    position: absolute;
    bottom: 0;
    right: 0;
    width: fit-content;
}
.tg_message-text.i {
    padding-right: 80px;
}
.nv .tg_message-text.i {
    padding-right: 45px;
}

.tg_message-image {
    max-width: 500px;
    max-height: 300px;
    margin: 0 -12px;
    margin-top: -8px;
}
.t .tg_message-image {
    margin-top: 4px;
}

.tg_message-reactions {
    display: flex;
    gap: 4px;
}
.tg_message-reaction {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    font-weight: 500;

    background: #e8f5fc;
    border-radius: 32px;

    padding: 4px 8px;
    padding-top: 2px;
    padding-right: 10px;
    font-size: 14px;
}
.tg_message-reaction span {
    color: #168acd;
}

.tg_message-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    border-top: 1px solid #ccc;
    margin: 0 -12px;
    margin-top: 8px;
    padding: 4px 12px;
    padding-top: 8px;
    color: var(--tg-color-primary);
    font-weight: 500;
}

.tg_message-system {
    background: #1d2f2755;
    width: fit-content;
    color: #fff;
    padding: 3px 12px;
    border-radius: 32px;
    margin: auto;
    margin-bottom: 8px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.tg_message-system-avatar {
    display: block;
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 50%;
    margin: auto;
    margin-bottom: 8px;
}


@media screen and (max-width: 700px) {

    .tg_wrapper {
        margin: 0 -32px;
        border-radius: 0;
    }
    
}