/* ============================================================
   Chat Panel — Story 5.1
   ============================================================ */

.chat-panel {
  position: fixed;
  right: 0;
  bottom: 0;
  width: 380px;
  max-width: 100vw;
  height: 520px;
  display: flex;
  flex-direction: column;
  background: var(--base-100, #fff);
  border: 1px solid var(--base-300, #e5e7eb);
  border-radius: 12px 12px 0 0;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.12);
  z-index: 1000;
  font-family: 'Inter', sans-serif;
}

/* Header */
.chat-panel__header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--primary-dark, #1B2A4A);
  color: white;
  border-radius: 12px 12px 0 0;
  flex-shrink: 0;
}

.chat-panel__title {
  font-weight: 600;
  flex: 1;
  font-size: 0.95rem;
}

.chat-panel__close {
  background: none;
  border: none;
  color: white;
  font-size: 1.25rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
  opacity: 0.7;
}
.chat-panel__close:hover { opacity: 1; }

/* Status badge */
.chat-badge {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 500;
}
.chat-badge--connected    { background: #22c55e; color: #fff; }
.chat-badge--disconnected { background: #ef4444; color: #fff; }
.chat-badge--connecting   { background: #f59e0b; color: #fff; }

/* Messages */
.chat-panel__messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Bubbles */
.chat-bubble {
  max-width: 80%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.4;
  word-break: break-word;
}
.chat-bubble--user {
  align-self: flex-end;
  background: var(--primary, #0F52BA);
  color: white;
  border-bottom-right-radius: 2px;
}
.chat-bubble--assistant {
  align-self: flex-start;
  background: var(--base-200, #f3f4f6);
  color: var(--base-content, #1f2937);
  border-bottom-left-radius: 2px;
}
.chat-bubble--error {
  align-self: flex-start;
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

/* Opportunity card stub */
.chat-card {
  background: var(--base-200, #f3f4f6);
  border: 1px solid var(--base-300, #e5e7eb);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
}
.chat-card:hover { background: var(--base-300, #e5e7eb); }

/* Progress */
.chat-progress {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.chat-progress__bar {
  height: 4px;
  background: var(--primary, #0F52BA);
  border-radius: 2px;
  transition: width 0.3s ease;
}
.chat-progress__label {
  font-size: 0.75rem;
  color: var(--base-content, #6b7280);
}

/* Reconnect notice */
.chat-notice {
  padding: 6px 16px;
  background: #fef3c7;
  color: #92400e;
  font-size: 0.8rem;
  text-align: center;
  flex-shrink: 0;
}
.chat-notice--hidden { display: none; }

/* Form */
.chat-panel__form {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--base-300, #e5e7eb);
  flex-shrink: 0;
}
.chat-panel__input {
  flex: 1;
  border: 1px solid var(--base-300, #e5e7eb);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.9rem;
  font-family: 'Inter', sans-serif;
  outline: none;
}
.chat-panel__input:focus {
  border-color: var(--primary, #0F52BA);
  box-shadow: 0 0 0 2px rgba(15, 82, 186, 0.15);
}
.chat-panel__send {
  background: var(--primary, #0F52BA);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.chat-panel__send:hover { opacity: 0.9; }
