/* chatbot-widget.css — Widget suport flotant */
#ddm-support-btn {
  position: fixed;
  bottom: 32px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #0077B6;
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0,119,182,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  transition: transform .2s, box-shadow .2s;
}
#ddm-support-btn:hover { transform: scale(1.08); box-shadow: 0 6px 28px rgba(0,119,182,.55); }
#ddm-support-btn svg { pointer-events: none; }

/* Tooltip greeting bubble */
#ddm-support-tooltip {
  position: fixed;
  bottom: 28px;
  right: 90px;
  background: #fff;
  color: #111827;
  border-radius: 14px;
  padding: 12px 36px 12px 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: .85rem;
  line-height: 1.45;
  max-width: 230px;
  z-index: 9997;
  pointer-events: none;
  opacity: 0;
  transform: translateX(8px) scale(.95);
  transition: opacity .3s ease, transform .3s ease;
}
#ddm-support-tooltip::after {
  content: '';
  position: absolute;
  right: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 8px solid #fff;
}
#ddm-support-tooltip.ddm-tooltip-visible {
  opacity: 1;
  transform: translateX(0) scale(1);
  pointer-events: auto;
}
.ddm-tooltip-close {
  position: absolute;
  top: 6px;
  right: 8px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: #9CA3AF;
  line-height: 1;
  padding: 2px 4px;
}
.ddm-tooltip-close:hover { color: #374151; }
.ddm-tooltip-text { font-weight: 500; }

#ddm-support-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #EF4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  padding: 0 5px;
  display: none;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

#ddm-support-popup {
  position: fixed;
  bottom: 98px;
  right: 24px;
  width: 360px;
  max-height: 560px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,.22);
  z-index: 9999;
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
}
#ddm-support-popup.open { display: flex; }

.ddm-sp-header {
  background: #0077B6;
  color: #fff;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.ddm-sp-header-info { display: flex; align-items: center; gap: 10px; }
.ddm-sp-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255,255,255,.25); display: flex; align-items: center; justify-content: center;
}
.ddm-sp-title { font-weight: 700; font-size: .95rem; }
.ddm-sp-sub   { font-size: .75rem; opacity: .8; margin-top: 1px; }
.ddm-sp-close {
  background: none; border: none; color: #fff; cursor: pointer;
  font-size: 22px; line-height: 1; padding: 2px 6px; border-radius: 6px;
  opacity: .7;
}
.ddm-sp-close:hover { opacity: 1; background: rgba(255,255,255,.2); }

/* Screens */
.ddm-screen { display: none; flex-direction: column; flex: 1; overflow: hidden; }
.ddm-screen.active { display: flex; }

/* Home screen */
.ddm-home-body { padding: 18px; overflow-y: auto; flex: 1; }
.ddm-home-greeting { font-size: .9rem; font-weight: 600; color: #111827; margin-bottom: 4px; }
.ddm-home-sub { font-size: .8rem; color: #6B7280; margin-bottom: 16px; line-height: 1.5; }

.ddm-faq-list { margin-bottom: 14px; }
.ddm-faq-item {
  border: 1px solid #E5E7EB; border-radius: 10px; padding: 10px 14px;
  margin-bottom: 8px; cursor: pointer; font-size: .82rem; color: #374151;
  transition: background .15s, border-color .15s;
  display: flex; align-items: center; gap: 8px;
}
.ddm-faq-item:hover { background: #E8F4FB; border-color: #90C8E0; }
.ddm-faq-arrow { margin-left: auto; opacity: .4; font-size: 14px; }

.ddm-btn-new, .ddm-btn-cont {
  width: 100%; padding: 11px 16px; border-radius: 10px; border: none;
  font-size: .85rem; font-weight: 600; cursor: pointer;
  margin-bottom: 8px; transition: background .15s;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.ddm-btn-new  { background: #0077B6; color: #fff; }
.ddm-btn-new:hover { background: #005F8E; }
.ddm-btn-bug  { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }
.ddm-btn-bug:hover { background: #FEE2E2; }
.ddm-btn-cont { background: #E8F4FB; color: #005F8E; border: 1px solid #90C8E0; }
.ddm-btn-cont:hover { background: #CDEAF6; }

/* FAQ Answer screen */
.ddm-faq-body { padding: 18px; overflow-y: auto; flex: 1; }
.ddm-faq-q {
  font-weight: 700; font-size: .9rem; color: #111827;
  margin-bottom: 14px; line-height: 1.4;
}
.ddm-faq-answer {
  font-size: .82rem; color: #374151; line-height: 1.7;
  margin-bottom: 18px;
}
.ddm-faq-answer ol, .ddm-faq-answer ul {
  padding-left: 18px; margin: 6px 0;
}
.ddm-faq-answer li { margin-bottom: 5px; }
.ddm-faq-answer p { margin: 0 0 6px; }
.ddm-faq-answer strong { color: #111827; }
.ddm-faq-still {
  font-size: .75rem; color: #9CA3AF;
  text-align: center; margin-bottom: 8px;
}

/* Form screen */
.ddm-form-body { padding: 18px; overflow-y: auto; flex: 1; }
.ddm-form-back {
  background: none; border: none; color: #6B7280; cursor: pointer;
  font-size: .8rem; margin-bottom: 14px; padding: 0;
  display: flex; align-items: center; gap: 4px;
}
.ddm-form-back:hover { color: #0077B6; }
.ddm-form-title { font-weight: 700; font-size: .95rem; color: #111827; margin-bottom: 14px; }
.ddm-field { margin-bottom: 12px; }
.ddm-field label { display: block; font-size: .78rem; font-weight: 600; color: #374151; margin-bottom: 4px; }
.ddm-field input, .ddm-field textarea, .ddm-field select {
  width: 100%; padding: 9px 12px; border: 1px solid #D1D5DB; border-radius: 8px;
  font-size: .85rem; color: #111827; outline: none; font-family: inherit;
  box-sizing: border-box; background: #fff;
  transition: border-color .15s;
}
.ddm-field input:focus, .ddm-field textarea:focus, .ddm-field select:focus {
  border-color: #0077B6;
}
.ddm-field textarea { resize: vertical; min-height: 90px; }
.ddm-form-info {
  background: #E8F4FB; border-radius: 8px; padding: 10px 12px;
  font-size: .76rem; color: #005F8E; margin-bottom: 14px; line-height: 1.5;
}
.ddm-btn-submit {
  width: 100%; padding: 11px; border-radius: 10px; border: none;
  background: #0077B6; color: #fff; font-size: .88rem; font-weight: 600;
  cursor: pointer; transition: background .15s;
}
.ddm-btn-submit:hover { background: #005F8E; }
.ddm-btn-submit:disabled { background: #9CA3AF; cursor: not-allowed; }
.ddm-form-err { color: #DC2626; font-size: .78rem; margin-top: 8px; }

/* Chat screen */
.ddm-chat-header {
  padding: 12px 16px;
  border-bottom: 1px solid #F3F4F6;
  flex-shrink: 0;
}
.ddm-chat-subject {
  font-weight: 700; font-size: .9rem; color: #111827; margin-bottom: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ddm-chat-meta { font-size: .75rem; color: #6B7280; }
.ddm-chat-new-link {
  display: inline-block; margin-top: 4px;
  font-size: .72rem; color: #0077B6; cursor: pointer; text-decoration: underline;
}
.ddm-chat-new-link:hover { color: #005F8E; }

.ddm-messages {
  flex: 1; overflow-y: auto; padding: 14px 14px 6px;
  display: flex; flex-direction: column; gap: 10px;
}
.ddm-msg { display: flex; flex-direction: column; max-width: 82%; }
.ddm-msg.user  { align-self: flex-end; align-items: flex-end; }
.ddm-msg.admin { align-self: flex-start; align-items: flex-start; }
.ddm-msg-bubble {
  padding: 9px 13px; border-radius: 14px; font-size: .84rem; line-height: 1.6;
  word-break: break-word; white-space: pre-wrap;
}
.ddm-msg.user  .ddm-msg-bubble { background: #F3F4F6; color: #111827; border-bottom-right-radius: 4px; }
.ddm-msg.admin .ddm-msg-bubble { background: #0077B6; color: #fff;    border-bottom-left-radius: 4px; }
.ddm-msg-name { font-size: .68rem; color: #9CA3AF; margin-bottom: 2px; }
.ddm-msg-time { font-size: .68rem; color: #9CA3AF; margin-top: 2px; }

.ddm-chat-input-row {
  padding: 12px 14px;
  border-top: 1px solid #F3F4F6;
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.ddm-chat-input-row textarea {
  flex: 1; border: 1px solid #D1D5DB; border-radius: 10px;
  padding: 9px 12px; font-size: .84rem; font-family: inherit;
  resize: none; outline: none; min-height: 40px; max-height: 100px;
  transition: border-color .15s;
}
.ddm-chat-input-row textarea:focus { border-color: #0077B6; }
.ddm-chat-send {
  background: #0077B6; color: #fff; border: none; border-radius: 10px;
  padding: 0 14px; cursor: pointer; font-size: 18px;
  transition: background .15s; align-self: flex-end; height: 40px;
}
.ddm-chat-send:hover { background: #005F8E; }
.ddm-chat-closed {
  padding: 10px 14px 14px; text-align: center;
  font-size: .78rem; color: #6B7280;
}

@media (max-width: 480px) {
  #ddm-support-popup { width: calc(100vw - 16px); right: 8px; bottom: 90px; }
  #ddm-support-tooltip { right: 86px; bottom: 32px; }
}

body.has-modal #ddm-support-btn,
body.has-modal #ddm-support-tooltip,
body.has-modal #ddm-support-popup {
  display: none !important;
}

/* Dark mode */
[data-theme="dark"] #ddm-support-popup {
  background: #1A1F2E;
  box-shadow: 0 8px 40px rgba(0,0,0,.5);
}
[data-theme="dark"] #ddm-support-tooltip {
  background: #1A1F2E;
  color: #F9FAFB;
  box-shadow: 0 8px 32px rgba(0,0,0,.4);
}
[data-theme="dark"] #ddm-support-tooltip::after { border-left-color: #1A1F2E; }
[data-theme="dark"] .ddm-home-greeting { color: #F9FAFB; }
[data-theme="dark"] .ddm-home-sub { color: #9CA3AF; }
[data-theme="dark"] .ddm-faq-item { border-color: #374151; color: #D1D5DB; }
[data-theme="dark"] .ddm-faq-item:hover { background: #1E3A5F; border-color: #0077B6; }
[data-theme="dark"] .ddm-btn-cont { background: #1E3A5F; color: #7DD3FC; border-color: #1E5F8E; }
[data-theme="dark"] .ddm-btn-cont:hover { background: #1a3352; }
[data-theme="dark"] .ddm-faq-q { color: #F9FAFB; }
[data-theme="dark"] .ddm-faq-answer { color: #D1D5DB; }
[data-theme="dark"] .ddm-faq-answer strong { color: #F9FAFB; }
[data-theme="dark"] .ddm-form-title { color: #F9FAFB; }
[data-theme="dark"] .ddm-field label { color: #D1D5DB; }
[data-theme="dark"] .ddm-field input,
[data-theme="dark"] .ddm-field textarea {
  background: #2D3748; border-color: #4B5563; color: #F9FAFB;
}
[data-theme="dark"] .ddm-field input:focus,
[data-theme="dark"] .ddm-field textarea:focus { border-color: #0077B6; }
[data-theme="dark"] .ddm-form-info { background: #1E3A5F; color: #7DD3FC; }
[data-theme="dark"] .ddm-chat-header { border-bottom-color: #374151; }
[data-theme="dark"] .ddm-chat-subject { color: #F9FAFB; }
[data-theme="dark"] .ddm-msg.user .ddm-msg-bubble { background: #2D3748; color: #F9FAFB; }
[data-theme="dark"] .ddm-chat-input-row { border-top-color: #374151; }
[data-theme="dark"] .ddm-chat-input-row textarea {
  background: #2D3748; border-color: #4B5563; color: #F9FAFB;
}
[data-theme="dark"] .ddm-chat-input-row textarea:focus { border-color: #0077B6; }
[data-theme="dark"] .ddm-chat-closed { color: #9CA3AF; }
