/* ===========================
   CHAT WIDGET CSS
   Bauwerk Form Co. — site-wide chat widget
   =========================== */

/* === BUBBLE (closed state) === */
.cw-bubble {
  position: fixed;
  bottom: 32px;
  right: 32px;
  z-index: 1000;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--red);
  color: var(--cream);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  border: none;
  transition: transform 0.2s;
}

.cw-bubble:hover {
  transform: scale(1.08);
}

/* Bauhaus geometric icon — three primitives */
.cw-bubble-icon {
  width: 28px;
  height: 28px;
  position: relative;
}

.cw-bubble-icon::before {
  content: '';
  position: absolute;
  top: 0;
  left: 4px;
  width: 10px;
  height: 10px;
  background: var(--cream);
  border-radius: 50%;
}

.cw-bubble-icon::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 14px solid var(--yellow);
}

.cw-bubble-square {
  position: absolute;
  top: 4px;
  right: 0;
  width: 12px;
  height: 12px;
  background: var(--cream);
  opacity: 0.6;
}

.cw-bubble.cw-hidden { display: none; }

/* === PANEL (open state) === */
.cw-panel {
  position: fixed;
  bottom: 0;
  right: 32px;
  z-index: 1000;
  width: 420px;
  height: 600px;
  background: var(--darkalt);
  display: none;
  flex-direction: column;
  box-shadow: -4px 0 48px rgba(0, 0, 0, 0.5);
  border-left: var(--gap) solid var(--dark);
  border-top: var(--gap) solid var(--dark);
  border-right: var(--gap) solid var(--dark);
}

.cw-panel.cw-open {
  display: flex;
}

/* === PANEL HEADER === */
.cw-header {
  background: var(--dark);
  padding: 20px 24px;
  border-bottom: var(--gap) solid var(--darkalt);
  display: flex;
  align-items: center;
  gap: 12px;
}

.cw-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--yellow);
  animation: cw-pulse 2s infinite;
}

@keyframes cw-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.cw-brand {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cream);
}

.cw-header-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

.cw-btn-minimize,
.cw-btn-close {
  background: none;
  border: none;
  color: var(--cream);
  opacity: 0.4;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  font-family: inherit;
  transition: opacity 0.15s;
}

.cw-btn-minimize:hover,
.cw-btn-close:hover {
  opacity: 1;
}

/* === MESSAGES === */
.cw-messages {
  flex: 1;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}

.cw-msg {
  max-width: 340px;
  padding: 16px 18px;
  border-radius: 2px;
  font-size: 14px;
  line-height: 1.6;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

.cw-msg-ai {
  background: var(--dark);
  color: var(--cream);
  border-left: 3px solid var(--yellow);
}

.cw-msg-user {
  background: var(--cream);
  color: var(--dark);
  align-self: flex-end;
}

/* === INPUT === */
.cw-input-area {
  padding: 12px 24px 20px;
  background: var(--dark);
  border-top: var(--gap) solid var(--darkalt);
}

.cw-input {
  width: 100%;
  background: var(--darkalt);
  border: 2px solid rgba(240, 237, 228, 0.1);
  color: var(--cream);
  padding: 14px 18px;
  font-size: 14px;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  outline: none;
  border-radius: 2px;
  transition: border-color 0.15s;
  resize: none;
  overflow-y: hidden;
  min-height: 48px;
  max-height: 120px;
  line-height: 1.5;
}

.cw-input::placeholder {
  color: var(--mid);
}

.cw-input:focus {
  border-color: rgba(240, 237, 228, 0.25);
}

/* === MODE SELECTION BUTTONS === */
.cw-mode-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 8px 0;
}

.cw-mode-btn {
  padding: 14px 20px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  border: none;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  border-radius: 2px;
  transition: opacity 0.15s;
  text-align: left;
}

.cw-mode-btn:hover {
  opacity: 0.85;
}

.cw-mode-btn-primary {
  background: var(--yellow);
  color: var(--dark);
}

.cw-mode-btn-secondary {
  background: var(--dark);
  color: var(--cream);
  border: 2px solid rgba(240, 237, 228, 0.15);
}

/* === CLOSE CONFIRMATION === */
.cw-confirm {
  position: absolute;
  inset: 0;
  background: rgba(14, 20, 32, 0.92);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  z-index: 10;
}

.cw-confirm.cw-open {
  display: flex;
}

.cw-confirm-text {
  font-size: 16px;
  font-weight: 800;
  color: var(--cream);
  text-align: center;
  padding: 0 32px;
}

.cw-confirm-sub {
  font-size: 13px;
  color: var(--cream);
  opacity: 0.45;
  text-align: center;
  padding: 0 32px;
}

.cw-confirm-actions {
  display: flex;
  gap: 12px;
}

.cw-confirm-end {
  background: var(--red);
  color: var(--cream);
  border: none;
  padding: 12px 24px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  font-family: inherit;
}

.cw-confirm-cancel {
  background: none;
  border: 2px solid rgba(240, 237, 228, 0.2);
  color: var(--cream);
  padding: 12px 24px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  font-family: inherit;
}

/* === TYPING INDICATOR === */
.cw-typing {
  display: flex;
  gap: 4px;
  padding: 16px 18px;
  max-width: 80px;
  background: var(--dark);
  border-left: 3px solid var(--yellow);
  border-radius: 2px;
}

.cw-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cream);
  opacity: 0.3;
  animation: cw-typing-bounce 1.4s ease-in-out infinite;
}

.cw-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.cw-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes cw-typing-bounce {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-4px); }
}

/* === MOBILE === */
@media (max-width: 768px) {
  .cw-bubble {
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
  }

  .cw-panel {
    right: 0;
    width: 100%;
    height: 80vh;
    border-right: none;
  }
}
