/* 
 * Trackara Shop Portal - Chat Styles
 * CSS for the enhanced customer chat interface
 */

/* Main chat container */
.chat-interface {
  display: flex;
  height: calc(100vh - 180px);
  min-height: 500px;
  background-color: var(--bg-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  position: relative;
  transition: height 0.3s ease;
}

/* Sidebar styles */
.chat-sidebar {
  width: 320px;
  background-color: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  height: 100%;
  z-index: 2;
  transition: width 0.3s ease;
}

.search-container {
  padding: 16px;
  border-bottom: 1px solid var(--color-border);
}

.search-container .form-control-icon {
  position: relative;
}

.search-container .form-control-icon i {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-tertiary);
  font-size: 1rem;
  z-index: 1;
}

.search-container .form-control {
  padding-left: 40px;
  border-radius: 24px;
  background-color: var(--color-surface-hover);
  transition: all 0.2s ease;
}

.search-container .form-control:focus {
  background-color: var(--color-surface);
  box-shadow: 0 0 0 2px rgba(var(--teal-500-rgb), 0.15);
}

[data-theme="dark"] .search-container .form-control:focus {
  box-shadow: 0 0 0 2px rgba(var(--teal-400-rgb), 0.2);
}

.conversation-list {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--color-text-disabled) transparent;
}

.conversation-list::-webkit-scrollbar {
  width: 6px;
}

.conversation-list::-webkit-scrollbar-track {
  background: transparent;
}

.conversation-list::-webkit-scrollbar-thumb {
  background-color: var(--color-text-disabled);
  border-radius: 3px;
}

/* Conversation item styles */
.conversation-item {
  padding: 16px;
  border-bottom: 1px solid var(--color-divider);
  cursor: pointer;
  transition: background-color 0.2s ease;
  position: relative;
  display: flex;
  align-items: flex-start;
}

.conversation-item:hover {
  background-color: var(--color-surface-hover);
}

.conversation-item.active {
  background-color: rgba(var(--teal-500-rgb), 0.08);
}

[data-theme="dark"] .conversation-item.active {
  background-color: rgba(var(--teal-400-rgb), 0.15);
}

.conversation-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  flex-shrink: 0;
  margin-right: 12px;
}

/* Avatar colors */
.avatar-blue { background-color: #3b82f6; }
.avatar-green { background-color: #10b981; }
.avatar-purple { background-color: #8b5cf6; }
.avatar-pink { background-color: #ec4899; }
.avatar-indigo { background-color: #6366f1; }
.avatar-red { background-color: #ef4444; }
.avatar-teal { background-color: var(--color-primary-main); }

.conversation-content {
  overflow: hidden;
  flex: 1;
  min-width: 0; /* Prevents content from pushing beyond container */
}

.conversation-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.conversation-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--color-text-primary);
}

.conversation-time {
  font-size: 0.75rem;
  color: var(--color-text-tertiary);
  white-space: nowrap;
  margin-left: 8px;
}

.conversation-preview {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.conversation-vehicle {
  font-size: 0.75rem;
  color: var(--color-text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
}

.conversation-vehicle i {
  margin-right: 4px;
  color: var(--color-primary-main);
}

.conversation-unread {
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  background-color: var(--color-primary-main);
  color: white;
  font-size: 0.75rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  position: absolute;
  top: 16px;
  right: 16px;
}

/* Chat main area styles */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-width: 0; /* Ensures proper flex behavior */
}

/* Chat header styles */
.chat-header {
  padding: 16px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--color-surface);
  height: 76px;
  flex-shrink: 0;
}

.chat-user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.chat-user-name-container {
  overflow: hidden;
  flex: 1;
}

.chat-user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  flex-shrink: 0;
}

.chat-user-name {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--color-text-primary);
}

#chat-last-active {
  font-size: 0.75rem;
  color: var(--color-text-tertiary);
  white-space: nowrap;
}

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

.chat-action-button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chat-action-button:hover {
  background-color: var(--color-surface-hover);
  color: var(--color-primary-main);
}

.customer-vehicle-info,
.customer-appointment-info {
  font-size: 0.75rem;
  background-color: var(--color-surface-hover);
  color: var(--color-text-secondary);
  padding: 4px 10px;
  border-radius: 16px;
  margin-left: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
  display: inline-block;
}

.customer-vehicle-info i,
.customer-appointment-info i {
  margin-right: 4px;
  color: var(--color-primary-main);
}

.appointment-status {
  display: inline-block;
  height: 8px;
  width: 8px;
  border-radius: 50%;
  margin-left: 4px;
  position: relative;
  top: -1px;
}

.appointment-status.confirmed,
.appointment-status.scheduled {
  background-color: var(--warning-main);
}

.appointment-status.completed {
  background-color: var(--success-main);
}

.appointment-status.cancelled {
  background-color: var(--error-main);
}

.appointment-status.in-progress {
  background-color: var(--info-main);
}

/* Messages area styles */
.chat-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  background-color: var(--bg-light);
  display: flex;
  flex-direction: column;
  scroll-behavior: smooth;
  position: relative;
  scrollbar-width: thin;
  scrollbar-color: var(--color-text-disabled) transparent;
}

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

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

.chat-messages::-webkit-scrollbar-thumb {
  background-color: var(--color-text-disabled);
  border-radius: 3px;
}

/* Message styling */
.message {
  max-width: 75%;
  display: flex;
  flex-direction: column;
  position: relative;
  margin-bottom: 8px;
  animation: message-fade-in 0.3s ease;
}

@keyframes message-fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message.outgoing {
  align-self: flex-end;
}

.message.incoming {
  align-self: flex-start;
}

.message-bubble {
  padding: 12px 16px;
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
  line-height: 1.4;
}

.message.outgoing .message-bubble {
  background-color: var(--color-primary-main);
  color: white;
  border-bottom-right-radius: 4px;
}

.message.incoming .message-bubble {
  background-color: var(--color-surface);
  color: var(--color-text-primary);
  border-bottom-left-radius: 4px;
}

.message-time {
  font-size: 0.7rem;
  margin-top: 4px;
  text-align: right;
}

.message.outgoing .message-time {
  color: rgba(255, 255, 255, 0.8);
}

.message.incoming .message-time {
  color: var(--color-text-tertiary);
}

.message-date-separator {
  display: flex;
  align-items: center;
  margin: 16px 0;
  color: var(--color-text-tertiary);
  text-align: center;
  font-size: 0.75rem;
}

.message-date-separator::before,
.message-date-separator::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--color-divider);
}

.message-date-separator span {
  margin: 0 10px;
  padding: 0 5px;
  background-color: var(--bg-light);
}

/* Quick response buttons */
.quick-response-container {
  padding: 8px 16px;
  background-color: var(--color-surface);
  border-top: 1px solid var(--color-border);
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: thin;
  scrollbar-color: var(--color-text-disabled) transparent;
  flex-shrink: 0;
}

.quick-response-container::-webkit-scrollbar {
  height: 4px;
}

.quick-response-container::-webkit-scrollbar-track {
  background: transparent;
}

.quick-response-container::-webkit-scrollbar-thumb {
  background-color: var(--color-text-disabled);
  border-radius: 2px;
}

.quick-response-scroll {
  display: flex;
  gap: 8px;
  padding-bottom: 6px;
}

.quick-response-btn {
  background-color: var(--color-surface-hover);
  color: var(--color-primary-main);
  border: 1px solid var(--color-primary-main);
  border-radius: 16px;
  padding: 6px 12px;
  font-size: 0.8rem;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.quick-response-btn:hover {
  background-color: var(--color-primary-main);
  color: white;
}

/* Input area styles */
.chat-input-container {
  padding: 16px;
  border-top: 1px solid var(--color-border);
  background-color: var(--color-surface);
  z-index: 1;
  flex-shrink: 0;
}

.chat-input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

#chat-input {
  flex: 1;
  border: 1px solid var(--color-border);
  background-color: var(--color-surface);
  resize: none;
  padding: 12px 16px;
  border-radius: 18px;
  max-height: 120px;
  overflow-y: auto;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  line-height: 1.4;
  box-shadow: var(--shadow-sm);
  min-height: 24px;
  font-size: 0.95rem;
}

#chat-input:focus {
  outline: none;
  border-color: var(--color-primary-main);
  box-shadow: 0 0 0 2px rgba(var(--teal-500-rgb), 0.15);
}

[data-theme="dark"] #chat-input:focus {
  box-shadow: 0 0 0 2px rgba(var(--teal-400-rgb), 0.2);
}

#send-message {
  background-color: var(--color-primary-main);
  color: white;
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s ease;
  flex-shrink: 0;
}

#send-message:hover:not(:disabled) {
  background-color: var(--color-primary-dark);
}

#send-message:disabled {
  background-color: var(--color-text-disabled);
  cursor: not-allowed;
}

/* Attachment options */
.chat-attachment-options {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.attachment-button {
  color: var(--color-text-tertiary);
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.2s ease;
  display: flex;
  align-items: center;
  font-size: 0.85rem;
}

.attachment-button:hover {
  color: var(--color-primary-main);
}

.attachment-button i {
  margin-right: 4px;
}

/* Scroll to bottom button */
.scroll-to-bottom-btn {
  position: absolute;
  bottom: 90px;
  right: 24px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--color-primary-main);
  color: white;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  border: none;
  cursor: pointer;
  z-index: 5;
  transition: background-color 0.2s ease;
  animation: bounce 1s ease infinite;
}

.scroll-to-bottom-btn:hover {
  background-color: var(--color-primary-dark);
  animation: none;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

/* Empty states */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  color: var(--color-text-tertiary);
  text-align: center;
  height: 100%;
}

.empty-state i {
  font-size: 2rem;
  margin-bottom: 16px;
  color: var(--color-text-disabled);
}

.chat-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  background-color: var(--bg-light);
  color: var(--color-text-tertiary);
}

.empty-state-content {
  text-align: center;
  max-width: 300px;
}

.empty-state-content i {
  font-size: 3rem;
  margin-bottom: 16px;
  color: var(--color-text-disabled);
}

.empty-state-content h3 {
  margin-bottom: 8px;
  color: var(--color-text-primary);
}

/* Responsive styles */
@media (max-width: 992px) {
  .chat-sidebar {
    width: 280px;
  }
  
  .customer-vehicle-info,
  .customer-appointment-info {
    max-width: 150px;
  }
}

@media (max-width: 768px) {
  .chat-interface {
    flex-direction: column;
    height: calc(100vh - 180px);
  }
  
  .chat-sidebar {
    width: 100%;
    height: 280px;
    border-right: none;
    border-bottom: 1px solid var(--color-border);
  }
  
  .chat-main {
    height: calc(100vh - 460px);
    min-height: 400px;
  }
  
  .message {
    max-width: 85%;
  }
  
  .customer-vehicle-info,
  .customer-appointment-info {
    display: none;
  }
  
  .chat-actions {
    gap: 4px;
  }
  
  .chat-action-button {
    width: 32px;
    height: 32px;
  }
}

@media (max-width: 576px) {
  .chat-interface {
    height: calc(100vh - 150px);
  }
  
  .chat-sidebar {
    height: 240px;
  }
  
  .chat-header {
    padding: 12px;
    height: 60px;
  }
  
  .conversation-avatar {
    width: 40px;
    height: 40px;
  }
  
  .chat-user-avatar {
    width: 36px;
    height: 36px;
  }
  
  .conversation-unread {
    top: 12px;
    right: 12px;
  }
  
  .chat-messages {
    padding: 12px;
  }
  
  .message {
    max-width: 90%;
  }
  
  .message-bubble {
    padding: 10px 12px;
  }
  
  .chat-input-container,
  .quick-response-container {
    padding: 12px;
  }
  
  .quick-response-btn {
    padding: 4px 8px;
    font-size: 0.7rem;
  }
  
  .scroll-to-bottom-btn {
    bottom: 80px;
    right: 16px;
    width: 36px;
    height: 36px;
  }
  
  #chat-input {
    padding: 10px 12px;
    font-size: 0.9rem;
  }
  
  #send-message {
    width: 36px;
    height: 36px;
  }
}

/* Enhanced Chat Features Styles */

/* Message category container */
.message-category-container {
  padding: 8px 16px;
  background-color: var(--color-surface-hover);
  border-bottom: 1px solid var(--color-border);
}

.category-label {
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  margin-bottom: 4px;
  display: block;
}

.category-select {
  max-width: 200px;
  font-size: 0.85rem;
  padding: 4px 8px;
  border-radius: 6px;
}

/* Chat conversation actions */
.chat-conversation-actions {
  display: flex;
  gap: 4px;
  margin-left: 8px;
}

.chat-action-button.active {
  background-color: var(--color-primary-main);
  color: white;
}

.chat-action-button.resolved {
  background-color: var(--success-main);
  color: white;
}

/* Customer context information */
.customer-context-info {
  margin-top: 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.customer-context-info .customer-vehicle-info,
.customer-context-info .customer-appointment-info {
  font-size: 0.7rem;
  background-color: var(--color-surface-hover);
  color: var(--color-text-secondary);
  padding: 2px 6px;
  border-radius: 12px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

/* Conversation notes */
.conversation-notes-container {
  background-color: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: 12px 16px;
}

.notes-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.notes-header h6 {
  margin: 0;
  font-size: 0.9rem;
  color: var(--color-text-primary);
}

.btn-text {
  background: none;
  border: none;
  color: var(--color-primary-main);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0;
}

.btn-text:hover {
  text-decoration: underline;
}

.notes-content {
  display: none;
}

#notes-input {
  resize: vertical;
  font-size: 0.85rem;
  min-height: 60px;
}

/* Enhanced quick responses */
.quick-response-container {
  max-height: 80px;
  overflow-y: auto;
}

.quick-response-btn {
  font-size: 0.75rem;
  padding: 4px 10px;
  margin: 2px;
  white-space: nowrap;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Pinned conversation indicator */
.conversation-item.pinned {
  background-color: rgba(var(--warning-main), 0.1);
  border-left: 3px solid var(--warning-main);
}

.conversation-item.pinned::before {
  content: '\f08d';
  font-family: 'Font Awesome 5 Free';
  font-weight: 900;
  position: absolute;
  top: 12px;
  left: 8px;
  font-size: 0.7rem;
  color: var(--warning-main);
}

/* Resolved conversation styling */
.conversation-item.resolved {
  opacity: 0.7;
}

.conversation-item.resolved .conversation-name::after {
  content: ' ✓';
  color: var(--success-main);
  font-weight: bold;
}

/* Category badge in conversation list */
.conversation-category-badge {
  display: inline-block;
  font-size: 0.6rem;
  padding: 1px 4px;
  border-radius: 8px;
  background-color: var(--color-primary-main);
  color: white;
  margin-left: 4px;
  text-transform: uppercase;
}

/* Mobile responsive adjustments for new features */
@media (max-width: 768px) {
  .customer-context-info {
    display: none;
  }
  
  .message-category-container {
    padding: 6px 12px;
  }
  
  .category-select {
    max-width: 150px;
    font-size: 0.8rem;
  }
  
  .chat-conversation-actions {
    gap: 2px;
  }
  
  .conversation-notes-container {
    padding: 8px 12px;
  }
  
  .quick-response-btn {
    font-size: 0.7rem;
    padding: 3px 8px;
    max-width: 150px;
  }
}

@media (max-width: 576px) {
  .message-category-container {
    display: none !important;
  }
  
  .customer-context-info {
    display: none !important;
  }
}

/* New Message Button and Modal Styles */
.new-message-container {
  padding: 16px;
  border-bottom: 1px solid var(--color-border);
}

.new-message-btn {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--color-primary-main) 0%, var(--teal-600) 100%);
  border: none;
  color: white;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(var(--teal-500-rgb), 0.2);
}

.new-message-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(var(--teal-500-rgb), 0.3);
}

.new-message-btn:active {
  transform: translateY(0);
}

/* Modal Overlay for New Message */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease-out;
}

.modal-dialog {
  background: var(--color-background);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 500px;
  max-height: 80vh;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.2s ease-out;
}

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

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

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--color-surface);
}

.modal-title {
  margin: 0;
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close {
  background: none;
  border: none;
  color: var(--color-text-secondary);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: var(--color-surface-hover);
  color: var(--color-text-primary);
}

.modal-body {
  padding: 24px;
  flex: 1;
  overflow-y: auto;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: var(--color-surface);
}

/* Customer Selection List */
.customer-selection-list {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  margin-top: 8px;
}

.customer-selection-item {
  display: flex;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--color-divider);
  transition: background-color 0.2s ease;
  cursor: pointer;
}

.customer-selection-item:last-child {
  border-bottom: none;
}

.customer-selection-item:hover {
  background: var(--color-surface-hover);
}

.customer-selection-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--color-primary-main);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 16px;
  flex-shrink: 0;
  margin-right: 12px;
}

.customer-selection-info {
  flex: 1;
  min-width: 0;
}

.customer-selection-name {
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  font-size: var(--font-size-md);
  margin-bottom: 2px;
}

.customer-selection-email {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  margin-bottom: 2px;
}

.customer-selection-last-service {
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
}

.customer-select-btn {
  margin-left: 12px;
  flex-shrink: 0;
}

/* Loading and Empty States */
.loading-customers {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px;
  color: var(--color-text-secondary);
}

.loading-customers i {
  font-size: 18px;
  color: var(--color-primary-main);
}

.error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--color-text-secondary);
  text-align: center;
}

.error-state i {
  font-size: 32px;
  color: var(--error-main);
  margin-bottom: 12px;
}

.customer-selection-list .empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--color-text-secondary);
  text-align: center;
}

.customer-selection-list .empty-state i {
  font-size: 32px;
  color: var(--color-text-disabled);
  margin-bottom: 12px;
}

.customer-selection-list .empty-state p {
  margin-bottom: 4px;
  color: var(--color-text-primary);
}

.customer-selection-list .empty-state small {
  color: var(--color-text-tertiary);
}

/* Customer Profile Modal Styles */
.customer-profile-info {
  padding: 0;
}

.customer-profile-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--color-border);
}

.customer-avatar.large {
  width: 80px;
  height: 80px;
  font-size: 24px;
  background: var(--color-primary-main);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

.customer-basic-info h4 {
  margin: 0 0 4px 0;
  color: var(--color-text-primary);
}

.customer-email, .customer-phone {
  margin: 2px 0;
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
}

.customer-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--color-surface-hover);
  padding: 16px;
  border-radius: var(--radius-lg);
  text-align: center;
}

.stat-value {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-primary-main);
  margin-bottom: 4px;
}

.stat-label {
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.profile-section {
  margin-bottom: 20px;
}

.profile-section h6 {
  margin: 0 0 12px 0;
  color: var(--color-text-primary);
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
}

.vehicles-list, .appointments-list {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.vehicle-item, .appointment-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-divider);
}

.vehicle-item:last-child, .appointment-item:last-child {
  border-bottom: none;
}

.vehicle-item i {
  color: var(--color-primary-main);
  margin-right: 8px;
  width: 16px;
}

.appointment-item {
  justify-content: space-between;
}

.apt-date {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

.apt-service {
  font-weight: var(--font-weight-medium);
  color: var(--color-text-primary);
}

.apt-amount {
  font-weight: var(--font-weight-semibold);
  color: var(--color-primary-main);
}

/* Chat Options Modal Styles */
.modal-dialog.modal-sm {
  max-width: 400px;
}

.chat-options-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat-option-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: none;
  border: none;
  border-radius: var(--radius-md);
  color: var(--color-text-primary);
  font-size: var(--font-size-md);
  cursor: pointer;
  transition: background-color 0.2s ease;
  text-align: left;
  width: 100%;
}

.chat-option-item:hover {
  background: var(--color-surface-hover);
}

.chat-option-item.danger {
  color: var(--error-main);
}

.chat-option-item.danger:hover {
  background: var(--error-light);
}

.chat-option-item i {
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .modal-dialog {
    max-width: 95%;
    margin: 10px;
  }
  
  .modal-header,
  .modal-body,
  .modal-footer {
    padding: 16px;
  }
  
  .customer-selection-item {
    padding: 12px;
  }
  
  .customer-selection-avatar {
    width: 40px;
    height: 40px;
    font-size: 14px;
  }
  
  .customer-selection-list {
    max-height: 300px;
  }
  
  .customer-profile-header {
    flex-direction: column;
    text-align: center;
    gap: 12px;
  }
  
  .customer-stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  
  .customer-avatar.large {
    width: 60px;
    height: 60px;
    font-size: 20px;
  }
}

/* Animation for archiving conversations */
@keyframes fadeOut {
  0% { opacity: 1; transform: translateX(0); }
  100% { opacity: 0; transform: translateX(-20px); }
}

/* Optimistic message styling */
.optimistic-message {
  opacity: 0.7;
}

.optimistic-message .message-time {
  color: var(--color-text-tertiary);
  font-style: italic;
}