/* OmWeb.dk - Chatbot Widget Styles (Improved UX) */

.omweb-chatbot {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

.omweb-chatbot-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(79, 70, 229, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
}

.omweb-chatbot-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 12px 32px rgba(79, 70, 229, 0.5);
}

.omweb-chatbot-btn:active {
  transform: scale(0.95);
}

.omweb-chatbot-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ef4444;
  color: white;
  border-radius: 50%;
  min-width: 20px;
  height: 20px;
  font-size: 12px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
  padding: 0 4px;
}

.omweb-chatbot-panel {
  position: absolute !important;
  bottom: 80px !important;
  right: 0 !important;
  width: 400px !important;
  max-width: calc(100vw - 48px) !important;
  height: 600px !important;
  max-height: calc(100vh - 120px) !important;
  background: white !important;
  border-radius: 20px !important;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15) !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  transform: translateY(20px) !important;
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden !important;
  transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s ease !important;
  z-index: 10000 !important;
}

.omweb-chatbot-panel[aria-hidden="false"],
.omweb-chatbot-panel.show {
  transform: translateY(0) !important;
  opacity: 1 !important;
  pointer-events: all !important;
  visibility: visible !important;
  display: flex !important;
}

/* Header with avatars */
.omweb-chatbot-header {
  padding: 20px;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: white;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}

.omweb-chatbot-avatars {
  position: relative;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
}

.omweb-chatbot-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid white;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
}

.omweb-chatbot-avatar-stack {
  position: relative;
  width: 48px;
  height: 48px;
}

.omweb-chatbot-avatar-stack .omweb-chatbot-avatar:nth-child(1) {
  z-index: 3;
  left: 0;
}

.omweb-chatbot-avatar-stack .omweb-chatbot-avatar:nth-child(2) {
  z-index: 2;
  left: -12px;
  opacity: 0.5;
}

.omweb-chatbot-avatar-stack .omweb-chatbot-avatar:nth-child(3) {
  z-index: 1;
  left: -24px;
  opacity: 0.3;
}

.omweb-chatbot-title {
  flex: 1;
}

.omweb-chatbot-title .name {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 2px;
}

.omweb-chatbot-title .status {
  font-size: 12px;
  opacity: 0.9;
}

.omweb-chatbot-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
  flex-shrink: 0;
  font-weight: bold;
  line-height: 1;
}

.omweb-chatbot-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.omweb-chatbot-close:active {
  background: rgba(255, 255, 255, 0.4);
}

.omweb-chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: #f8fafc;
}

.omweb-chatbot-message {
  display: flex;
  gap: 12px;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.omweb-chatbot-message.user {
  flex-direction: row-reverse;
}

.omweb-chatbot-message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.omweb-chatbot-message.user .omweb-chatbot-message-avatar {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: white;
}

.omweb-chatbot-message.assistant .omweb-chatbot-message-avatar {
  background: #e5e7eb;
  color: #4b5563;
}

.omweb-chatbot-message-content {
  max-width: 75%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}

/* Line clamp for long messages */
.omweb-chatbot-message-content.omweb-chat-clamped {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.omweb-chatbot-message.user .omweb-chatbot-message-content {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: white;
  border-bottom-right-radius: 4px;
}

.omweb-chatbot-message.assistant .omweb-chatbot-message-content {
  background: white;
  color: #1f2937;
  border: 1px solid #e5e7eb;
  border-bottom-left-radius: 4px;
}

/* Typing indicator */
.omweb-chatbot-typing {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 18px;
  border-bottom-left-radius: 4px;
}

.omweb-chatbot-typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9ca3af;
  animation: typingBounce 1.4s infinite;
}

.omweb-chatbot-typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.omweb-chatbot-typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingBounce {
  0%, 60%, 100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-8px);
  }
}

/* Link styling - small inline button */
.omweb-chat-link {
  display: inline-block;
  margin: 0 2px;
  padding: 4px 8px;
  background: rgba(79, 70, 229, 0.1);
  color: #4f46e5;
  border-radius: 6px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.2s ease;
}

.omweb-chat-link:hover {
  background: rgba(79, 70, 229, 0.2);
}

.omweb-chatbot-footer {
  padding: 16px;
  background: white;
  border-top: 1px solid #e5e7eb;
}

.omweb-chatbot-gdpr {
  font-size: 11px;
  color: #6b7280;
  text-align: center;
  margin-bottom: 12px;
  line-height: 1.4;
}

.omweb-chatbot-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.omweb-chatbot-quick-chip {
  padding: 6px 12px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #374151;
}

.omweb-chatbot-quick-chip:hover {
  background: #e5e7eb;
  border-color: #d1d5db;
}

.omweb-chatbot-inputrow {
  display: flex;
  gap: 8px;
}

.omweb-chatbot-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid #e5e7eb;
  border-radius: 24px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s ease;
}

.omweb-chatbot-input:focus {
  border-color: #4f46e5;
}

.omweb-chatbot-send {
  padding: 12px 24px;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: white;
  border: none;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.omweb-chatbot-send:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.omweb-chatbot-send:active {
  transform: translateY(0);
}

.omweb-chatbot-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Radar/ripple effect */
.omweb-chatbot-radar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 9998;
  overflow: hidden;
}

.omweb-chatbot-radar-ripple {
  position: absolute;
  border-radius: 50%;
  width: 64px;
  height: 64px;
  transform: translate(-50%, -50%);
  /* Smooth radial gradient: 70% opacity center fading to 0% at edges */
  background: radial-gradient(
    circle,
    rgba(79, 70, 229, 0.7) 0%,
    rgba(79, 70, 229, 0.5) 20%,
    rgba(79, 70, 229, 0.3) 40%,
    rgba(79, 70, 229, 0.15) 60%,
    rgba(79, 70, 229, 0.05) 80%,
    rgba(79, 70, 229, 0) 100%
  );
  animation: radarRipple 2s ease-out;
  max-width: 40vw;
  max-height: 40vw;
}

@keyframes radarRipple {
  0% {
    width: 64px;
    height: 64px;
    opacity: 0.7;
    transform: translate(-50%, -50%);
  }
  100% {
    width: 40vw;
    height: 40vw;
    opacity: 0;
    transform: translate(-50%, -50%);
  }
}

/* Mobile full-screen */
@media (max-width: 640px) {
  .omweb-chatbot {
    bottom: 16px;
    right: 16px;
  }

  .omweb-chatbot-panel {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    bottom: 0 !important;
    right: 0 !important;
    left: 0 !important;
    top: 0 !important;
    border-radius: 0 !important;
    padding-top: env(safe-area-inset-top) !important;
    padding-bottom: env(safe-area-inset-bottom) !important;
    transform: none !important;
    margin: 0 !important;
  }

  .omweb-chatbot-header {
    position: sticky;
    top: 0;
    z-index: 10;
    padding-top: calc(20px + env(safe-area-inset-top));
    padding-bottom: 20px;
  }

  .omweb-chatbot-close {
    width: 44px !important;
    height: 44px !important;
    font-size: 28px !important;
    background: rgba(255, 255, 255, 0.25) !important;
    border: 2px solid rgba(255, 255, 255, 0.5) !important;
    font-weight: bold !important;
    line-height: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: background 0.2s ease !important;
  }

  .omweb-chatbot-close:hover,
  .omweb-chatbot-close:active {
    background: rgba(255, 255, 255, 0.4) !important;
  }

  .omweb-chatbot-messages {
    padding-bottom: env(safe-area-inset-bottom);
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .omweb-chatbot-footer {
    position: sticky;
    bottom: 0;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
    background: white;
    border-top: 1px solid #e5e7eb;
    z-index: 10;
  }

  body.omweb-chat-open {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
    height: 100%;
  }
}
