.chat-section {
  padding: 4rem 10%;
  background: radial-gradient(circle at top left, #f8fafc 0%, #e2e8f0 100%);
  min-height: 85vh;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.chat-section::before {
  content: "";
  position: absolute;
  top: -10%;
  right: -10%;
  width: 40%;
  height: 40%;
  background: radial-gradient(circle, rgba(34, 197, 94, 0.05) 0%, transparent 70%);
  z-index: 0;
}

.chat-container {
  width: 100%;
  max-width: 900px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 24px;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.07);
  display: flex;
  flex-direction: column;
  height: 750px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.3);
  position: relative;
  z-index: 1;
}

.chat-header {
  padding: 1.5rem;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.avatar-container {
  position: relative;
}

.avatar {
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.4rem;
  color: #475569;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
  transition: transform 0.3s ease;
}

.avatar:hover {
  transform: scale(1.05);
}

.status-dot {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 14px;
  height: 14px;
  background: #22c55e;
  border: 3px solid white;
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.5);
}

.chat-info h2 {
  font-size: 1.125rem;
  font-weight: 700;
  margin: 0;
  color: #0f172a;
}

.chat-info p {
  font-size: 0.875rem;
  color: #64748b;
  margin: 0;
}

.chat-messages {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  background: #ffffff;
}

.message {
  display: flex;
  gap: 1rem;
  max-width: 85%;
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message.sophia {
  align-self: flex-start;
}

.message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message-avatar {
  width: 36px;
  height: 36px;
  background: #f1f5f9;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
}

.message-content {
  padding: 1.1rem 1.4rem;
  border-radius: 20px;
  font-size: 0.95rem;
  line-height: 1.6;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.sophia .message-content {
  background: #f8fafc;
  color: #1e293b;
  border-top-left-radius: 4px;
  border: 1px solid #f1f5f9;
}

.user .message-content {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  border-top-right-radius: 4px;
  box-shadow: 0 5px 15px rgba(34, 197, 94, 0.2);
}

.chat-input-area {
  padding: 1.5rem;
  border-top: 1px solid #f1f5f9;
  display: flex;
  gap: 0.75rem;
}

.chat-input {
  flex: 1;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.85rem 1rem;
  font-size: 0.95rem;
  outline: none;
  transition: all 0.2s;
  resize: none;
  min-height: 48px;
  max-height: 150px;
  font-family: inherit;
  line-height: 1.5;
  background: white;
}

.chat-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

.btn-attach {
  width: 44px;
  height: 44px;
  background: #f1f5f9;
  color: #64748b;
  border: none;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-attach:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.attachment-preview-area {
  padding: 0 1.5rem;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: -0.5rem;
  margin-bottom: 0.5rem;
}

.attachment-item {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  animation: fadeIn 0.3s ease-out;
}

.attachment-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.attachment-item .file-icon {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  color: #64748b;
  font-size: 1.25rem;
}

.btn-remove-attachment {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  background: rgba(15, 23, 42, 0.7);
  color: white;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  cursor: pointer;
  z-index: 2;
}

.message-image {
  max-width: 100%;
  border-radius: 12px;
  margin-top: 0.75rem;
  display: block;
}

.message-file {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(255, 255, 255, 0.1);
  padding: 0.75rem;
  border-radius: 10px;
  margin-top: 0.75rem;
  text-decoration: none;
  color: inherit;
}

.sophia .message-file {
  background: #fff;
  border: 1px solid #e2e8f0;
}

.message-file i {
  font-size: 1.25rem;
}

.btn-send {
  width: 44px;
  height: 48px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  align-self: flex-end;
}

.btn-send:hover {
  background: var(--primary-dark);
}

.btn-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 4px 8px;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background: #94a3b8;
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) {
  animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes bounce {
  0%,
  80%,
  100% {
    transform: scale(0);
  }

  40% {
    transform: scale(1);
  }
}
