/**
 * Epic Marks Chatbot - Launcher Button Styles
 * Minimal CSS loaded on all pages
 */

/* Default CSS variables (overridden by WordPress config) */
:root {
  --em-primary: #73CDD6;
  --em-secondary: #333333;
  --em-radius: 16px;
}

/* Launcher button */
.em-chatbot-launcher {
  position: fixed;
  bottom: 20px;
  z-index: 9999;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: var(--em-primary, #73CDD6);
  color: white;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.em-chatbot-launcher:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}

.em-chatbot-launcher:active {
  transform: scale(0.98);
}

.em-chatbot-launcher svg {
  width: 28px;
  height: 28px;
  fill: currentColor;
}

/* Position variants */
.em-chatbot-launcher--right {
  right: 20px;
}

.em-chatbot-launcher--left {
  left: 20px;
}

/* Hide launcher when chat is open */
.em-chatbot-launcher--hidden {
  display: none;
}

/* Notification badge (for unread messages) */
.em-chatbot-launcher__badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  background: #ef4444;
  color: white;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: em-chatbot-pulse 2s infinite;
}

/* History indicator (subtle ring to show conversation can continue) */
.em-chatbot-launcher--has-history::after {
  content: '';
  position: absolute;
  top: -3px;
  right: -3px;
  width: 14px;
  height: 14px;
  background: #22c55e;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

@keyframes em-chatbot-pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

/* Chat window container (loaded dynamically) */
#em-chatbot-root {
  position: fixed;
  z-index: 10000;
}

/* Mobile responsive */
@media (max-width: 480px) {
  .em-chatbot-launcher {
    bottom: 16px;
    width: 56px;
    height: 56px;
  }

  .em-chatbot-launcher--right {
    right: 16px;
  }

  .em-chatbot-launcher--left {
    left: 16px;
  }
}

/* Welcome bubble for first-time visitors */
.em-chatbot-welcome {
  position: fixed;
  bottom: 90px;
  z-index: 9998;
  max-width: 280px;
  opacity: 0;
  transform: translateY(10px) scale(0.95);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}

.em-chatbot-welcome--visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.em-chatbot-welcome--right {
  right: 20px;
}

.em-chatbot-welcome--left {
  left: 20px;
}

.em-chatbot-welcome__content {
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  padding: 14px 16px;
  cursor: pointer;
  position: relative;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.em-chatbot-welcome__content:hover {
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2);
}

/* Speech bubble tail */
.em-chatbot-welcome--right .em-chatbot-welcome__content::after {
  content: '';
  position: absolute;
  bottom: -8px;
  right: 24px;
  width: 16px;
  height: 16px;
  background: white;
  border-radius: 2px;
  transform: rotate(45deg);
  border-right: 1px solid rgba(0, 0, 0, 0.08);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.em-chatbot-welcome--left .em-chatbot-welcome__content::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 24px;
  width: 16px;
  height: 16px;
  background: white;
  border-radius: 2px;
  transform: rotate(45deg);
  border-right: 1px solid rgba(0, 0, 0, 0.08);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.em-chatbot-welcome__close {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 28px;
  height: 28px;
  border: none;
  background: #f0f0f0;
  color: #666;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.15s ease, color 0.15s ease;
}

.em-chatbot-welcome__close:hover {
  background: #e0e0e0;
  color: #333;
}

.em-chatbot-welcome__text {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: #333;
  padding-right: 16px;
}

.em-chatbot-welcome__text strong {
  color: #111;
}

/* Mobile responsive */
@media (max-width: 480px) {
  .em-chatbot-welcome {
    bottom: 82px;
    max-width: calc(100vw - 32px);
    left: 16px;
    right: 16px;
  }

  .em-chatbot-welcome--right,
  .em-chatbot-welcome--left {
    left: 16px;
    right: 16px;
  }

  .em-chatbot-welcome--right .em-chatbot-welcome__content::after,
  .em-chatbot-welcome--left .em-chatbot-welcome__content::after {
    right: 24px;
    left: auto;
  }
}
