/**
 * VitaLaw AI Chat Styles
 * Modern Slate Dark Theme - NO WHITE BACKGROUNDS
 */

/* ============================================
   CHAT TRIGGER BUTTON
   ============================================ */

.chat-trigger {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
  border: none;
  border-radius: 50%;
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #000;
  transition: all 0.3s ease;
  z-index: 9998;
}

.chat-trigger:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(245, 158, 11, 0.4);
}

.chat-trigger:active {
  transform: translateY(0);
}

.chat-trigger.hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.8);
}

.chat-notification-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  background: #dc2626;
  color: #fff;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  border: 2px solid #0a0a0a;
}

/* ============================================
   CHAT PANEL
   ============================================ */

.chat-panel {
  position: fixed;
  top: 0;
  right: -100%;
  width: 100%;
  max-width: 450px;
  height: 100vh;
  background: #0a0a0a;
  border-left: 1px solid #2e2e2e;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  transition: right 0.3s ease;
  z-index: 9999;
}

.chat-panel.open {
  right: 0;
}

/* ============================================
   CHAT HEADER
   ============================================ */

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  background: #1a1a1a;
  border-bottom: 1px solid #2e2e2e;
  flex-shrink: 0;
}

.chat-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-logo {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.chat-title {
  font-size: 16px;
  font-weight: 700;
  color: #f5f5f5;
  margin: 0;
  line-height: 1.2;
}

.chat-status {
  font-size: 12px;
  color: #10b981;
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-status::before {
  content: '';
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  display: inline-block;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

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

.chat-icon-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid #2e2e2e;
  border-radius: 8px;
  color: #d4d4d4;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chat-icon-btn:hover {
  background: #2a2a2a;
  border-color: #f59e0b;
  color: #f59e0b;
}

/* ============================================
   HISTORY SIDEBAR
   ============================================ */

.chat-history-sidebar {
  position: absolute;
  left: 0;
  top: 73px;
  width: 100%;
  height: calc(100% - 73px);
  background: #1a1a1a;
  border-right: 1px solid #2e2e2e;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  z-index: 10;
  display: flex;
  flex-direction: column;
}

.chat-history-sidebar:not(.hidden) {
  transform: translateX(0);
}

.chat-history-header {
  padding: 16px 20px;
  border-bottom: 1px solid #2e2e2e;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-history-header h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #f5f5f5;
}

.chat-history-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.chat-history-item {
  padding: 12px;
  background: #0a0a0a;
  border: 1px solid #2e2e2e;
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.chat-history-item:hover {
  background: #2a2a2a;
  border-color: #f59e0b;
}

.chat-history-item.active {
  background: #2a2a2a;
  border-color: #f59e0b;
}

.chat-history-item-content {
  flex: 1;
  min-width: 0;
}

.chat-history-item-preview {
  font-size: 13px;
  color: #f5f5f5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.chat-history-item-meta {
  font-size: 11px;
  color: #94a3b8;
}

.chat-history-delete {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.chat-history-delete:hover {
  background: #dc2626;
  color: #fff;
}

.chat-history-empty {
  padding: 40px 20px;
  text-align: center;
  color: #94a3b8;
  font-size: 14px;
}

/* ============================================
   MESSAGES CONTAINER
   ============================================ */

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  background: #0a0a0a;
  scroll-behavior: smooth;
}

/* Custom scrollbar */
.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: #2e2e2e;
  border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: #3a3a3a;
}

/* ============================================
   WELCOME MESSAGE
   ============================================ */

.chat-welcome {
  text-align: center;
  padding: 60px 20px;
}

.chat-welcome-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.9;
}

.chat-welcome h4 {
  font-size: 20px;
  font-weight: 700;
  color: #f5f5f5;
  margin: 0 0 8px 0;
}

.chat-welcome p {
  font-size: 14px;
  color: #94a3b8;
  margin: 0 0 24px 0;
  line-height: 1.5;
}

.chat-suggestions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 320px;
  margin: 0 auto;
}

/* ============================================
   MESSAGES
   ============================================ */

.chat-message {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  animation: fadeInUp 0.3s ease;
}

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

.chat-message-user {
  flex-direction: row-reverse;
}

.chat-message-avatar {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.chat-message-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.user-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
  color: #000;
  font-weight: 700;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-message-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-message-bubble {
  background: #1a1a1a;
  border: 1px solid #2e2e2e;
  border-radius: 16px;
  padding: 12px 16px;
  max-width: 85%;
}

.chat-message-user .chat-message-bubble {
  background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
  border: none;
  color: #000;
  margin-left: auto;
}

.chat-message-bubble p {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: inherit;
}

.chat-message-user .chat-message-bubble p {
  color: #000;
}

/* ============================================
   AGENT BADGE
   ============================================ */

.chat-agent-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid;
  margin-bottom: 8px;
}

.chat-agent-icon {
  font-size: 14px;
}

.chat-agent-name {
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ============================================
   AGENT CARDS
   ============================================ */

.chat-agent-card {
  background: #1a1a1a;
  border: 1px solid #2e2e2e;
  border-radius: 12px;
  padding: 16px;
  margin-top: 8px;
}

.chat-agent-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #2e2e2e;
}

.chat-agent-card-icon {
  font-size: 20px;
}

.chat-agent-card-header h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: #f5f5f5;
  flex: 1;
}

.chat-agent-card-count {
  font-size: 12px;
  color: #94a3b8;
  background: #2a2a2a;
  padding: 4px 10px;
  border-radius: 12px;
}

/* Case Search Card */
.chat-cases-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-case-item {
  background: #0a0a0a;
  border: 1px solid #2e2e2e;
  border-radius: 8px;
  padding: 12px;
  transition: all 0.2s ease;
}

.chat-case-item:hover {
  border-color: #f59e0b;
  background: #2a2a2a;
}

.chat-case-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.chat-case-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #f5f5f5;
  flex: 1;
}

.chat-case-citation {
  font-size: 12px;
  color: #f59e0b;
  font-weight: 500;
  white-space: nowrap;
}

.chat-case-summary {
  font-size: 13px;
  color: #d4d4d4;
  line-height: 1.5;
  margin: 0 0 8px 0;
}

.chat-case-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: #94a3b8;
  margin-bottom: 8px;
}

.chat-case-score {
  color: #10b981;
  font-weight: 600;
}

.chat-case-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #f59e0b;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.chat-case-link:hover {
  color: #fbbf24;
}

/* Summary Card */
.chat-summary-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  background: #0a0a0a;
  padding: 4px;
  border-radius: 8px;
}

.chat-summary-tab {
  flex: 1;
  padding: 8px 12px;
  background: transparent;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chat-summary-tab:hover {
  color: #f5f5f5;
  background: #2a2a2a;
}

.chat-summary-tab.active {
  background: #f59e0b;
  color: #000;
}

.chat-summary-content {
  position: relative;
}

.chat-summary-panel {
  display: none;
}

.chat-summary-panel.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.chat-summary-section {
  margin-bottom: 16px;
}

.chat-summary-section:last-child {
  margin-bottom: 0;
}

.chat-summary-section h5 {
  margin: 0 0 8px 0;
  font-size: 13px;
  font-weight: 600;
  color: #f59e0b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.chat-summary-section p {
  margin: 0;
  font-size: 13px;
  color: #d4d4d4;
  line-height: 1.6;
}

.chat-citations-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.chat-citations-list li {
  padding: 8px 0;
  font-size: 13px;
  color: #d4d4d4;
  border-bottom: 1px solid #2e2e2e;
}

.chat-citations-list li:last-child {
  border-bottom: none;
}

/* Argument Card */
.chat-argument-sections {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-argument-section {
  background: #0a0a0a;
  border: 1px solid #2e2e2e;
  border-radius: 8px;
  overflow: hidden;
}

.chat-argument-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #f5f5f5;
}

.chat-argument-toggle:hover {
  background: #2a2a2a;
}

.chat-argument-toggle.active {
  background: #2a2a2a;
}

.chat-argument-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
}

.chat-argument-icon {
  font-size: 16px;
}

.chat-argument-toggle svg {
  transition: transform 0.2s ease;
  color: #94a3b8;
}

.chat-argument-toggle.active svg {
  transform: rotate(180deg);
}

.chat-argument-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.chat-argument-content.active {
  max-height: 1000px;
  padding: 0 16px 16px 16px;
}

.chat-argument-content p {
  margin: 0;
  font-size: 13px;
  color: #d4d4d4;
  line-height: 1.6;
}

.chat-argument-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.chat-argument-list li {
  padding: 8px 0 8px 24px;
  font-size: 13px;
  color: #d4d4d4;
  line-height: 1.6;
  position: relative;
}

.chat-argument-list li::before {
  content: '▸';
  position: absolute;
  left: 8px;
  color: #f59e0b;
}

/* Maps Card */
.chat-maps-embed {
  margin-bottom: 16px;
  border-radius: 8px;
  overflow: hidden;
  background: #0a0a0a;
  border: 1px solid #2e2e2e;
}

.chat-maps-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
}

.chat-maps-stat {
  background: #0a0a0a;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #2e2e2e;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chat-maps-stat-label {
  font-size: 11px;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.chat-maps-stat-value {
  font-size: 15px;
  font-weight: 600;
  color: #f5f5f5;
}

/* Document Card */
.chat-document-status {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: #0a0a0a;
  border: 1px solid;
  border-radius: 8px;
  margin-bottom: 12px;
}

.chat-document-status-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.chat-document-status-label {
  font-size: 11px;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.chat-document-status-value {
  font-size: 14px;
  font-weight: 600;
  color: #f5f5f5;
}

.chat-document-info {
  font-size: 13px;
  color: #d4d4d4;
  margin-bottom: 8px;
}

.chat-document-summary {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #2e2e2e;
}

.chat-document-summary strong {
  display: block;
  font-size: 12px;
  color: #f59e0b;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.chat-document-summary p {
  margin: 0;
  font-size: 13px;
  color: #d4d4d4;
  line-height: 1.6;
}

/* Error Card */
.chat-error-card {
  background: #dc262620;
  border: 1px solid #dc262640;
  border-radius: 8px;
  padding: 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.chat-error-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.chat-error-content h4 {
  margin: 0 0 6px 0;
  font-size: 14px;
  font-weight: 600;
  color: #dc2626;
}

.chat-error-content p {
  margin: 0;
  font-size: 13px;
  color: #d4d4d4;
  line-height: 1.5;
}

/* ============================================
   FOLLOW-UPS
   ============================================ */

.chat-follow-ups {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
}

.chat-follow-ups-label {
  font-size: 11px;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.chat-suggestion-btn {
  text-align: left;
  padding: 10px 14px;
  background: #1a1a1a;
  border: 1px solid #2e2e2e;
  border-radius: 8px;
  color: #d4d4d4;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chat-suggestion-btn:hover {
  background: #2a2a2a;
  border-color: #f59e0b;
  color: #f59e0b;
}

/* ============================================
   TYPING INDICATOR
   ============================================ */

.chat-typing {
  padding: 0 24px 12px 24px;
  display: flex;
  gap: 12px;
  animation: fadeInUp 0.3s ease;
}

.chat-typing.hidden {
  display: none;
}

.chat-typing-avatar {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.chat-typing-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

.chat-typing-bubble {
  background: #1a1a1a;
  border: 1px solid #2e2e2e;
  border-radius: 16px;
  padding: 12px 16px;
  display: flex;
  gap: 6px;
}

.chat-typing-bubble span {
  width: 8px;
  height: 8px;
  background: #94a3b8;
  border-radius: 50%;
  animation: typing 1.4s ease-in-out infinite;
}

.chat-typing-bubble span:nth-child(2) {
  animation-delay: 0.2s;
}

.chat-typing-bubble span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.5;
  }
  30% {
    transform: translateY(-8px);
    opacity: 1;
  }
}

/* ============================================
   INPUT AREA
   ============================================ */

.chat-input-container {
  flex-shrink: 0;
  background: #1a1a1a;
  border-top: 1px solid #2e2e2e;
  padding: 16px 20px;
}

.chat-input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  background: #0a0a0a;
  border: 1px solid #2e2e2e;
  border-radius: 12px;
  padding: 8px 8px 8px 16px;
  transition: border-color 0.2s ease;
}

.chat-input-wrapper:focus-within {
  border-color: #f59e0b;
}

.chat-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #f5f5f5;
  font-size: 14px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  resize: none;
  max-height: 120px;
  line-height: 1.5;
}

.chat-input::placeholder {
  color: #94a3b8;
}

.chat-send-btn {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
  border: none;
  border-radius: 8px;
  color: #000;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.chat-send-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.chat-send-btn:active {
  transform: translateY(0);
}

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

.chat-input-footer {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-tier-info {
  font-size: 11px;
  color: #94a3b8;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
  .chat-panel {
    max-width: 100%;
  }

  .chat-trigger {
    bottom: 16px;
    right: 16px;
    width: 56px;
    height: 56px;
  }

  .chat-messages {
    padding: 16px;
  }

  .chat-message-bubble {
    max-width: 90%;
  }

  .chat-input-container {
    padding: 12px 16px;
  }
}

@media (max-width: 480px) {
  .chat-header {
    padding: 16px;
  }

  .chat-title {
    font-size: 14px;
  }

  .chat-logo {
    width: 32px;
    height: 32px;
  }

  .chat-icon-btn {
    width: 32px;
    height: 32px;
  }

  .chat-messages {
    padding: 12px;
  }

  .chat-message-bubble {
    max-width: 95%;
  }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

.chat-trigger:focus-visible,
.chat-icon-btn:focus-visible,
.chat-send-btn:focus-visible,
.chat-suggestion-btn:focus-visible {
  outline: 2px solid #f59e0b;
  outline-offset: 2px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  .chat-panel,
  .chat-trigger,
  .chat-message,
  * {
    animation: none !important;
    transition: none !important;
  }
}
