@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@500&display=swap');

.container {
    position: fixed !important;
    padding: 2px !important;
    /* overflow-y: auto;
    overflow-x: hidden; */
}

/* Chat Room */
.chat-container {
    z-index: 5;
    position: relative;
    width: var(--msger-width);
    height: var(--msger-height);
    min-width: var(--msger-width);
    min-height: var(--msger-height);
    padding: 3px;
    background: var(--msger-bg);
    border: var(--border);
    border-radius: 10px;
    box-shadow: var(--box-shadow);
    transition:
        background 1s,
        width 0.5s ease-in-out;
    /* border: 1px solid lime; */
}

/* Chat app container - 카카오톡 스타일 */
.chat-app {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    /* border: 1px solid lime; */
}

/* Chat app people container */
.chat-app .people-list {
    z-index: 6;
    position: absolute;
    padding: 20px;
    top: 0;
    left: 0;
    width: 300px;
    height: 99%;
    background: var(--msger-bg);
    overflow-y: auto;
    overflow-x: hidden;
    /* border: 1px solid lime; */
}

/* Chat app people list container */
.people-list {
    -moz-transition: 0.5s;
    -o-transition: 0.5s;
    -webkit-transition: 0.5s;
    transition: 0.5s;
    /* border: 1px solid lime; */
}

.people-list .chat-list li {
    padding: 12px;
    list-style: none;
    border-radius: 12px;
    margin-bottom: 4px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

.people-list .chat-list li:hover {
    background: rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transform: translateX(2px);
}

.people-list .chat-list li.active {
    background: rgba(60, 110, 255, 0.2);
    border-left: 3px solid var(--right-msg-bg);
}

.people-list .chat-list li .name {
    color: #ffffff !important;
    font-size: 15px;
    font-weight: 500;
}

.people-list .chat-list img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.people-list img {
    float: left;
    border-radius: 50%;
}

.people-list .about {
    float: left;
    padding-left: 8px;
}

.people-list .about-buttons {
    margin-top: 35px;
    width: auto;
    /* display: inline-flex; */
}

.people-list .status {
    color: rgba(255, 255, 255, 0.7) !important;
    font-size: 13px;
}

/* Chat app people list container */
.chat-app .chat-list {
    height: auto;
    /* border: 1px solid lime; */
}

/* Chat app container */
.chat-app .chat {
    position: relative;
    margin-left: 300px;
    border-left: var(--border);
    border-radius: 10px;
    height: 100%;
    display: flex;
    flex-direction: column;
    min-height: 0;
    /* border: 1px solid lime; */
}

.chat-container.compact-chat-dock {
    border-radius: 12px 0 0 0;
    backdrop-filter: blur(8px);
}

.chat-container.compact-chat-dock #plist {
    display: none !important;
}

.chat-container.compact-chat-dock .chat {
    margin-left: 0 !important;
    border-left: none !important;
    display: flex !important;
    flex-direction: column !important;
    min-height: 0 !important;
}

.chat-container.compact-chat-dock .chat .chat-history {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    flex: 1 1 auto !important;
}

/* Chat header - 카카오톡 스타일 */
.chat .chat-header {
    padding: 12px 16px;
    border-bottom: var(--border);
    height: 64px;
    max-height: 64px;
    min-height: 64px;
    cursor: move;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
    backdrop-filter: blur(10px);
    /* overflow-x: auto; */
    /* border: 1px solid lime; */
}

.all-participants-img {
    border: var(--border);
    width: 40px;
    margin-right: 5px;
    cursor: pointer;
}

.all-participants-img:hover {
    background-color: #1d8ecd;
    transition: all 0.3s ease-in-out;
}

.chat .chat-header img {
    float: left;
    border-radius: 40px;
    width: 40px;
}

.chat .chat-header .chat-about {
    float: left;
    padding-left: 10px;
    color: #ffffff;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.chat .chat-header .chat-about h6 {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
    color: #ffffff !important;
}

.chat .chat-header .status {
    color: rgba(255, 255, 255, 0.8) !important;
    font-size: 12px;
    margin-top: 2px;
    font-weight: 400;
}

.chat .chat-header .chat-option-buttons {
    position: absolute;
    display: inline-flex;
    top: 20px;
    right: 20px;
    z-index: 5;
}

/* Chat history - 카카오톡 스타일 */
.chat .chat-history {
    padding: 16px;
    height: auto;
    min-height: 0;
    max-height: none;
    flex: 1 1 auto;
    border-bottom: var(--border);
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--msger-bg);
    /* border: 1px solid lime; */
}

/* 스크롤바 스타일 개선 */
.chat .chat-history::-webkit-scrollbar {
    width: 6px;
}

.chat .chat-history::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.chat .chat-history::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

.chat .chat-history::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.chat .chat-history ul {
    padding: 0;
}

.chat .chat-history ul li {
    list-style: none;
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
}

.chat .chat-history ul li:last-child {
    margin-bottom: 0px;
}

/* 카카오톡 스타일: 내 메시지는 오른쪽 정렬 */
.chat .chat-history ul li.my-message-item {
    align-items: flex-end;
}

/* 카카오톡 스타일: 상대방 메시지는 왼쪽 정렬 */
.chat .chat-history ul li.other-message-item {
    align-items: flex-start;
}

/* 카카오톡 스타일 메시지 데이터 */
.chat .chat-history .message-data {
    margin-bottom: 0;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    max-width: 100%;
}

/* 내 메시지는 오른쪽 정렬 */
.chat .chat-history .my-message-item .message-data {
    flex-direction: row-reverse;
    justify-content: flex-start;
}

/* 상대방 메시지는 왼쪽 정렬 */
.chat .chat-history .other-message-item .message-data {
    flex-direction: row;
    justify-content: flex-start;
}

/* 프로필 이미지 */
.chat .chat-history .message-avatar {
    border-radius: 50%;
    width: 36px;
    height: 36px;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

/* 메시지 래퍼 */
.chat .chat-history .message-wrapper {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 70%;
    width: 100%;
}

/* 내 메시지 래퍼는 오른쪽 정렬 */
.chat .chat-history .my-message-item .message-wrapper {
    align-items: flex-end;
}

/* 상대방 메시지 래퍼는 왼쪽 정렬 */
.chat .chat-history .other-message-item .message-wrapper {
    align-items: flex-start;
}

/* 시간 표시 */
.chat .chat-history .message-data-time {
    color: rgba(255, 255, 255, 0.7) !important;
    font-size: 0.7rem;
    white-space: nowrap;
    padding: 0 4px;
    margin-bottom: 2px;
    font-weight: 400;
}

/* 카카오톡 스타일 메시지 버블 */
.chat .chat-history .message {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    overflow-wrap: break-word;
    word-wrap: break-word;
    padding: 10px 14px;
    line-height: 1.4;
    font-size: 15px;
    max-width: 100%;
    min-width: 60px;
    width: fit-content;
    border-radius: 18px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    word-break: break-word;
    transition: all 0.2s ease;
}

/* 메시지 텍스트 */
.chat .chat-history .message-text {
    display: block;
    word-break: break-word;
    color: inherit;
}

/* 내 메시지 텍스트 색상 (흰색) */
.chat .chat-history .my-message .message-text {
    color: #ffffff !important;
}

/* 상대방 메시지 텍스트 색상 (흰색) */
.chat .chat-history .other-message .message-text {
    color: #ffffff !important;
}

/* 내 메시지 (오른쪽, 파란색) */
.chat .chat-history .my-message {
    background: var(--right-msg-bg);
    color: #ffffff !important;
    border-bottom-right-radius: 4px;
}

/* 상대방 메시지 (왼쪽, 회색) */
.chat .chat-history .other-message {
    background: var(--left-msg-bg);
    color: #ffffff !important;
    text-align: left;
    border-bottom-left-radius: 4px;
}

/* 메시지 액션 버튼 (호버 시 표시) */
.chat .chat-history .message-actions {
    display: none;
    gap: 4px;
    margin-top: 4px;
    align-items: center;
}

.chat .chat-history .message:hover .message-actions {
    display: flex;
}

.chat .chat-history .msg-action-btn {
    background: rgba(0, 0, 0, 0.2);
    border: none;
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.7);
    padding: 4px 8px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat .chat-history .msg-action-btn:hover {
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
}

/* 메시지 말풍선 꼬리 제거 (카카오톡 스타일) */
.chat .chat-history .message:after {
    display: none;
}

/* Chat message - 카카오톡 스타일 입력창 */
.chat .chat-message {
    padding: 12px 16px;
    max-height: 140px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
    border-top: var(--border);
    flex-shrink: 0;
    width: 100%;
    box-sizing: border-box;
    /* border: 1px solid lime; */
}

/* 카카오톡 스타일 입력창 컨테이너 */
.chat .chat-message .chat-input-container {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 6px 12px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: all 0.3s ease;
    width: 100%;
    box-sizing: border-box;
}

.chat .chat-message .chat-input-container:focus-within {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.25);
    box-shadow: 0 0 0 2px rgba(60, 110, 255, 0.3);
}

/* 입력창 옵션 버튼들 */
.chat .chat-message .chat-input-options {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.chat .chat-message .chat-option-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    padding: 0;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

.chat .chat-message .chat-option-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* 메시지 입력창 */
.chat .chat-message .chat-input {
    background: transparent !important;
    border: none !important;
    color: #ffffff !important;
    resize: none;
    padding: 0;
    font-size: 15px;
    line-height: 1.4;
    max-height: 100px;
    overflow-y: auto;
    flex: 1;
    min-height: 20px;
    font-weight: 400;
    outline: none;
    box-shadow: none;
    width: 100%;
}

.chat .chat-message .chat-input::placeholder {
    color: rgba(255, 255, 255, 0.6) !important;
}

.chat .chat-message .chat-input:focus {
    outline: none;
    box-shadow: none;
    color: #ffffff !important;
}

/* 전송 버튼 */
.chat .chat-message .chat-send-btn {
    background: var(--right-msg-bg);
    border: none;
    color: #fff;
    padding: 0;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

.chat .chat-message .chat-send-btn:hover {
    background: #2d5ae0;
    transform: scale(1.05);
}

.chat .chat-message .chat-send-btn:active {
    transform: scale(0.95);
}

/* 옵션 행 (숨김 처리) */
.chat .chat-message .chat-options-row {
    display: flex;
    gap: 8px;
    padding: 8px 0;
}

.chat .chat-message .chat-option-btn-small {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: rgba(255, 255, 255, 0.7);
    padding: 6px 10px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.chat .chat-message .chat-option-btn-small:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

/* Chat emoji */
.chatEmojiPicker {
    z-index: 0;
    position: absolute;
    left: 5px;
    bottom: 135px;
    background: var(--body-bg);
    border: var(--border);
    border-radius: 5px;
    --rgb-background: var(--body-bg);
    --color-border-over: var(--body-bg);
    --font-family: 'Montserrat', 'Noto Sans KR', 'Malgun Gothic', '맑은 고딕', 'Apple SD Gothic Neo', 'AppleGothic', sans-serif;
}

/* status */
.online,
.offline,
.me {
    margin-right: 2px;
    font-size: 8px;
    vertical-align: middle;
}

.online {
    color: #86c541;
}
.offline {
    color: #e47297;
}
.me {
    color: #1d8ecd;
}

.float-right {
    float: right;
}
.float-left {
    float: left;
}

.inline {
    display: inline-flex;
}

.absolute {
    position: absolute;
}

.clearfix:after {
    visibility: hidden;
    display: block;
    font-size: 0;
    content: ' ';
    clear: both;
    height: 0;
}

/** common **/
.mt5 {
    margin-top: 5px;
}

.mt10 {
    margin-top: 10px;
}

.mr5 {
    margin-right: 5px;
}

.ml5 {
    margin-left: 5px;
}

.ml10 {
    margin-left: 10px;
}

/* Chat search and input message */
textarea,
input[type='text'] {
    background: var(--msger-bg) !important;
    color: #ffffff !important;
    transition: height 0.5s !important;
}

/* 검색 입력창 텍스트 색상 개선 */
#searchParticipantsFromList {
    color: #ffffff !important;
}

#searchParticipantsFromList::placeholder {
    color: rgba(255, 255, 255, 0.6) !important;
}

.form-check-input {
    cursor: pointer;
}

#chatShareRoomBtn {
    padding: 10px 16px;
    background: var(--right-msg-bg);
    border-radius: 20px;
    border: none;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease-in-out;
    display: flex;
    align-items: center;
    gap: 6px;
}

#chatShareRoomBtn:hover {
    background: #2d5ae0;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(60, 110, 255, 0.3);
}

/* handle screen sizes */
@media screen and (max-width: 600px) {
    .people-list {
        width: 100% !important;
    }
    .chat-container {
        max-width: 100vw;
        max-height: min(100dvh, 100vh);
        overflow: hidden;
        padding-bottom: env(safe-area-inset-bottom, 0px);
        box-sizing: border-box;
    }
    .chat-app {
        max-height: 100%;
        min-height: 0;
    }
}
