/**
 * Support Chat - Pixel-Approved Design System
 * Modern chat UI for the Unified Widget
 */

.support-chat-messages {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem;
  overflow-y: auto;
  max-height: 400px;
  background: rgba(5, 5, 5, 0.4);
}

.chat-message {
  max-width: 85%;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  position: relative;
  font-size: 0.9rem;
  line-height: 1.5;
  animation: messageSlideIn 0.3s ease-out;
}

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

/* User Messages */
.user-message {
  align-self: flex-end;
  background: var(--neon-cyan, #00f0ff);
  color: #050505;
  border-bottom-right-radius: 2px;
  box-shadow: 0 4px 15px rgba(0, 240, 255, 0.2);
}

.user-message .message-sender {
  color: #050505;
  font-weight: 700;
}

.user-message .message-time {
  color: rgba(5, 5, 5, 0.6);
}

/* Bot Messages */
.bot-message {
  align-self: flex-start;
  background: rgba(30, 45, 50, 0.8);
  border: 1px solid rgba(0, 240, 255, 0.2);
  color: var(--text-main, #e0e6ed);
  border-bottom-left-radius: 2px;
  backdrop-filter: blur(5px);
}

.bot-message .message-sender {
  color: var(--neon-cyan, #00f0ff);
}

/* Message Grouping */
.message-grouped {
  margin-top: -0.5rem;
}

.message-group-start {
  margin-top: 0.5rem;
}

/* Components inside messages */
.message-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
  font-family: var(--font-tech, "Space Mono", monospace);
  font-size: 0.75rem;
}

.message-avatar {
  font-size: 1rem;
}

.message-time {
  margin-left: auto;
  opacity: 0.6;
}

.message-content {
  word-break: break-word;
}

.message-content p {
  margin: 0.5rem 0;
}

.message-content p:first-child {
  margin-top: 0;
}

.message-content p:last-child {
  margin-bottom: 0;
}

/* Formatting Elements */
.code-block {
  background: rgba(0, 0, 0, 0.5);
  padding: 0.75rem;
  border-radius: 4px;
  font-family: "Space Mono", monospace;
  font-size: 0.8rem;
  overflow-x: auto;
  border-left: 2px solid var(--neon-cyan, #00f0ff);
  margin: 0.5rem 0;
}

.inline-code {
  background: rgba(0, 0, 0, 0.2);
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  font-family: "Space Mono", monospace;
}

.message-link {
  color: var(--neon-cyan, #00f0ff);
  text-decoration: underline;
}

.message-list {
  padding-left: 1.25rem;
  margin: 0.5rem 0;
}

.message-quote {
  border-left: 3px solid rgba(0, 240, 255, 0.5);
  padding-left: 1rem;
  margin: 0.5rem 0;
  font-style: italic;
  color: var(--text-muted, #6b7a8f);
}

/* Rich Content Blocks */
.rich-content-block {
  margin: 1rem 0;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(0, 240, 255, 0.2);
  border-radius: 8px;
  animation: contentSlideIn 0.4s ease-out;
}

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

.chart-container,
.graph-container {
  margin: 1rem 0;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 6px;
}

.chart-container canvas {
  max-width: 100%;
  height: auto;
}

.chart-container img,
.graph-container img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

.table-container {
  overflow-x: auto;
  margin: 1rem 0;
}

.rich-content-table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(0, 0, 0, 0.3);
}

.rich-content-table th {
  background: rgba(0, 240, 255, 0.2);
  color: var(--neon-cyan, #00f0ff);
  padding: 0.75rem;
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid rgba(0, 240, 255, 0.3);
}

.rich-content-table td {
  padding: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-main, #e0e6ed);
}

.rich-content-table tr:hover {
  background: rgba(0, 240, 255, 0.05);
}

.image-container {
  margin: 1rem 0;
  text-align: center;
}

.image-container img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  border: 1px solid rgba(0, 240, 255, 0.2);
}

.image-caption {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted, #6b7a8f);
  font-style: italic;
}

.code-container {
  margin: 1rem 0;
}

.code-container pre {
  background: rgba(0, 0, 0, 0.6);
  padding: 1rem;
  border-radius: 6px;
  overflow-x: auto;
  border-left: 3px solid var(--neon-cyan, #00f0ff);
}

.code-container code {
  font-family: "Space Mono", monospace;
  font-size: 0.85rem;
  line-height: 1.6;
}

.link-container {
  margin: 1rem 0;
  padding: 1rem;
  background: rgba(0, 240, 255, 0.1);
  border: 1px solid rgba(0, 240, 255, 0.3);
  border-radius: 6px;
  transition: all 0.2s;
}

.link-container:hover {
  background: rgba(0, 240, 255, 0.15);
  border-color: var(--neon-cyan, #00f0ff);
}

.rich-link {
  display: block;
  color: var(--neon-cyan, #00f0ff);
  text-decoration: none;
}

.rich-link:hover {
  color: var(--neon-cyan, #00f0ff);
  text-decoration: underline;
}

.rich-link strong {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
}

.rich-link p {
  margin: 0.5rem 0;
  color: var(--text-main, #e0e6ed);
}

.link-url {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted, #6b7a8f);
  margin-top: 0.5rem;
  word-break: break-all;
}

/* Unified Chat Interface */
.unified-chat-interface {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.chat-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  flex: 1;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.chat-input-container {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 1rem;
  background: rgba(0, 0, 0, 0.2);
}

.input-wrapper {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.chat-input {
  flex: 1;
  padding: 0.75rem 1rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: var(--text-main, #fff);
  font-family: inherit;
  font-size: 0.9rem;
  resize: none;
}

.chat-input:focus {
  outline: none;
  border-color: var(--neon-cyan, #00f0ff);
  box-shadow: 0 0 0 2px rgba(0, 240, 255, 0.2);
}

.chat-send {
  padding: 0.75rem 1.5rem;
  background: var(--neon-cyan, #00f0ff);
  color: #000;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s;
}

.chat-send:hover:not(:disabled) {
  background: #00d9e6;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 240, 255, 0.4);
}

.chat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.chat-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

.chat-action-btn {
  padding: 0.5rem 1rem;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  color: var(--text-muted, #888);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chat-action-btn:hover {
  border-color: var(--neon-cyan, #00f0ff);
  color: var(--neon-cyan, #00f0ff);
}

/* Widget Header Updates */
.widget-header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
}

.widget-header-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.widget-icon {
  font-size: 1.5rem;
}

.widget-header-title h2 {
  margin: 0;
  font-size: 1.2rem;
  color: var(--text-main, #fff);
}

/* Feedback Buttons */
.message-feedback {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(0, 240, 255, 0.1);
}

.feedback-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  opacity: 0.5;
  transition: all 0.2s;
  padding: 2px 5px;
  border-radius: 4px;
}

.feedback-btn:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.1);
}

.feedback-btn.active {
  opacity: 1;
  background: rgba(0, 240, 255, 0.2);
}

/* Typing Indicator */
.typing-indicator {
  align-self: flex-start;
  padding: 0.5rem 1rem;
  background: rgba(30, 45, 50, 0.5);
  border-radius: 12px;
  display: flex;
  gap: 4px;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background: var(--neon-cyan, #00f0ff);
  border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out both;
}

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

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