/* Don Jr chat widget — Cubecorp concierge */

#dj-panel {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 400px;
  height: 600px;
  max-height: calc(100vh - 64px);
  background: #FFFFFF;
  border-radius: 4px;
  box-shadow: 0 24px 64px -16px rgba(10, 10, 10, 0.25), 0 8px 24px -8px rgba(10, 10, 10, 0.15);
  border: 1px solid rgba(10, 10, 10, 0.08);
  display: none;
  flex-direction: column;
  z-index: 300;
  overflow: hidden;
  font-family: 'DM Sans', system-ui, sans-serif;
  transform: translateY(16px);
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
#dj-panel.dj-open {
  display: flex;
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 720px) {
  /* Shrink the existing floating avatar button (defined in each page's CSS) */
  .widget {
    width: 64px !important;
    height: 64px !important;
    bottom: 20px !important;
    right: 20px !important;
    border-width: 1.5px !important;
  }
  .widget-label { display: none !important; }

  /* Chat panel: full-screen, tighter spacing inside */
  #dj-panel {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }
  .dj-header {
    padding: 12px 14px;
    gap: 10px;
  }
  .dj-header-avatar {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
  }
  .dj-header-name { font-size: 14px; }
  .dj-header-sub { font-size: 10.5px; margin-top: 1px; }
  .dj-close { font-size: 20px; padding: 2px 6px; }

  .dj-body {
    padding: 14px;
    gap: 10px;
  }
  .dj-msg {
    font-size: 13.5px;
    line-height: 1.45;
    padding: 10px 13px;
    max-width: 88%;
    border-radius: 10px;
  }
  .dj-msg.dj-bot { border-top-left-radius: 3px; }
  .dj-msg.dj-user { border-top-right-radius: 3px; }
  .dj-toast { font-size: 11.5px; padding: 5px 11px; }

  .dj-footer {
    padding: 10px 12px;
    gap: 8px;
  }
  .dj-input {
    font-size: 14px;
    padding: 9px 12px;
    min-height: 38px;
    border-radius: 7px;
  }
  .dj-send {
    font-size: 12.5px;
    padding: 9px 14px;
    min-height: 38px;
    border-radius: 7px;
  }
  .dj-disclaimer {
    font-size: 9.5px;
    padding: 6px 12px 10px;
  }
  .dj-typing { padding: 11px 14px; }
}

.dj-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(10, 10, 10, 0.08);
  background: #0A0A0A;
  color: #FFFFFF;
}
.dj-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-size: cover;
  background-position: center top;
  border: 1.5px solid #C9A961;
  flex: 0 0 40px;
}
.dj-header-text {
  flex: 1;
  min-width: 0;
}
.dj-header-name {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.005em;
  line-height: 1.2;
}
.dj-header-sub {
  font-size: 11.5px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.65);
  letter-spacing: 0.04em;
  margin-top: 2px;
}
.dj-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 2px;
  transition: color 0.2s, background 0.2s;
}
.dj-close:hover {
  color: #FFFFFF;
  background: rgba(255, 255, 255, 0.08);
}

.dj-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #F7F5F0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}

.dj-msg {
  max-width: 84%;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14.5px;
  line-height: 1.55;
  letter-spacing: -0.003em;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.dj-msg.dj-bot {
  background: #FFFFFF;
  color: #0A0A0A;
  border: 1px solid rgba(10, 10, 10, 0.06);
  align-self: flex-start;
  border-top-left-radius: 4px;
}
.dj-msg.dj-user {
  background: #0A0A0A;
  color: #FFFFFF;
  align-self: flex-end;
  border-top-right-radius: 4px;
}
.dj-msg.dj-error {
  background: #FFF4F4;
  color: #8B1A1A;
  border: 1px solid rgba(139, 26, 26, 0.15);
  align-self: flex-start;
  font-size: 13px;
}

.dj-toast {
  align-self: center;
  padding: 6px 14px;
  background: rgba(201, 169, 97, 0.16);
  color: #7A5F1F;
  border: 1px solid rgba(201, 169, 97, 0.4);
  border-radius: 100px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.dj-typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 14px 16px;
  background: #FFFFFF;
  border: 1px solid rgba(10, 10, 10, 0.06);
  border-radius: 12px;
  border-top-left-radius: 4px;
}
.dj-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(10, 10, 10, 0.3);
  animation: djBlink 1.2s infinite both;
}
.dj-typing span:nth-child(2) { animation-delay: 0.15s; }
.dj-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes djBlink {
  0%, 100% { opacity: 0.3; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-2px); }
}

.dj-footer {
  padding: 14px 16px;
  border-top: 1px solid rgba(10, 10, 10, 0.08);
  background: #FFFFFF;
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.dj-input {
  flex: 1;
  border: 1px solid rgba(10, 10, 10, 0.15);
  border-radius: 8px;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.4;
  color: #0A0A0A;
  background: #FFFFFF;
  resize: none;
  outline: none;
  max-height: 120px;
  min-height: 40px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.dj-input:focus {
  border-color: #C9A961;
  box-shadow: 0 0 0 3px rgba(201, 169, 97, 0.15);
}
.dj-send {
  background: #C9A961;
  color: #0A0A0A;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-family: inherit;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  flex: 0 0 auto;
  min-height: 40px;
}
.dj-send:hover:not(:disabled) {
  background: #0A0A0A;
  color: #FFFFFF;
  transform: translateY(-1px);
}
.dj-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.dj-disclaimer {
  padding: 8px 16px 12px;
  font-size: 10.5px;
  color: rgba(10, 10, 10, 0.4);
  text-align: center;
  background: #FFFFFF;
  letter-spacing: 0.02em;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  #dj-panel { transition: none; }
  .dj-body { scroll-behavior: auto; }
  .dj-typing span { animation: none; }
}
