/* Live Chat Widget - New Modern Design */
.chat-widget-new {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 1000;
  font-family: 'Vazirmatn', sans-serif;
}

/* Floating Toggle Button */
.chat-toggle-new {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(10px);
}

.chat-toggle-new::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 16px;
  transition: all 0.3s ease;
}

.chat-toggle-new.online::before {
  background: linear-gradient(135deg, #10b981, #059669);
}

.chat-toggle-new.offline::before {
  background: linear-gradient(135deg, #6b7280, #4b5563);
}

.chat-icon {
  width: 28px;
  height: 28px;
  color: white;
  z-index: 1;
  transition: transform 0.3s ease;
}

.status-badge {
  font-size: 11px;
  font-weight: 700;
  color: white;
  background: rgba(255, 255, 255, 0.25);
  padding: 3px 8px;
  border-radius: 12px;
  backdrop-filter: blur(10px);
  z-index: 1;
  transition: all 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.chat-toggle-new:hover {
  transform: scale(1.05) translateY(-2px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.chat-toggle-new:hover .chat-icon {
  transform: scale(1.1);
}

/* Chat Panel */
.chat-panel-new {
  position: absolute;
  bottom: 84px;
  left: 0;
  width: 420px;
  max-width: calc(100vw - 40px);
  height: 580px;
  max-height: calc(100vh - 120px);
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(20px);
  border-radius: 24px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  display: none;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-panel-new.open,
.chat-panel-new.active {
  display: flex !important;
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Header */
.chat-header-new {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 24px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 24px 24px 0 0;
  position: relative;
  overflow: hidden;
}

.chat-header-new::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), transparent);
  pointer-events: none;
}

.header-content {
  display: flex;
  align-items: center;
  gap: 16px;
  z-index: 1;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #10b981;
  animation: pulse 2s infinite;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

.status-text {
  font-size: 15px;
  font-weight: 700;
  opacity: 0.95;
}

.header-title {
  font-size: 20px;
  font-weight: 800;
  margin: 0;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.chat-close-new {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: none;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 1;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-close-new:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Pre-chat Form */
.prechat-new {
  padding: 40px 32px;
  text-align: center;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border-radius: 20px;
  margin: 24px;
  box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.1), 0 8px 15px -5px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(15px);
  position: relative;
  overflow: hidden;
}

.prechat-new::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #667eea, #764ba2, #667eea);
  background-size: 200% 100%;
  animation: shimmer 3s infinite;
}

.prechat-content {
  max-width: 360px;
  margin: 0 auto;
}

.prechat-icon {
  margin-bottom: 28px;
  opacity: 1;
  animation: float 3s ease-in-out infinite;
}

.prechat-icon svg {
  width: 64px;
  height: 64px;
  color: #667eea;
  filter: drop-shadow(0 6px 12px rgba(102, 126, 234, 0.4));
}

.prechat-title {
  font-size: 26px;
  font-weight: 800;
  color: #1f2937;
  margin-bottom: 16px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.prechat-description {
  font-size: 16px;
  color: #6b7280;
  margin-bottom: 32px;
  line-height: 1.6;
  font-weight: 500;
}

.prechat-form {
  text-align: right;
}

.form-group {
  margin-bottom: 24px;
  position: relative;
}

.form-group label {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: #374151;
  margin-bottom: 10px;
  text-align: right;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 16px 20px;
  border: 2px solid #e5e7eb;
  border-radius: 16px;
  font-size: 16px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: #ffffff;
  backdrop-filter: blur(5px);
  font-family: 'Vazirmatn', sans-serif;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15), 0 8px 15px -3px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
  background: #ffffff;
}

.form-group input::placeholder {
  color: #9ca3af;
  font-style: italic;
}

.chat-start-btn {
  width: 100%;
  padding: 18px 24px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #667eea 100%);
  background-size: 200% 100%;
  color: white;
  border: none;
  border-radius: 16px;
  font-size: 17px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
  position: relative;
  overflow: hidden;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.chat-start-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.6s;
}

.chat-start-btn:hover::before {
  left: 100%;
}

.chat-start-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 30px rgba(102, 126, 234, 0.5);
  background-position: 100% 0;
}

.chat-start-btn:active {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.chat-start-btn svg {
  width: 20px;
  height: 20px;
  transition: transform 0.3s ease;
}

.chat-start-btn:hover svg {
  transform: translateX(3px);
}

/* Queue Info */
.queue-info-new {
  padding: 40px 32px;
  text-align: center;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border-radius: 20px;
  margin: 24px;
  box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.3);
  position: relative;
  overflow: hidden;
}

.queue-info-new::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #f59e0b, #d97706, #f59e0b);
  background-size: 200% 100%;
  animation: shimmer 3s infinite;
}

.queue-content {
  max-width: 360px;
  margin: 0 auto;
}

.queue-icon {
  margin-bottom: 24px;
  animation: bounce 1.5s infinite;
}

.queue-icon svg {
  width: 56px;
  height: 56px;
  color: #f59e0b;
  filter: drop-shadow(0 4px 8px rgba(245, 158, 11, 0.3));
}

.queue-title {
  font-size: 22px;
  font-weight: 800;
  color: #92400e;
  margin-bottom: 16px;
}

.queue-description {
  font-size: 17px;
  color: #b45309;
  margin-bottom: 12px;
  font-weight: 700;
}

.queue-time {
  font-size: 15px;
  color: #a16207;
  margin-bottom: 28px;
  font-weight: 600;
}

.queue-actions {
  display: flex;
  gap: 16px;
}

.queue-btn {
  flex: 1;
  padding: 14px 20px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
  border: none;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 6px 16px rgba(245, 158, 11, 0.3);
}

.queue-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(245, 158, 11, 0.4);
}

/* Chat Messages */
.chat-messages-new {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  scroll-behavior: smooth;
}

.messages-container::-webkit-scrollbar {
  width: 8px;
}

.messages-container::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 4px;
}

.messages-container::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

.messages-container::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
}

/* Message Styles */
.msg-new {
  margin-bottom: 20px;
  animation: slideIn 0.4s ease;
}

.msg-new.user {
  text-align: left;
}

.msg-new.admin,
.msg-new.system {
  text-align: right;
}

.msg-content {
  display: inline-block;
  max-width: 85%;
  padding: 16px 20px;
  border-radius: 20px;
  position: relative;
  word-wrap: break-word;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.msg-new.user .msg-content {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border-bottom-left-radius: 6px;
}

.msg-new.admin .msg-content {
  background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
  color: #1f2937;
  border-bottom-right-radius: 6px;
}

.msg-new.system .msg-content {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  color: #92400e;
  border-radius: 16px;
  font-style: italic;
  font-size: 14px;
  text-align: center;
  max-width: 90%;
  margin: 0 auto;
  display: block;
}

.msg-text {
  font-size: 15px;
  line-height: 1.5;
  margin-bottom: 6px;
}

.msg-time {
  font-size: 12px;
  opacity: 0.8;
  font-weight: 600;
}

/* Typing Indicator */
.typing-indicator {
  padding: 0 24px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.typing-dots {
  display: flex;
  gap: 6px;
}

.typing-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #667eea;
  animation: typing 1.6s infinite ease-in-out;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

.typing-text {
  font-size: 13px;
  color: #6b7280;
  font-style: italic;
  font-weight: 500;
}

/* Offline Message */
.chat-offline-new {
  padding: 40px 32px;
  text-align: center;
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  border-radius: 20px;
  margin: 24px;
  box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  position: relative;
  overflow: hidden;
}

.chat-offline-new::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #ef4444, #dc2626, #ef4444);
  background-size: 200% 100%;
  animation: shimmer 3s infinite;
}

.offline-content {
  max-width: 360px;
  margin: 0 auto;
}

.offline-icon {
  margin-bottom: 24px;
}

.offline-icon svg {
  width: 56px;
  height: 56px;
  color: #ef4444;
  filter: drop-shadow(0 4px 8px rgba(239, 68, 68, 0.3));
}

.offline-title {
  font-size: 22px;
  font-weight: 800;
  color: #dc2626;
  margin-bottom: 16px;
}

.offline-description {
  font-size: 16px;
  color: #b91c1c;
  margin-bottom: 28px;
  line-height: 1.6;
  font-weight: 500;
}

.offline-btn {
  width: 100%;
  padding: 16px 24px;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  border: none;
  border-radius: 16px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.3);
}

.offline-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(239, 68, 68, 0.4);
}

/* Chat Input */
.chat-input-new {
  padding: 24px;
  border-top: 1px solid #e5e7eb;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(15px);
}

.chat-form {
  display: flex;
  gap: 16px;
  align-items: flex-end;
}

.input-group {
  flex: 1;
  position: relative;
}

#chat-message-input-new {
  width: 100%;
  padding: 16px 20px;
  border: 2px solid #e5e7eb;
  border-radius: 24px;
  font-size: 15px;
  resize: none;
  max-height: 120px;
  transition: all 0.3s ease;
  background: white;
  font-family: 'Vazirmatn', sans-serif;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

#chat-message-input-new:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15), 0 8px 15px -3px rgba(0, 0, 0, 0.1);
}

.send-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 0 6px 16px rgba(102, 126, 234, 0.3);
}

.send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.send-btn:active {
  transform: scale(0.95);
}

/* Animations */
@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.7;
  }
}

@keyframes bounce {

  0%,
  20%,
  50%,
  80%,
  100% {
    transform: translateY(0);
  }

  40% {
    transform: translateY(-12px);
  }

  60% {
    transform: translateY(-6px);
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(15px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes typing {

  0%,
  60%,
  100% {
    transform: translateY(0);
  }

  30% {
    transform: translateY(-12px);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(25px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }

  100% {
    background-position: 200% 0;
  }
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0px);
  }

  50% {
    transform: translateY(-8px);
  }
}

@keyframes glow {

  0%,
  100% {
    box-shadow: 0 0 5px rgba(102, 126, 234, 0.3);
  }

  50% {
    box-shadow: 0 0 25px rgba(102, 126, 234, 0.6);
  }
}

/* Enhanced animations */
.prechat-new {
  animation: fadeInUp 0.8s ease-out;
}

.queue-info-new {
  animation: fadeInUp 0.8s ease-out;
}

.chat-offline-new {
  animation: fadeInUp 0.8s ease-out;
}

.form-group input:focus,
.form-group select:focus {
  animation: glow 2.5s infinite;
}

.chat-start-btn {
  position: relative;
  overflow: hidden;
}

.chat-toggle-new {
  animation: fadeInUp 1s ease-out 0.3s both;
}

.chat-panel-new.open {
  animation: fadeInUp 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Hover effects */
.chat-toggle-new:hover {
  animation: pulse 1.2s infinite;
}

.form-group:hover input,
.form-group:hover select {
  transform: translateY(-1px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

/* Loading states */
.chat-start-btn.loading {
  pointer-events: none;
  opacity: 0.8;
}

.chat-start-btn.loading::before {
  content: '';
  position: absolute;
  width: 24px;
  height: 24px;
  border: 3px solid transparent;
  border-top: 3px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  right: 20px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

/* Success animation */
.chat-start-btn.success {
  background: linear-gradient(135deg, #10b981, #059669);
  animation: pulse 0.8s ease-in-out;
}

/* Error animation */
.form-group.error input,
.form-group.error select {
  border-color: #ef4444;
  animation: shake 0.6s ease-in-out;
}

@keyframes shake {

  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-8px);
  }

  75% {
    transform: translateX(8px);
  }
}

/* Responsive */
@media (max-width: 480px) {
  .chat-panel-new {
    width: calc(100vw - 20px);
    height: calc(100vh - 40px);
    bottom: 10px;
    left: 10px;
    border-radius: 20px;
  }

  .chat-toggle-new {
    width: 56px;
    height: 56px;
  }

  .prechat-new,
  .queue-info-new,
  .chat-offline-new {
    margin: 20px;
    padding: 32px 24px;
  }
}