/* Embedded On-Page Case Intake & Consultation Chat Desk */
.embedded-chat-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 60px rgba(6, 14, 26, 0.35);
  border: 1px solid var(--gold-border);
  display: flex;
  flex-direction: column;
  height: 640px;
  overflow: hidden;
  position: relative;
}

/* Chat Header */
.embedded-chat-header {
  background: linear-gradient(135deg, var(--primary-navy), var(--secondary-navy));
  color: #ffffff;
  padding: 1.1rem 1.4rem;
  border-bottom: 2px solid var(--gold-accent);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.desk-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.desk-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #0f1e36;
  border: 2px solid var(--gold-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: var(--gold-light);
}

.desk-meta h3 {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  color: #ffffff;
  font-weight: 700;
  margin-bottom: 0.15rem;
}

.desk-meta p {
  font-size: 0.74rem;
  color: var(--gold-light);
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-clear-chat {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  font-size: 0.72rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s;
  font-family: inherit;
}

.btn-clear-chat:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: var(--gold-light);
  color: var(--gold-light);
}

.encryption-pill {
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #34d399;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 50px;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Clean Empty State on Page Start */
.chat-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  height: 100%;
  min-height: 280px;
  padding: 2.5rem 1.5rem;
  color: var(--text-muted);
  user-select: none;
}

.chat-empty-state .empty-icon {
  font-size: 2.6rem;
  margin-bottom: 0.8rem;
  color: var(--gold-accent);
}

.chat-empty-state h4 {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  color: var(--primary-navy);
  margin-bottom: 0.4rem;
  font-weight: 600;
}

.chat-empty-state p {
  font-size: 0.86rem;
  color: var(--text-secondary);
  max-width: 320px;
  line-height: 1.55;
}

/* In-Chat Consultation Cards & Messages */

/* Chat Messages Stream */
.chat-messages-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.2rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: #ffffff;
}

.msg-row {
  display: flex;
  gap: 10px;
  max-width: 88%;
  animation: fadeInMsg 0.25s ease-out;
}

@keyframes fadeInMsg {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.msg-row.agent {
  align-self: flex-start;
}

.msg-row.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.msg-avatar-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-navy);
  color: var(--gold-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
  border: 1px solid var(--gold-border);
}

.msg-bubble-wrap {
  display: flex;
  flex-direction: column;
}

.msg-bubble {
  padding: 0.85rem 1.15rem;
  border-radius: 14px;
  font-size: 0.9rem;
  line-height: 1.55;
}

.msg-row.agent .msg-bubble {
  background: #f8fafc;
  color: #1e293b;
  border: 1px solid #e2e8f0;
  border-top-left-radius: 4px;
}

.msg-row.agent .msg-bubble p {
  margin-bottom: 0.6rem;
  line-height: 1.55;
}

.msg-row.agent .msg-bubble p:last-child {
  margin-bottom: 0;
}

.msg-row.agent .msg-bubble h1,
.msg-row.agent .msg-bubble h2,
.msg-row.agent .msg-bubble h3,
.msg-row.agent .msg-bubble h4 {
  font-family: var(--font-serif);
  color: var(--primary-navy);
  margin-top: 0.85rem;
  margin-bottom: 0.4rem;
  line-height: 1.35;
}

.msg-row.agent .msg-bubble h1 { font-size: 1.15rem; }
.msg-row.agent .msg-bubble h2 { font-size: 1.05rem; }
.msg-row.agent .msg-bubble h3 {
  font-size: 0.98rem;
  font-weight: 700;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 0.25rem;
  color: var(--primary-navy);
}
.msg-row.agent .msg-bubble h4 { font-size: 0.92rem; font-weight: 600; }

.msg-row.agent .msg-bubble ul,
.msg-row.agent .msg-bubble ol {
  margin: 0.4rem 0 0.6rem 1.25rem;
  padding-left: 0.25rem;
}

.msg-row.agent .msg-bubble li {
  margin-bottom: 0.35rem;
  line-height: 1.5;
}

.msg-row.agent .msg-bubble hr {
  border: 0;
  border-top: 1px solid #e2e8f0;
  margin: 0.75rem 0;
}

.msg-row.agent .msg-bubble blockquote {
  border-left: 3px solid var(--gold-accent);
  margin: 0.6rem 0;
  padding: 0.4rem 0.8rem;
  background: #f1f5f9;
  color: #475569;
  font-style: italic;
  border-radius: 0 4px 4px 0;
}

.msg-row.agent .msg-bubble strong {
  color: #0b1a30;
  font-weight: 700;
}

.msg-row.agent .msg-bubble code {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.82rem;
  color: #b45309;
  font-family: monospace;
}

.msg-row.agent .msg-bubble table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.6rem 0;
  font-size: 0.82rem;
}

.msg-row.agent .msg-bubble th,
.msg-row.agent .msg-bubble td {
  border: 1px solid #e2e8f0;
  padding: 0.35rem 0.6rem;
  text-align: left;
}

.msg-row.agent .msg-bubble th {
  background: #f1f5f9;
  font-weight: 600;
}

.msg-row.user .msg-bubble {
  background: linear-gradient(135deg, var(--primary-navy), var(--secondary-navy));
  color: #ffffff;
  border-top-right-radius: 4px;
  box-shadow: 0 4px 12px rgba(11, 26, 48, 0.15);
}

.msg-time-tag {
  font-size: 0.68rem;
  color: #94a3b8;
  margin-top: 0.35rem;
  text-align: right;
}

.msg-row.agent .msg-time-tag {
  text-align: left;
}

/* System Notifications */
.msg-row.system {
  align-self: center;
  max-width: 95%;
  margin: 0.3rem 0;
}

.system-banner {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
  font-size: 0.8rem;
  padding: 0.55rem 0.9rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}



/* Document Upload Drawer */
.upload-status-bar {
  display: none;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  padding: 0.55rem 1.4rem;
  font-size: 0.78rem;
}

.upload-status-bar.active {
  display: block;
}

/* Chat Input Bar */
.chat-controls-bar {
  padding: 0.75rem 1.4rem;
  background: #ffffff;
  border-top: 1px solid var(--border-subtle);
}

.input-box-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.8rem;
  transition: border-color 0.2s;
}

.input-box-wrapper:focus-within {
  border-color: var(--gold-accent);
  box-shadow: 0 0 0 2px rgba(197, 160, 89, 0.15);
}

.chat-input-field {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-family: inherit;
  font-size: 0.92rem;
  color: var(--text-primary);
  resize: none;
  max-height: 80px;
  line-height: 1.4;
}

.btn-upload-file {
  background: none;
  border: none;
  color: #64748b;
  cursor: pointer;
  font-size: 1.25rem;
  padding: 4px;
  transition: color 0.2s;
  display: flex;
  align-items: center;
}

.btn-upload-file:hover {
  color: var(--primary-navy);
}

.btn-send-chat {
  background: var(--primary-navy);
  color: #ffffff;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-send-chat:hover {
  background: var(--gold-hover);
  color: var(--primary-navy);
}

/* Bottom Action Strip */
.chat-bottom-actions {
  padding: 0.5rem 1.4rem 0.85rem;
  background: #ffffff;
}

/* Bottom Confirmation Strip (replaces submit button upon case submission) */
.case-submission-confirmation {
  width: 100%;
  background: #ecfdf5;
  border: 1px solid #10b981;
  color: #065f46;
  font-weight: 700;
  font-size: 0.88rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.15);
  animation: fadeInMsg 0.3s ease-out;
}

/* Typing Indicator */
.typing-dots {
  display: flex;
  gap: 4px;
  padding: 8px 12px;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #94a3b8;
  animation: typingBounce 1.4s infinite ease-in-out;
}

.dot:nth-child(1) { animation-delay: -0.32s; }
.dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingBounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* In-Chat System & Document & Submission Cards */
.msg-row.system-card-row {
  align-self: center;
  width: 100%;
  max-width: 95%;
  margin: 0.4rem 0;
  animation: fadeInMsg 0.3s ease-out;
}

/* In-Chat Document Review Card */
.inchat-doc-card {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-left: 4px solid var(--gold-accent);
  border-radius: 8px;
  padding: 0.9rem 1.1rem;
  width: 100%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.doc-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 0.6rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid #e2e8f0;
}

.doc-card-header .doc-icon {
  font-size: 1.4rem;
}

.doc-meta-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.doc-meta-title strong {
  color: var(--primary-navy);
  font-size: 0.88rem;
}

.doc-badge-verified {
  font-size: 0.72rem;
  color: #059669;
  font-weight: 600;
}

.doc-details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem 0.8rem;
  font-size: 0.78rem;
  color: #334155;
}

.doc-details-grid .lbl {
  color: #64748b;
  font-weight: 500;
}

/* In-Chat Case Dossier Registration Card */
.inchat-dossier-card {
  background: linear-gradient(to bottom, #ffffff, #fcfaf6);
  border: 1.5px solid var(--gold-accent);
  border-radius: 10px;
  padding: 1.2rem;
  width: 100%;
  box-shadow: 0 8px 24px rgba(197, 160, 89, 0.18);
}

.card-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--gold-subtle);
  border: 1px solid var(--gold-border);
  color: var(--primary-navy);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.65rem;
  border-radius: 50px;
  margin-bottom: 0.6rem;
}

.card-title-row h4 {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  color: var(--primary-navy);
  margin-bottom: 0.8rem;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 0.5rem;
}

.card-title-row h4 code {
  color: var(--gold-hover);
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 1rem;
}

.card-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem 1rem;
  margin-bottom: 1rem;
}

.card-meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.meta-label {
  font-size: 0.7rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.meta-val {
  font-size: 0.86rem;
  color: var(--primary-navy);
  font-weight: 600;
}

.status-badge-pill {
  display: inline-block;
  background: #dbeafe;
  color: #1e40af;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 700;
  width: fit-content;
}

.card-footer-note {
  font-size: 0.78rem;
  color: #475569;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  padding: 0.65rem 0.9rem;
  border-radius: 6px;
  line-height: 1.5;
}


/* Starter prompts */
.chat-starters { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 1.2rem; width: 100%; max-width: 340px; }
.starter-chip {
  font-family: inherit; font-size: 0.84rem; font-weight: 600; text-align: left; color: var(--primary-navy);
  background: #ffffff; border: 1px solid var(--gold-border); border-radius: 10px; padding: 0.65rem 0.9rem; cursor: pointer;
  transition: all 0.2s;
}
.starter-chip:hover { background: var(--gold-subtle); border-color: var(--gold-accent); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.chat-messages-body { scroll-behavior: smooth; }
.msg-row.user .msg-bubble.markdown-body a { color: var(--gold-light); }
@media (max-width: 600px) {
  .embedded-chat-card { height: 560px; }
  .desk-meta h3 { font-size: 1rem; }
  .encryption-pill { display: none; }
}
