/**
 * AI Assistant Chat Box - Styles
 */

/* Container */
.ai-assistant-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Toggle Button (zawsze widoczny) */
.ai-assistant-toggle {
  position: relative;
  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(102, 126, 234, 0.4);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-assistant-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.ai-assistant-toggle:active {
  transform: scale(0.95);
}

.ai-icon {
  font-size: 32px;
  line-height: 1;
}

.ai-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: #e74c3c;
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

/* Chat Window */
.ai-assistant-window {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 380px;
  height: 600px;
  max-height: calc(100vh - 120px);
  background: white;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.3s ease;
}

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

/* Header */
.ai-assistant-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 16px 16px 0 0;
}

.ai-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ai-avatar {
  font-size: 32px;
  line-height: 1;
}

.ai-header-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ai-title {
  font-size: 16px;
  font-weight: 600;
}

.ai-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  opacity: 0.9;
}

.ai-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2ecc71;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.ai-header-actions {
  display: flex;
  gap: 8px;
}

.ai-header-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  transition: background 0.2s;
}

.ai-header-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Conversation Area */
.ai-conversation {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #f8f9fa;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ai-conversation::-webkit-scrollbar {
  width: 6px;
}

.ai-conversation::-webkit-scrollbar-track {
  background: transparent;
}

.ai-conversation::-webkit-scrollbar-thumb {
  background: #cbd5e0;
  border-radius: 3px;
}

.ai-conversation::-webkit-scrollbar-thumb:hover {
  background: #a0aec0;
}

/* Messages */
.ai-message {
  display: flex;
  gap: 12px;
  animation: fadeIn 0.3s ease;
}

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

.ai-message-avatar {
  font-size: 28px;
  line-height: 1;
  flex-shrink: 0;
}

.ai-message-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ai-message-text {
  background: white;
  padding: 12px 16px;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  font-size: 14px;
  line-height: 1.5;
  color: #2d3748;
}

.ai-message-user .ai-message-text {
  background: #667eea;
  color: white;
}

.ai-message-user {
  flex-direction: row-reverse;
}

.ai-message-time {
  font-size: 11px;
  color: #a0aec0;
  padding: 0 4px;
}

/* Message Actions */
.ai-message-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.ai-action-btn {
  background: #667eea;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.ai-action-btn:hover {
  background: #5568d3;
  transform: translateY(-1px);
}

/* Quick Actions */
.ai-quick-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.ai-quick-btn {
  background: white;
  border: 2px solid #e2e8f0;
  padding: 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #2d3748;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.ai-quick-btn:hover {
  border-color: #667eea;
  background: #f7fafc;
  transform: translateY(-2px);
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

/* Input Area */
.ai-input-area {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  background: white;
  border-top: 1px solid #e2e8f0;
}

.ai-input {
  flex: 1;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  transition: border-color 0.2s;
}

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

.ai-send-btn {
  background: #667eea;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.ai-send-btn:hover {
  background: #5568d3;
  transform: scale(1.05);
}

.ai-send-btn:active {
  transform: scale(0.95);
}

.ai-send-icon {
  font-size: 18px;
  line-height: 1;
}

/* Typing Indicator */
.ai-typing {
  display: flex;
  gap: 4px;
  padding: 8px 16px;
  justify-content: center;
  background: rgba(102, 126, 234, 0.1);
}

.ai-typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #667eea;
  animation: typing 1.4s infinite;
}

.ai-typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.ai-typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.7;
  }
  30% {
    transform: translateY(-10px);
    opacity: 1;
  }
}

/* Mobile Responsive */
@media (max-width: 640px) {
  .ai-assistant-window {
    width: calc(100vw - 40px);
    height: calc(100vh - 140px);
    bottom: 80px;
    right: 20px;
  }
  
  .ai-assistant-container {
    right: 10px;
    bottom: 10px;
  }
  
  .ai-quick-actions {
    grid-template-columns: 1fr;
  }
}

/* Accessibility */
.ai-assistant-toggle:focus-visible,
.ai-send-btn:focus-visible,
.ai-header-btn:focus-visible,
.ai-action-btn:focus-visible,
.ai-quick-btn:focus-visible {
  outline: 2px solid #667eea;
  outline-offset: 2px;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .ai-assistant-window {
    background: #1a202c;
  }
  
  .ai-conversation {
    background: #2d3748;
  }
  
  .ai-message-text {
    background: #2d3748;
    color: #e2e8f0;
  }
  
  .ai-message-user .ai-message-text {
    background: #667eea;
    color: white;
  }
  
  .ai-quick-btn {
    background: #2d3748;
    border-color: #4a5568;
    color: #e2e8f0;
  }
  
  .ai-quick-btn:hover {
    background: #374151;
    border-color: #667eea;
  }
  
  .ai-input-area {
    background: #1a202c;
    border-top-color: #4a5568;
  }
  
  .ai-input {
    background: #2d3748;
    border-color: #4a5568;
    color: #e2e8f0;
  }
  
  .ai-input::placeholder {
    color: #718096;
  }
}
