/* ── Chat Widget Styles ─────────────────────────────────────────── */
.dsk-chat-bubble {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #1a1a1a;
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  z-index: 9998;
  transition: transform 0.2s, box-shadow 0.2s;
}
.dsk-chat-bubble:hover {
  transform: scale(1.06);
  box-shadow: 0 6px 24px rgba(0,0,0,0.2);
}
.dsk-chat-bubble svg {
  width: 24px;
  height: 24px;
}
.dsk-chat-bubble .dsk-close-icon { display: none; }
.dsk-chat-bubble.open .dsk-chat-icon { display: none; }
.dsk-chat-bubble.open .dsk-close-icon { display: block; }

/* Panel */
.dsk-chat-panel {
  display: none;
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 48px);
  height: 560px;
  max-height: calc(100vh - 140px);
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.12);
  z-index: 9997;
  flex-direction: column;
  overflow: hidden;
  font-family: Optima, 'Alegreya Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}
.dsk-chat-panel.open {
  display: flex;
}

/* Header */
.dsk-chat-header {
  background: #1a1a1a;
  color: #fff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.dsk-chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.dsk-chat-header-info h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.dsk-chat-header-info p {
  margin: 2px 0 0;
  font-size: 0.8rem;
  color: #ccc;
}

/* Messages area */
.dsk-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #f8f8f5;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.dsk-chat-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.92rem;
  line-height: 1.45;
  word-break: break-word;
}
.dsk-chat-msg.bot {
  align-self: flex-start;
  background: #ffffff;
  color: #111111;
  border-bottom-left-radius: 4px;
  font-weight: 500;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
  opacity: 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.dsk-chat-msg.user {
  align-self: flex-end;
  background: #1a1a1a;
  color: #fff;
  border-bottom-right-radius: 4px;
}
.dsk-chat-msg.dan {
  align-self: flex-start;
  background: #dae5f5;
  color: #111111;
  border-bottom-left-radius: 4px;
  border-left: 3px solid #2c5f8a;
  font-weight: 500;
  opacity: 1;
}
.dsk-chat-msg.system {
  align-self: center;
  background: transparent;
  color: #666;
  font-size: 0.8rem;
  font-style: italic;
  text-align: center;
  max-width: 90%;
  padding: 4px 8px;
}

/* Typing indicator */
.dsk-typing {
  align-self: flex-start;
  background: #ecece6;
  padding: 12px 18px;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  display: none;
}
.dsk-typing.show { display: block; }
.dsk-typing span {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #999;
  margin: 0 2px;
  animation: dsk-typing 1.4s infinite;
}
.dsk-typing span:nth-child(2) { animation-delay: 0.2s; }
.dsk-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dsk-typing {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-4px); }
}

/* Visitor identity form */
.dsk-visitor-form {
  padding: 20px 16px;
  background: #f8f8f5;
  border-bottom: 1px solid #e0e0d8;
  display: none;
  flex-direction: column;
  gap: 10px;
}
.dsk-visitor-form.show { display: flex; }
.dsk-visitor-form p {
  margin: 0;
  font-size: 0.9rem;
  color: #555;
  font-style: italic;
}
.dsk-visitor-form input {
  padding: 10px 14px;
  border: 1px solid #d0d0c8;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.9rem;
  background: #fff;
  outline: none;
  transition: border-color 0.2s;
}
.dsk-visitor-form input:focus {
  border-color: #1a1a1a;
}
.dsk-visitor-form .dsk-form-row {
  display: flex;
  gap: 8px;
}
.dsk-visitor-form .dsk-form-row input {
  flex: 1;
}
.dsk-visitor-form button {
  padding: 10px 20px;
  background: #1a1a1a;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s;
  font-weight: 500;
}
.dsk-visitor-form button:hover {
  background: #333;
}

/* Input area */
.dsk-chat-input-area {
  padding: 12px 16px;
  background: #fff;
  border-top: 1px solid #e0e0d8;
  display: flex;
  gap: 8px;
  display: none;
}
.dsk-chat-input-area.show { display: flex; }
.dsk-chat-input-area input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #d0d0c8;
  border-radius: 24px;
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}
.dsk-chat-input-area input:focus {
  border-color: #1a1a1a;
}
.dsk-chat-input-area input::placeholder {
  color: #999;
}
.dsk-chat-input-area button {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #1a1a1a;
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  flex-shrink: 0;
}
.dsk-chat-input-area button:hover {
  background: #333;
}
.dsk-chat-input-area button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.dsk-chat-input-area button svg {
  width: 18px;
  height: 18px;
}

/* Powered by */
.dsk-chat-footer {
  padding: 6px 16px;
  background: #fff;
  text-align: center;
  font-size: 0.7rem;
  color: #aaa;
  border-top: 1px solid #f0f0ea;
}

@media (max-width: 480px) {
  .dsk-chat-panel {
    width: calc(100vw - 24px);
    right: 12px;
    bottom: 84px;
    height: calc(100vh - 120px);
    max-height: none;
    border-radius: 16px 16px 0 0;
  }
  .dsk-chat-bubble {
    right: 12px;
    bottom: 16px;
  }
}
