/* =============================================================
   demi.css — Demi chat widget (#99)
   Brand-aligned: cream / dark navy / warm yellow palette
   ============================================================= */

.qc-demi-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #14202B;
  color: #FFD166;
  border: 0;
  border-radius: 999px;
  padding: 14px 22px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Barlow', -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(20, 32, 43, 0.25);
  z-index: 9998;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.qc-demi-launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(20, 32, 43, 0.3);
}
.qc-demi-launcher-hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.9);
}
.qc-demi-launcher-label {
  letter-spacing: 0.02em;
}

.qc-demi-panel {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 360px;
  height: 540px;
  max-height: calc(100vh - 48px);
  background: #FFFFFF;
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(20, 32, 43, 0.18), 0 4px 12px rgba(20, 32, 43, 0.08);
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: 'Barlow', -apple-system, BlinkMacSystemFont, sans-serif;
  color: #14202B;
  z-index: 9999;
  border: 1px solid #E0DCD3;
}
.qc-demi-panel-open {
  display: flex;
  animation: qc-demi-slide-in 0.25s ease-out;
}
@keyframes qc-demi-slide-in {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.qc-demi-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: #14202B;
  color: #F5F1E8;
  flex-shrink: 0;
}
.qc-demi-header-name {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.qc-demi-header-name strong {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.qc-demi-header-sub {
  font-size: 11px;
  color: rgba(245, 241, 232, 0.65);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.qc-demi-close {
  background: transparent;
  border: 0;
  color: #F5F1E8;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}
.qc-demi-close:hover {
  background: rgba(255, 255, 255, 0.1);
}

.qc-demi-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #FAF8F2;
  display: flex;
  flex-direction: column;
  gap: 12px;
  -webkit-overflow-scrolling: touch;
}

.qc-demi-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14.5px;
  line-height: 1.45;
  word-wrap: break-word;
}
.qc-demi-msg-assistant {
  align-self: flex-start;
  background: #FFFFFF;
  border: 1px solid #E0DCD3;
  border-bottom-left-radius: 4px;
}
.qc-demi-msg-user {
  align-self: flex-end;
  background: #14202B;
  color: #F5F1E8;
  border-bottom-right-radius: 4px;
}

/* Loading dots */
.qc-demi-loading {
  display: flex;
  gap: 4px;
  padding: 14px 16px;
}
.qc-demi-loading span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #B0AEA5;
  animation: qc-demi-pulse 1.2s infinite ease-in-out;
}
.qc-demi-loading span:nth-child(2) { animation-delay: 0.2s; }
.qc-demi-loading span:nth-child(3) { animation-delay: 0.4s; }
@keyframes qc-demi-pulse {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.85); }
  40% { opacity: 1; transform: scale(1.1); }
}

.qc-demi-input-row {
  display: flex;
  gap: 8px;
  padding: 12px;
  background: #FFFFFF;
  border-top: 1px solid #E0DCD3;
  align-items: flex-end;
  flex-shrink: 0;
}
.qc-demi-input {
  flex: 1;
  border: 1px solid #E0DCD3;
  border-radius: 10px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14.5px;
  color: #14202B;
  resize: none;
  line-height: 1.4;
  max-height: 120px;
  background: #FAF8F2;
}
.qc-demi-input:focus {
  outline: none;
  border-color: #14202B;
  background: #FFFFFF;
}
.qc-demi-send {
  background: #FFD166;
  color: #14202B;
  border: 0;
  border-radius: 10px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s ease;
}
.qc-demi-send:hover {
  transform: scale(1.05);
}
.qc-demi-send:active {
  transform: scale(0.95);
}

/* Mobile: panel fills more of the screen */
@media (max-width: 480px) {
  .qc-demi-panel {
    bottom: 12px;
    right: 12px;
    left: 12px;
    width: auto;
    height: calc(100vh - 24px);
    max-height: none;
  }
  .qc-demi-launcher {
    bottom: 16px;
    right: 16px;
    padding: 12px 18px;
    font-size: 14px;
  }
}
