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

body {
    font-family: 'Segoe UI', sans-serif;
    background: #f0f2f5;
}

/* ========================
   플로팅 버튼
======================== */
#chatFloatBtn {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #5b6af0;
    color: white;
    font-size: 24px;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(91,106,240,0.45);
    z-index: 1000;
    transition: background 0.2s, transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

#chatFloatBtn:hover {
    background: #4a59e0;
    transform: scale(1.08);
}

/* ========================
   채팅 위젯 팝업
======================== */
#chatWidget {
    position: fixed;
    bottom: 96px;
    right: 28px;
    width: 370px;
    height: 560px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    z-index: 999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.92) translateY(16px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.22s ease, opacity 0.22s ease;
}

#chatWidget.open {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: all;
}

.hidden {
    display: none !important;
}

/* ========================
   헤더
======================== */
#chatWidgetHeader {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: #5b6af0;
    color: white;
}

#chatWidgetHeader .avatar.bot {
    background: rgba(255,255,255,0.25);
    color: white;
}

#chatTitle {
    display: block;
    font-weight: bold;
    font-size: 14px;
}

#chatSubTitle {
    font-size: 11px;
    opacity: 0.75;
}

#closeBtn {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.8;
    line-height: 1;
    padding: 2px 6px;
}

#closeBtn:hover { opacity: 1; }

/* ========================
   탭 바
======================== */
#tabBar {
    display: flex;
    border-bottom: 1px solid #eee;
}

.tab {
    flex: 1;
    padding: 10px 0;
    border: none;
    background: none;
    font-size: 13px;
    color: #999;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color 0.15s;
}

.tab.active {
    color: #5b6af0;
    font-weight: bold;
    border-bottom: 2px solid #5b6af0;
}

/* ========================
   탭 콘텐츠
======================== */
.tabContent {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ========================
   메시지 영역
======================== */
.msgArea {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f7f8fc;
}

.msg {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.msg.me {
    flex-direction: row-reverse;
}

.msg > div {
    display: flex;
    flex-direction: column;
    gap: 3px;
    max-width: 220px;
}

.msg.me > div { align-items: flex-end; }

.name {
    font-size: 10px;
    color: #aaa;
}

.bubble {
    padding: 9px 13px;
    border-radius: 16px;
    font-size: 13px;
    line-height: 1.5;
    word-break: break-word;
}

.msg.me .bubble {
    background: #5b6af0;
    color: white;
    border-bottom-right-radius: 4px;
}

.msg.other .bubble {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.time {
    font-size: 10px;
    color: #ccc;
}

/* ========================
   입력창
======================== */
.inputArea {
    display: flex;
    padding: 10px 12px;
    gap: 8px;
    border-top: 1px solid #eee;
    background: white;
    align-items: center;
}

.inputArea input {
    flex: 1;
    padding: 8px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    font-size: 13px;
    outline: none;
    background: #f7f8fc;
}

.inputArea input:focus {
    border-color: #5b6af0;
    background: white;
}

.sendBtn {
    padding: 8px 16px;
    background: #5b6af0;
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
    white-space: nowrap;
}

.sendBtn:hover { background: #4a59e0; }

#backBtn {
    padding: 6px 10px;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #888;
    flex-shrink: 0;
}

/* ========================
   강사 채팅 - 채팅 영역
======================== */
#teacherChatArea {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ========================
   강사 채팅 - 방 목록
======================== */
#teacherRoomList {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.room {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    cursor: pointer;
}

.room:hover { background: #f0f0f0; }
.room.active { background: #ededfd; }

.roomInfo { flex: 1; overflow: hidden; }

.roomName {
    display: block;
    font-size: 13px;
    font-weight: bold;
    color: #333;
}

.lastMsg {
    display: block;
    font-size: 11px;
    color: #aaa;
    margin-top: 2px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* ========================
   아바타
======================== */
.avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    color: white;
    flex-shrink: 0;
}

.avatar.bot { background: #5b6af0; }
