/* Chat Widget Styles - Jewelry-Inspired Design */

.chat-widget-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.chat-bubble {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #c1c4c8 0%, #7b7f85 100%);
  box-shadow: 0 4px 12px rgba(123, 127, 133, 0.45);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  position: relative;
}

.chat-bubble:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(123, 127, 133, 0.62);
}

.chat-bubble svg {
  width: 28px;
  height: 28px;
  fill: white;
}

.chat-bubble .badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #2b2e33;
  color: #f5f6f7;
  border-radius: 50%;
  min-width: 20px;
  height: 20px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: bold;
  box-shadow: 0 2px 4px rgba(43, 46, 51, 0.4);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

.chat-bubble .badge:empty {
  display: none;
}

.chat-panel {
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: 380px;
  max-height: 600px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 1001;
}

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

.chat-panel-header {
  background: linear-gradient(135deg, #c1c4c8 0%, #7b7f85 100%);
  color: white;
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-panel-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

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

.chat-mark-all-read {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 0.2s;
}

.chat-mark-all-read:hover {
  background: rgba(255, 255, 255, 0.3);
}

.chat-panel-close {
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.2s;
}

.chat-panel-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.chat-panel-tabs {
  display: flex;
  background: #f3f4f6;
  border-bottom: 1px solid #e5e7eb;
}

.chat-tab {
  flex: 1;
  padding: 12px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: #6b7280;
  transition: all 0.2s;
  border-bottom: 2px solid transparent;
}

.chat-tab:hover {
  background: #e5e7eb;
}

.chat-tab.active {
  color: #7b7f85;
  border-bottom-color: #7b7f85;
  background: white;
}

.chat-panel-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-list-view {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #f9fafb;
}

.chat-conversations {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #f9fafb;
}

.chat-thread-card {
  margin-bottom: 12px;
  padding: 12px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  cursor: pointer;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.chat-thread-card:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  transform: translateX(2px);
}

.chat-thread-card.unread {
  border-left-color: #7b7f85;
  background: #f5f6f7;
}

.chat-thread-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 12px;
  gap: 8px;
}

.chat-thread-preview {
  color: #4b5563;
  font-size: 13px;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.chat-thread-time {
  color: #9ca3af;
  font-size: 11px;
  white-space: nowrap;
}

.chat-unread-badge {
  background: #2b2e33;
  color: #f5f6f7;
  border-radius: 10px;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: bold;
  min-width: 18px;
  text-align: center;
}

.chat-thread-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-thread-header {
  padding: 12px 16px;
  background: white;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-thread-back {
  background: none;
  border: none;
  color: #7b7f85;
  font-size: 14px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 0.2s;
}

.chat-thread-back:hover {
  background: #f3f4f6;
}

.chat-thread-title {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
}

.chat-thread-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #f9fafb;
}

.chat-thread-message {
  margin-bottom: 16px;
  padding: 12px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.chat-thread-message.outbound {
  background: linear-gradient(135deg, #f5f6f7 0%, #c1c4c8 100%);
}

.chat-thread-message.inbound {
  background: white;
}

.chat-thread-message-author {
  font-weight: 600;
  color: #4b5563;
  font-size: 13px;
  margin-bottom: 4px;
}

.chat-thread-message-text {
  color: #111827;
  line-height: 1.5;
  margin-bottom: 4px;
}

.chat-thread-message-time {
  font-size: 11px;
  color: #9ca3af;
}

.chat-message {
  margin-bottom: 16px;
  padding: 12px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.chat-message-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 12px;
  color: #6b7280;
}

.chat-message-type {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.chat-message-type.request {
  background: #f5f6f7;
  color: #2b2e33;
}

.chat-message-type.problem {
  background: #e5e7eb;
  color: #2b2e33;
}

.chat-message-text {
  color: #111827;
  line-height: 1.5;
  margin-bottom: 8px;
}

.chat-replies {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #e5e7eb;
}

.chat-reply {
  padding: 8px;
  margin-bottom: 8px;
  background: #f3f4f6;
  border-radius: 6px;
  font-size: 13px;
}

.chat-reply-author {
  font-weight: 600;
  color: #4b5563;
  margin-bottom: 4px;
}

.chat-reply-text {
  color: #111827;
}

.chat-reply-time {
  font-size: 11px;
  color: #9ca3af;
  margin-top: 4px;
}

.chat-form {
  padding: 16px;
  background: white;
  border-top: 1px solid #e5e7eb;
}

.chat-form-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.chat-form-toggle button {
  flex: 1;
  padding: 8px 12px;
  border: 2px solid #e5e7eb;
  background: white;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s;
}

.chat-form-toggle button.active {
  background: linear-gradient(135deg, #c1c4c8 0%, #7b7f85 100%);
  color: white;
  border-color: transparent;
}

.chat-form-textarea {
  width: 100%;
  min-height: 80px;
  padding: 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  margin-bottom: 8px;
}

.chat-form-textarea:focus {
  outline: none;
  border-color: #7b7f85;
  box-shadow: 0 0 0 3px rgba(123, 127, 133, 0.2);
}

.chat-form-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 13px;
  color: #4b5563;
}

.chat-form-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.chat-form-actions {
  display: flex;
  gap: 8px;
}

.chat-form-new-thread {
  padding: 10px 16px;
  background: white;
  color: #7b7f85;
  border: 1px solid #7b7f85;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.chat-form-new-thread:hover {
  background: #f3f4f6;
}

.chat-form-send {
  flex: 1;
  padding: 10px 16px;
  background: linear-gradient(135deg, #c1c4c8 0%, #7b7f85 100%);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.chat-form-send:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(123, 127, 133, 0.4);
}

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

.chat-error {
  padding: 12px;
  background: #e5e7eb;
  color: #2b2e33;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 12px;
}

.chat-disabled {
  padding: 12px;
  background: #f3f4f6;
  color: #6b7280;
  border-radius: 6px;
  font-size: 13px;
  text-align: center;
}

/* Scrollbar styling */
.chat-conversations::-webkit-scrollbar {
  width: 6px;
}

.chat-conversations::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.chat-conversations::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.chat-conversations::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

