/* 대박코드 채팅 위젯 */
.chat-widget { position: fixed; bottom: 24px; right: 24px; z-index: 9999; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }

/* 말풍선 토글 버튼 */
.chat-toggle {
  width: 60px; height: 60px; border-radius: 50%;
  background: #2563eb; color: #fff; border: none; cursor: pointer;
  box-shadow: 0 4px 16px rgba(37,99,235,.4);
  display: flex; align-items: center; justify-content: center;
  transition: transform .2s, box-shadow .2s;
  position: relative;
}
.chat-toggle:hover { transform: scale(1.08); box-shadow: 0 6px 24px rgba(37,99,235,.5); }

.chat-badge {
  position: absolute; top: -4px; right: -4px;
  background: #ef4444; color: #fff; font-size: 12px; font-weight: 700;
  min-width: 20px; height: 20px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 5px;
}

/* 채팅창 */
.chat-box {
  position: absolute; bottom: 72px; right: 0;
  width: 360px; max-height: 500px;
  background: #fff; border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,.15);
  display: flex; flex-direction: column;
  overflow: hidden;
}

.chat-header {
  background: #2563eb; color: #fff;
  padding: 14px 16px; font-weight: 700; font-size: 15px;
  display: flex; justify-content: space-between; align-items: center;
}
.chat-close { background: none; border: none; color: #fff; font-size: 22px; cursor: pointer; padding: 0 4px; }

/* 로그인 화면 */
.chat-login { padding: 40px 24px; text-align: center; }
.chat-login-inner p { color: #64748b; margin-bottom: 20px; font-size: 14px; line-height: 1.6; }

.kakao-login-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: #FEE500; color: #3C1E1E; border: none; border-radius: 8px;
  padding: 12px 24px; font-size: 15px; font-weight: 600; cursor: pointer;
  transition: background .2s;
}
.kakao-login-btn:hover { background: #f5d800; }

.google-login-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: #fff; color: #3c4043; border: 1px solid #dadce0; border-radius: 8px;
  padding: 12px 24px; font-size: 15px; font-weight: 600; cursor: pointer;
  transition: background .2s; margin-top: 10px;
}
.google-login-btn:hover { background: #f8f9fa; }

/* 유저 바 */
.chat-user-bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 16px; background: #f8fafc; border-bottom: 1px solid #e2e8f0;
  font-size: 13px; color: #64748b;
}
.chat-logout {
  background: none; border: 1px solid #e2e8f0; border-radius: 4px;
  padding: 4px 10px; font-size: 12px; color: #64748b; cursor: pointer;
}
.chat-logout:hover { background: #f1f5f9; }

/* 채팅 메시지 영역 */
.chat-main { display: flex; flex-direction: column; height: 400px; }

.chat-messages {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 8px;
}

.chat-msg {
  max-width: 80%;
  display: flex; align-items: flex-end; gap: 4px;
}
.chat-msg.user {
  align-self: flex-end;
  flex-direction: row;
}
.chat-msg.admin {
  align-self: flex-start;
  flex-direction: row-reverse;
}
.msg-bubble {
  padding: 10px 14px;
  border-radius: 12px; font-size: 14px; line-height: 1.5;
  word-break: break-word;
}
.chat-msg.user .msg-bubble {
  background: #2563eb; color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-msg.admin .msg-bubble {
  background: #f1f5f9; color: #1e293b;
  border-bottom-left-radius: 4px;
}
.msg-meta {
  display: flex; flex-direction: column; align-items: flex-end;
  flex-shrink: 0; gap: 1px; margin-bottom: 2px;
}
.chat-msg.admin .msg-meta {
  align-items: flex-start;
}
.msg-time {
  font-size: 10px; color: #94a3b8;
}
.msg-unread {
  font-size: 10px; font-weight: 700; color: #f59e0b;
}

/* 입력 영역 */
.chat-input-wrap {
  display: flex; gap: 8px; padding: 12px 16px;
  border-top: 1px solid #e2e8f0;
}
.chat-input {
  flex: 1; border: 1px solid #e2e8f0; border-radius: 8px;
  padding: 10px 12px; font-size: 14px; outline: none;
  transition: border-color .2s;
}
.chat-input:focus { border-color: #2563eb; }
.chat-send {
  background: #2563eb; color: #fff; border: none; border-radius: 8px;
  padding: 10px 16px; font-size: 14px; font-weight: 600; cursor: pointer;
  white-space: nowrap;
}
.chat-send:hover { background: #1d4ed8; }

/* 모바일 */
@media (max-width: 480px) {
  .chat-widget { bottom: 16px; right: 16px; }
  .chat-box { width: calc(100vw - 32px); right: 0; bottom: 68px; max-height: 70vh; }
}
