/* Стили чата */
.chat-section {
  margin-top: 40px;
}

.chat-title {
  text-align: center;
  color: #667eea;
  font-size: 2em;
  margin-bottom: 25px;
}

.chat-container {
  background: white;
  border-radius: 16px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

/* Заголовок чата */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 20px;
  background: white;
  border-bottom: 1px solid #e0e0e0;
  gap: 12px;
}

.guest-mode {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.guest-label {
  font-size: 1em;
  color: #666;
}

.init-profile-btn {
  padding: 8px 20px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.9em;
}

.init-profile-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.user-mode {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.profile-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4em;
  font-weight: bold;
  flex-shrink: 0;
}

.profile-name {
  font-size: 1.1em;
  color: #333;
  cursor: pointer;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-name:hover {
  color: #667eea;
}

.fingerprint-info {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #888;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: help;
  position: relative;
  margin-left: auto;
}

.fingerprint-info svg {
  width: 18px;
  height: 18px;
}

.fingerprint-tooltip {
  display: none;
  position: absolute;
  top: 40px;
  right: 0;
  background: #333;
  color: white;
  padding: 12px;
  border-radius: 8px;
  width: 320px;
  max-height: 400px;
  overflow-y: auto;
  z-index: 100;
  font-size: 0.85em;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  line-height: 1.5;
}

.fingerprint-info:hover .fingerprint-tooltip {
  display: block;
}

/* Сообщения */
.chat-messages {
  height: 400px;
  overflow-y: auto;
  padding: 20px;
  background: #f8f9fa;
  scroll-behavior: smooth;
}

.chat-empty {
  text-align: center;
  color: #999;
  padding: 60px 20px;
  font-size: 1.1em;
}

.chat-message {
  display: flex;
  align-items: flex-start;
  margin-bottom: 16px;
  animation: slideIn 0.3s ease-out;
  position: relative;
  padding: 8px;
  border-radius: 8px;
  transition: background 0.2s ease;
}

.chat-message:hover {
  background: rgba(102, 126, 234, 0.05);
}

.chat-message:hover .message-actions {
  display: flex;
}

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

.chat-message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1em;
  font-weight: bold;
  flex-shrink: 0;
  margin-right: 12px;
}

.chat-message-content {
  flex: 1;
  min-width: 0;
}

.chat-message-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.chat-message-name {
  font-weight: 600;
  color: #667eea;
  font-size: 0.95em;
}

.chat-message-time {
  font-size: 0.8em;
  color: #999;
}

.chat-message-text {
  color: #333;
  line-height: 1.5;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.chat-message-edited {
  font-size: 0.75em;
  color: #999;
  font-style: italic;
  margin-top: 4px;
}

.message-actions {
  display: none;
  position: absolute;
  top: 8px;
  right: 8px;
  gap: 6px;
}

.message-action-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: white;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transition: all 0.2s ease;
  font-size: 0.9em;
}

.message-action-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 3px 12px rgba(0,0,0,0.15);
}

.message-action-btn.edit {
  color: #667eea;
}

.message-action-btn.delete {
  color: #e74c3c;
}

/* Ввод сообщения */
.chat-input-container {
  display: flex;
  gap: 12px;
  padding: 20px;
  background: white;
  border-top: 1px solid #e0e0e0;
  align-items: flex-end;
}

.chat-message-input {
  flex: 1;
  min-height: 50px;
  max-height: 150px;
  padding: 12px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  font-size: 1em;
  font-family: inherit;
  resize: none;
  transition: all 0.3s ease;
}

.chat-message-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.chat-message-input:disabled {
  background: #f5f5f5;
  cursor: not-allowed;
}

.chat-send-button {
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chat-send-button::after {
  content: '↑';
  font-size: 1.4em;
  transition: transform 0.2s ease;
}

.chat-send-button:hover:not(:disabled)::after {
  transform: translateX(2px) translateY(-2px);
}

.chat-send-button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

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

@media (max-width: 768px) {
  .chat-messages { height: 300px; }
  .chat-message-input { min-height: 56px; }
  .chat-send-button { width: 56px; height: 56px; }
  .fingerprint-tooltip {
    right: -140px;
    width: 280px;
  }
}

@media (max-width: 480px) {
  .chat-input-container { padding: 15px; }
}