/* ===== 대표이사에게 직접 말하기 위젯 ===== */

/* 플로팅 버튼 */
#dm-widget .dm-fab {
  position: fixed !important;
  bottom: 100px !important;
  left: 24px !important;
  z-index: 2147483000 !important;
  padding: 0 20px !important;
  height: 44px !important;
  border-radius: 22px !important;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
  color: #fff !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  cursor: pointer !important;
  box-shadow: 0 4px 20px rgba(102, 126, 234, 0.45), 0 2px 6px rgba(0,0,0,0.08) !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  white-space: nowrap !important;
  overflow: visible !important;
  width: auto !important;
  line-height: 1 !important;
  letter-spacing: -0.2px !important;
  border: none !important;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}
#dm-widget .dm-fab:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 8px 28px rgba(102, 126, 234, 0.55), 0 4px 10px rgba(0,0,0,0.1) !important;
}
#dm-widget .dm-fab:active {
  transform: translateY(0) !important;
}
#dm-widget .dm-fab.active {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%) !important;
  box-shadow: 0 4px 20px rgba(245, 87, 108, 0.45) !important;
}
#dm-widget .dm-fab .dm-fab-icon {
  font-size: 16px;
  display: flex;
  align-items: center;
}
#dm-widget .dm-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background: #ff4757;
  color: #fff;
  border-radius: 12px;
  min-width: 22px;
  height: 22px;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(255, 71, 87, 0.4);
  animation: dmBadgePulse 2s ease-in-out infinite;
}
@keyframes dmBadgePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* 채팅창 */
#dm-widget .dm-chat {
  position: fixed;
  bottom: 20px;
  left: 24px;
  z-index: 2147483000;
  width: 380px;
  height: calc(100vh - 100px);
  max-height: 600px;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15), 0 4px 16px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: dmSlideUp 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
@media (max-width: 480px) {
  #dm-widget .dm-chat {
    width: calc(100vw - 32px);
    left: 16px;
    bottom: 16px;
    max-height: calc(100vh - 80px);
    border-radius: 16px;
  }
}
@keyframes dmSlideUp {
  from { opacity: 0; transform: translateY(24px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* 헤더 */
#dm-widget .dm-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}
#dm-widget .dm-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
#dm-widget .dm-header-avatar {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
#dm-widget .dm-header-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
#dm-widget .dm-header-title {
  font-weight: 700;
  font-size: 15px;
  line-height: 1.2;
}
#dm-widget .dm-header-subtitle {
  font-size: 11px;
  opacity: 0.8;
  font-weight: 400;
}
#dm-widget .dm-header-actions {
  display: flex;
  gap: 4px;
}
#dm-widget .dm-btn-icon {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  padding: 0;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}
#dm-widget .dm-btn-icon:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* 메시지 영역 */
#dm-widget .dm-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  background: #f7f8fc;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}
#dm-widget .dm-messages::-webkit-scrollbar {
  width: 6px;
}
#dm-widget .dm-messages::-webkit-scrollbar-track {
  background: transparent;
}
#dm-widget .dm-messages::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
}

/* 빈 상태 */
#dm-widget .dm-empty {
  text-align: center;
  color: #6b7280;
  margin: auto;
  padding: 24px 20px;
  max-width: 280px;
}
#dm-widget .dm-empty-icon {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  background: linear-gradient(135deg, #667eea20, #764ba220);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 28px;
}
#dm-widget .dm-empty-title {
  font-size: 16px;
  font-weight: 700;
  color: #1f2937;
  margin: 0 0 8px;
}
#dm-widget .dm-empty-desc {
  font-size: 13px;
  color: #6b7280;
  line-height: 1.7;
  margin: 0 0 16px;
}
#dm-widget .dm-empty-hints {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
#dm-widget .dm-empty-hint {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #fff;
  border-radius: 12px;
  font-size: 12px;
  color: #4b5563;
  text-align: left;
  border: 1px solid #e5e7eb;
}
#dm-widget .dm-empty-hint i {
  color: #667eea;
  font-size: 14px;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}
#dm-widget .dm-empty-notice {
  margin-top: 16px;
  padding: 12px 14px;
  background: linear-gradient(135deg, #fef3c7, #fde68a40);
  border-radius: 12px;
  font-size: 12px;
  color: #92400e;
  text-align: left;
  border: 1px solid #fde68a;
  line-height: 1.6;
}
#dm-widget .dm-empty-notice i {
  margin-right: 4px;
}

/* 메시지 버블 */
#dm-widget .dm-msg {
  display: flex;
  animation: dmMsgIn 0.25s ease;
}
@keyframes dmMsgIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
#dm-widget .dm-msg-user {
  justify-content: flex-end;
}
#dm-widget .dm-msg-admin {
  justify-content: flex-start;
}
#dm-widget .dm-msg-bubble {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 13.5px;
  line-height: 1.55;
  word-break: break-word;
}
#dm-widget .dm-msg-user .dm-msg-bubble {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  border-bottom-right-radius: 6px;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}
#dm-widget .dm-msg-admin .dm-msg-bubble {
  background: #fff;
  color: #1f2937;
  border-bottom-left-radius: 6px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
#dm-widget .dm-msg-time {
  font-size: 10px;
  color: #9ca3af;
  margin-top: 4px;
  padding: 0 2px;
}
#dm-widget .dm-msg-user .dm-msg-time {
  text-align: right;
}
#dm-widget .dm-msg-admin .dm-msg-time {
  text-align: left;
}

/* 첨부파일 */
#dm-widget .dm-msg-attachments {
  margin-top: 8px;
}
#dm-widget .dm-att-img {
  max-width: 220px;
  max-height: 160px;
  border-radius: 12px;
  cursor: pointer;
  transition: opacity 0.2s;
  display: block;
}
#dm-widget .dm-att-img:hover {
  opacity: 0.9;
}
#dm-widget .dm-att-video,
#dm-widget .dm-att-file {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  font-size: 12px;
  color: inherit;
  text-decoration: none;
  transition: background 0.2s;
}
#dm-widget .dm-att-video:hover,
#dm-widget .dm-att-file:hover {
  background: rgba(255, 255, 255, 0.35);
}

/* 첨부 미리보기 */
#dm-widget .dm-preview {
  padding: 10px 16px;
  background: #f0f1f5;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  border-top: 1px solid #e5e7eb;
  flex-shrink: 0;
}
#dm-widget .dm-preview::-webkit-scrollbar {
  height: 4px;
}
#dm-widget .dm-preview::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 2px;
}
#dm-widget .dm-preview-item {
  position: relative;
  flex-shrink: 0;
}
#dm-widget .dm-preview-img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 10px;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}
#dm-widget .dm-preview-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #ff4757;
  color: #fff;
  border: 2px solid #fff;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 9px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
  box-shadow: 0 2px 6px rgba(255, 71, 87, 0.3);
}
#dm-widget .dm-preview-remove:hover {
  transform: scale(1.15);
}

/* 입력 영역 */
#dm-widget .dm-input {
  border-top: 1px solid #e5e7eb;
  background: #fff;
  flex-shrink: 0;
  border-radius: 0 0 20px 20px;
}
#dm-widget .dm-input-actions {
  padding: 10px 16px 0;
  display: flex;
  gap: 4px;
}
#dm-widget .dm-input-actions .dm-btn-icon {
  color: #9ca3af;
  font-size: 16px;
  background: transparent;
  width: 32px;
  height: 32px;
  border-radius: 8px;
}
#dm-widget .dm-input-actions .dm-btn-icon:hover {
  color: #667eea;
  background: #f3f4f6;
}
#dm-widget .dm-input-row {
  display: flex;
  align-items: flex-end;
  padding: 8px 14px 14px;
  gap: 8px;
}
#dm-widget .dm-textarea {
  flex: 1;
  border: 1.5px solid #e5e7eb;
  border-radius: 20px;
  padding: 10px 16px;
  font-size: 13.5px;
  resize: none;
  outline: none;
  max-height: 80px;
  line-height: 1.45;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #1f2937;
  background: #f9fafb;
  transition: all 0.2s ease;
}
#dm-widget .dm-textarea::placeholder {
  color: #9ca3af;
}
#dm-widget .dm-textarea:focus {
  border-color: #667eea;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}
#dm-widget .dm-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  cursor: pointer;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}
#dm-widget .dm-send-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 14px rgba(102, 126, 234, 0.4);
}
#dm-widget .dm-send-btn:active {
  transform: scale(0.95);
}
#dm-widget .dm-send-btn:disabled {
  background: #d1d5db;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}
