/* Chat Modal Styles */
.chat-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: modalFadeIn 0.3s ease-out;
}

.chat-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
}

.chat-modal-content {
  position: relative;
  background: var(--primary-bg, #FFFFFF);
  border-radius: 24px;
  box-shadow: 0 25px 60px rgba(0,166,147,.15), 0 8px 30px rgba(0,0,0,.1);
  border: 1px solid rgba(0,166,147,.1);
  overflow: hidden;
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  animation: modalSlideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-modal-header {
  background: linear-gradient(135deg, var(--primary-brand, #00A693), var(--brand-dark, #005B5D));
  color: white;
  padding: 2rem;
  text-align: center;
  position: relative;
}

.chat-modal-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Ccircle cx='30' cy='30' r='4'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E") repeat;
  pointer-events: none;
}

.chat-modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 10;
}

.chat-modal-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.modal-preview-icon {
  font-size: var(--ds-text-3xl);
  margin-bottom: 0.75rem;
  opacity: 0.9;
  position: relative;
  z-index: 1;
}

.modal-preview-title {
  font-size: var(--ds-text-xl);
  font-weight: 800;
  margin-bottom: 0.5rem;
  position: relative;
  z-index: 1;
}

.modal-preview-subtitle {
  font-size: var(--ds-text-sm);
  opacity: 0.9;
  font-weight: 500;
  position: relative;
  z-index: 1;
}

.chat-modal-body {
  padding: 2rem;
  text-align: center;
}

.modal-user-profile {
  margin-bottom: 2rem;
}

.modal-user-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-brand, #00A693), var(--brand-dark, #005B5D));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
  font-size: var(--ds-text-3xl);
  margin: 0 auto 1rem;
  box-shadow: 0 8px 25px rgba(0,166,147,.2);
  border: 3px solid var(--secondary-bg, #F4F6F7);
}

.modal-user-name {
  font-size: var(--ds-text-xl);
  font-weight: 800;
  color: var(--primary-text, #333333);
  margin-bottom: 0.3rem;
}

.modal-user-username {
  color: var(--secondary-text, #7D8B94);
  font-size: var(--ds-text-sm);
  font-weight: 500;
  margin-bottom: 1.5rem;
}

.modal-chat-status {
  background: var(--secondary-bg, #F4F6F7);
  border-radius: 16px;
  padding: 1.2rem;
  margin-bottom: 2rem;
  border: 1px solid rgba(0,166,147,.1);
}

.modal-chat-status.existing {
  background: linear-gradient(135deg, rgba(59,130,246,.1), rgba(37,99,235,.05));
  border-color: rgba(59,130,246,.2);
}

.modal-chat-status.existing .modal-status-icon {
  color: #3b82f6;
}

.modal-chat-status.new .modal-status-icon {
  color: var(--primary-brand, #00A693);
}

.modal-status-icon {
  font-size: var(--ds-text-2xl);
  margin-bottom: 0.8rem;
}

.modal-status-text {
  font-size: var(--ds-text-base);
  font-weight: 600;
  color: var(--primary-text, #333333);
  margin-bottom: 0.4rem;
}

.modal-status-subtitle {
  color: var(--secondary-text, #7D8B94);
  font-size: var(--ds-text-sm);
  line-height: 1.4;
}

.modal-action-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.modal-start-chat-btn {
  background: linear-gradient(135deg, var(--primary-brand, #00A693), var(--brand-dark, #005B5D));
  color: white;
  border: none;
  padding: 1rem 2rem;
  border-radius: 50px;
  font-size: var(--ds-text-base);
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  box-shadow: 0 6px 20px rgba(0,166,147,.25);
  position: relative;
  overflow: hidden;
  min-width: 160px;
}

.modal-start-chat-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.2), transparent);
  transition: left 0.5s;
}

.modal-start-chat-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0,166,147,.35);
}

.modal-start-chat-btn:hover::before {
  left: 100%;
}

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

.modal-start-chat-btn.loading {
  opacity: 0.7;
  pointer-events: none;
}

.modal-start-chat-btn.loading i {
  animation: spin 1s linear infinite;
}

.modal-back-btn {
  background: transparent;
  color: var(--secondary-text, #7D8B94);
  border: 2px solid var(--secondary-text, #7D8B94);
  padding: 1rem 1.5rem;
  border-radius: 50px;
  font-size: var(--ds-text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-back-btn:hover {
  background: var(--secondary-text, #7D8B94);
  color: white;
  transform: translateY(-1px);
}

/* Animations */
@keyframes modalFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Mobile responsive */
@media (max-width: 768px) {
  .chat-modal {
    padding: 0.5rem;
  }

  .chat-modal-content {
    max-width: 100%;
    border-radius: 20px;
  }

  .chat-modal-header {
    padding: 1.5rem;
  }

  .modal-preview-title {
    font-size: var(--ds-text-lg);
  }

  .chat-modal-body {
    padding: 1.5rem;
  }

  .modal-user-avatar {
    width: 70px;
    height: 70px;
    font-size: var(--ds-text-2xl);
  }

  .modal-user-name {
    font-size: var(--ds-text-lg);
  }

  .modal-action-buttons {
    flex-direction: column;
    align-items: center;
  }

  .modal-start-chat-btn,
  .modal-back-btn {
    width: 100%;
    max-width: 250px;
    justify-content: center;
  }
}

/* Modal hide animation */
.chat-modal.hiding {
  animation: modalFadeOut 0.3s ease-out forwards;
}

.chat-modal.hiding .chat-modal-content {
  animation: modalSlideDown 0.3s ease-out forwards;
}

@keyframes modalFadeOut {
  to {
    opacity: 0;
  }
}

@keyframes modalSlideDown {
  to {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
}
