/**
 * JORO AI Assistant - Floating Button & Panel
 * Professional UX, no emojis
 */

.joro-ai-assistant-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%);
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(29, 78, 216, 0.4);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
}

.joro-ai-assistant-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(29, 78, 216, 0.5);
}

.joro-ai-assistant-btn:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

.joro-ai-assistant-btn svg {
  width: 24px;
  height: 24px;
}

.joro-ai-assistant-panel {
  position: fixed;
  bottom: 90px;
  right: 24px;
  width: 420px;
  max-width: calc(100vw - 48px);
  max-height: 70vh;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
  border: 1px solid #e2e8f0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}

.joro-ai-assistant-panel.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.joro-ai-assistant-header {
  padding: 16px 20px;
  background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.joro-ai-assistant-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.joro-ai-assistant-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.joro-ai-assistant-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.joro-ai-assistant-tabs {
  display: flex;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.joro-ai-assistant-tab {
  flex: 1;
  padding: 12px 16px;
  background: #f8fafc;
  border: none;
  font-size: 13px;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.joro-ai-assistant-tab:hover {
  background: #f1f5f9;
  color: #334155;
}

.joro-ai-assistant-tab.active {
  background: #ffffff;
  color: #1d4ed8;
  border-bottom: 2px solid #1d4ed8;
  margin-bottom: -1px;
}

.joro-ai-assistant-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.joro-ai-assistant-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: #64748b;
  font-size: 14px;
}

.joro-ai-assistant-loading .spinner {
  width: 24px;
  height: 24px;
  border: 3px solid #e2e8f0;
  border-top-color: #1d4ed8;
  border-radius: 50%;
  animation: joro-ai-spin 0.8s linear infinite;
  margin-right: 12px;
}

@keyframes joro-ai-spin {
  to { transform: rotate(360deg); }
}

.joro-ai-assistant-content h4 {
  margin: 0 0 12px 0;
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
}

.joro-ai-assistant-content ul {
  margin: 0;
  padding-left: 20px;
  color: #475569;
  font-size: 14px;
  line-height: 1.6;
}

.joro-ai-assistant-content li {
  margin-bottom: 8px;
}

.joro-ai-assistant-content p {
  margin: 0 0 12px 0;
  font-size: 14px;
  line-height: 1.6;
  color: #475569;
}

.joro-ai-assistant-chat-input {
  display: flex;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.joro-ai-assistant-chat-input input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
}

.joro-ai-assistant-chat-input input:focus {
  outline: none;
  border-color: #1d4ed8;
  box-shadow: 0 0 0 2px rgba(29, 78, 216, 0.2);
}

.joro-ai-assistant-chat-input button {
  padding: 10px 18px;
  background: #1d4ed8;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.joro-ai-assistant-chat-input button:hover {
  background: #2563eb;
}

.joro-ai-assistant-chat-input button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.joro-ai-assistant-messages {
  max-height: 280px;
  overflow-y: auto;
  padding: 16px 0;
}

.joro-ai-assistant-msg {
  margin-bottom: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.5;
}

.joro-ai-assistant-msg.user {
  background: #eff6ff;
  color: #1e40af;
  margin-left: 24px;
}

.joro-ai-assistant-msg.assistant {
  background: #f8fafc;
  color: #334155;
  margin-right: 24px;
}

.joro-ai-assistant-playbook-item {
  padding: 10px 14px;
  background: #f8fafc;
  border-left: 4px solid #1d4ed8;
  border-radius: 4px;
  margin-bottom: 8px;
  font-size: 14px;
  color: #334155;
}

.joro-ai-assistant-error {
  padding: 12px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  color: #991b1b;
  font-size: 14px;
}

@media (max-width: 480px) {
  .joro-ai-assistant-panel {
    right: 12px;
    left: 12px;
    width: auto;
    bottom: 80px;
    max-height: 60vh;
  }

  .joro-ai-assistant-btn {
    right: 16px;
    bottom: 16px;
  }
}
