/* Telegram Chat Widget - Темная тема */

.telegram-widget-container {
  position: fixed;
  bottom: 20px;
  z-index: 9999;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
}

.telegram-widget-container[data-position="bottom-right"] {
  right: 20px;
}

.telegram-widget-container[data-position="bottom-left"] {
  left: 20px;
}

/* Кнопка чата */
.telegram-widget-button {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0088cc 0%, #005580 100%);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 136, 204, 0.4);
  transition: all 0.3s ease;
}

.telegram-widget-button:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(0, 136, 204, 0.6);
}

.telegram-widget-button:active {
  transform: scale(0.95);
}

/* Окно чата */
.telegram-widget-window {
  width: 380px;
  height: 600px;
  background: #1a1a1a;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Заголовок */
.telegram-widget-header {
  background: linear-gradient(135deg, #0088cc 0%, #005580 100%);
  color: white;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.telegram-widget-header-content {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 16px;
}

.telegram-widget-close {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.2s ease;
}

.telegram-widget-close:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Область сообщений */
.telegram-widget-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #1a1a1a;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.telegram-widget-messages::-webkit-scrollbar {
  width: 6px;
}

.telegram-widget-messages::-webkit-scrollbar-track {
  background: #2d2d2d;
}

.telegram-widget-messages::-webkit-scrollbar-thumb {
  background: #444;
  border-radius: 3px;
}

.telegram-widget-messages::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* Welcome сообщение */
.telegram-widget-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #888;
  padding: 40px 20px;
  height: 100%;
}

.telegram-widget-welcome svg {
  color: #0088cc;
  margin-bottom: 16px;
  opacity: 0.6;
}

.telegram-widget-welcome h3 {
  color: #e0e0e0;
  margin: 0 0 8px 0;
  font-size: 20px;
  font-weight: 600;
}

.telegram-widget-welcome p {
  margin: 0;
  font-size: 14px;
  color: #888;
}

/* Сообщения */
.telegram-widget-message {
  display: flex;
  flex-direction: column;
  max-width: 75%;
  animation: messageIn 0.2s ease-out;
}

@keyframes messageIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.telegram-widget-message.user {
  align-self: flex-end;
}

.telegram-widget-message.support,
.telegram-widget-message.error {
  align-self: flex-start;
}

.telegram-widget-message-content {
  padding: 12px 16px;
  border-radius: 12px;
  word-wrap: break-word;
  line-height: 1.5;
  font-size: 14px;
}

.telegram-widget-message.user .telegram-widget-message-content {
  background: linear-gradient(135deg, #0088cc 0%, #0077b3 100%);
  color: white;
  border-bottom-right-radius: 4px;
}

.telegram-widget-message.support .telegram-widget-message-content {
  background: #2d2d2d;
  color: #e0e0e0;
  border-bottom-left-radius: 4px;
}

.telegram-widget-message.error .telegram-widget-message-content {
  background: #ff4444;
  color: white;
  border-bottom-left-radius: 4px;
}

.telegram-widget-message-time {
  font-size: 11px;
  color: #666;
  margin-top: 4px;
  padding: 0 4px;
}

.telegram-widget-message.user .telegram-widget-message-time {
  text-align: right;
}

.telegram-widget-message.support .telegram-widget-message-time,
.telegram-widget-message.error .telegram-widget-message-time {
  text-align: left;
}

/* Форма ввода */
.telegram-widget-input {
  display: flex;
  gap: 8px;
  padding: 16px;
  background: #2d2d2d;
  border-top: 1px solid #333;
}

.telegram-widget-input input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid #444;
  border-radius: 24px;
  background: #1a1a1a;
  color: #e0e0e0;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s ease;
}

.telegram-widget-input input:focus {
  border-color: #0088cc;
}

.telegram-widget-input input::placeholder {
  color: #666;
}

.telegram-widget-input input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.telegram-widget-input button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0088cc 0%, #005580 100%);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.telegram-widget-input button:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(0, 136, 204, 0.4);
}

.telegram-widget-input button:active:not(:disabled) {
  transform: scale(0.95);
}

.telegram-widget-input button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Индикатор отправки */
.telegram-widget-sending {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: #2d2d2d;
  padding: 12px 20px;
  border-radius: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #e0e0e0;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.telegram-widget-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #444;
  border-top-color: #0088cc;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Адаптивный дизайн */
@media (max-width: 480px) {
  .telegram-widget-window {
    width: calc(100vw - 40px);
    height: calc(100vh - 40px);
    max-height: 600px;
  }
}

@media (max-height: 700px) {
  .telegram-widget-window {
    height: calc(100vh - 100px);
  }
}