/* AI Chat Widget Styles */

#ai-chat-widget {
  font-family:
    -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Кнопка открытия чата */
.chat-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s;
  z-index: 1000;
}

.chat-toggle:hover {
  transform: scale(1.1);
}

.chat-icon {
  font-size: 28px;
  color: white;
}

/* Окно чата */
.chat-window {
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: 360px;
  max-width: calc(100vw - 40px);
  height: 500px;
  min-height: 300px;
  max-height: calc(100vh - 150px);
  background: white;
  border-radius: 12px;
  box-shadow: 0 5px 40px rgba(0, 0, 0, 0.16);
  display: flex;
  flex-direction: column;
  z-index: 999;
  animation: slideUp 0.3s ease;
}

.chat-window.resizing {
  user-select: none;
}

.chat-window.hidden {
  display: none;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Заголовок чата */
.chat-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 16px;
  border-radius: 12px 12px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.chat-resize-handle {
  position: absolute;
  top: -5px;
  left: 0;
  right: 0;
  height: 10px;
  cursor: ns-resize;
  z-index: 10;
}

.chat-resize-handle::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 4px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
}

.chat-close {
  background: transparent;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  line-height: 1;
}

/* Область сообщений */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #f7f8fc;
}

.message {
  margin-bottom: 12px;
  animation: fadeIn 0.3s;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.message-user {
  text-align: right;
}

.message-ai {
  text-align: left;
}

.message-bubble {
  display: inline-block;
  padding: 10px 14px;
  border-radius: 18px;
  max-width: 80%;
  word-wrap: break-word;
}

.message-user .message-bubble {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.message-ai .message-bubble {
  background: white;
  color: #333;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.message-timestamp {
  font-size: 11px;
  color: #999;
  margin-top: 4px;
}

/* Поле ввода */
.chat-input-wrapper {
  display: flex;
  padding: 12px;
  background: white;
  border-top: 1px solid #e0e0e0;
}

.chat-input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid #e0e0e0;
  border-radius: 20px;
  outline: none;
  font-size: 14px;
}

.chat-input:focus {
  border-color: #667eea;
}

.chat-send {
  margin-left: 8px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  color: white;
  cursor: pointer;
  font-size: 18px;
  transition: opacity 0.2s;
}

.chat-send:hover {
  opacity: 0.9;
}

.chat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Статус */
.chat-status {
  padding: 8px 16px;
  background: #f0f0f0;
  text-align: center;
  font-size: 12px;
  color: #666;
  border-radius: 0 0 12px 12px;
}

/* Индикатор печатает */
.typing-indicator {
  display: inline-block;
  padding: 10px 14px;
  background: white;
  border-radius: 18px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.typing-indicator span {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #999;
  margin: 0 2px;
  animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0%,
  60%,
  100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-10px);
  }
}

/* Форматирование расписания */
.schedule-container {
  margin: 8px 0;
}

.schedule-header {
  font-weight: 600;
  color: #333;
  margin-bottom: 12px;
  font-size: 14px;
}

.schedule-card {
  background: linear-gradient(to right, #f8f9ff, #ffffff);
  border-left: 3px solid #667eea;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.schedule-card:hover {
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
  transition: box-shadow 0.2s;
}

.pair-number {
  display: inline-block;
  background: #667eea;
  color: white;
  font-weight: 600;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 12px;
  margin-bottom: 8px;
}

.pair-time {
  display: inline-block;
  color: #666;
  font-size: 13px;
  margin-left: 8px;
  font-weight: 500;
}

.subject-name {
  font-weight: 600;
  color: #333;
  font-size: 14px;
  margin: 6px 0;
  line-height: 1.4;
}

.schedule-meta {
  display: flex;
  gap: 12px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #666;
}

.meta-icon {
  font-size: 14px;
}

.room-badge {
  background: #e8eaf6;
  color: #5c6bc0;
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 500;
  font-size: 12px;
}

.group-badge {
  background: #f3e5f5;
  color: #8e24aa;
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 500;
  font-size: 12px;
}

.teacher-badge {
  background: #e8f5e9;
  color: #43a047;
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 500;
  font-size: 12px;
}

.schedule-empty {
  text-align: center;
  padding: 20px;
  color: #999;
  font-style: italic;
}

.schedule-divider {
  border: 0;
  height: 1px;
  background: linear-gradient(to right, transparent, #e0e0e0, transparent);
  margin: 16px 0;
}
