﻿/* ==========================================================================
   EasyTrac v3 - Interactive Help Assistant (CliniSuite AMA Bot Style)
   ========================================================================== */

/* Keyframe Animations */
@keyframes pulseSparkle {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.18); }
}

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

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

/* Floating Action Button (Pill Style from CliniSuite) */
.ama-widget-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99990;
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #15803d 0%, #16a34a 100%);
  color: #ffffff;
  padding: 12px 22px;
  border-radius: 9999px;
  box-shadow: 0 10px 25px rgba(21, 128, 61, 0.45);
  cursor: pointer;
  border: 2px solid rgba(255, 255, 255, 0.35);
  transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  -webkit-user-select: none;
}

.ama-widget-fab:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 16px 35px rgba(21, 128, 61, 0.6);
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
}

.ama-fab-icon {
  font-size: 1.25rem;
  display: inline-block;
  animation: pulseSparkle 2.2s ease-in-out infinite;
}

.ama-fab-text {
  font-weight: 700;
  font-size: 0.94rem;
  letter-spacing: 0.01em;
}

/* Floating AI Chat Window */
.ama-window {
  position: fixed;
  bottom: 84px;
  right: 24px;
  width: 440px;
  max-width: calc(100vw - 32px);
  height: 600px;
  max-height: calc(100vh - 120px);
  background: #ffffff;
  border: 1px solid #dcfce7;
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(15, 36, 23, 0.3);
  z-index: 99995;
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: amaZoomIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
}

.ama-window.active {
  display: flex !important;
}

/* Header */
.ama-header {
  background: linear-gradient(135deg, #0f2417 0%, #15803d 100%);
  color: #ffffff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.ama-header-title {
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #ffffff;
}

.ama-header-subtitle {
  font-size: 0.74rem;
  color: #86efac;
  font-weight: 500;
  margin-top: 2px;
}

.ama-close-btn {
  background: transparent;
  border: none;
  color: #86efac;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.ama-close-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.15);
}

/* Messages Scrollable Body */
.ama-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f8fafc;
  scroll-behavior: smooth;
}

.ama-msg {
  max-width: 88%;
  padding: 12px 15px;
  border-radius: 14px;
  font-size: 0.88rem;
  line-height: 1.5;
  animation: amaFadeIn 0.2s ease-out;
  word-break: break-word;
}

.ama-msg.bot {
  align-self: flex-start;
  background: #ffffff;
  color: #1e293b;
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.ama-msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #15803d 0%, #16a34a 100%);
  color: #ffffff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 8px rgba(21, 128, 61, 0.25);
}

/* In-Bot Badges, Cards & Action Buttons */
.ama-pkg-card {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 10px 12px;
  margin: 8px 0;
}

.ama-pkg-card.highlight {
  background: #f0fdf4;
  border: 1.5px solid #16a34a;
}

.ama-pkg-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: 0.88rem;
  color: #0f2417;
  margin-bottom: 4px;
}

.ama-pkg-price {
  color: #15803d;
  font-weight: 800;
  font-size: 0.92rem;
}

.ama-action-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.ama-action-btn {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
}

.ama-action-btn:hover {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
}

/* Quick Prompt Horizontal Chips Bar */
.ama-quick-prompts {
  padding: 8px 14px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: thin;
}

.ama-quick-prompts::-webkit-scrollbar {
  height: 4px;
}

.ama-quick-prompts::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.ama-chip {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.ama-chip:hover {
  background: #15803d;
  color: #ffffff;
  border-color: #15803d;
  transform: translateY(-1px);
}

/* Input Form Area */
.ama-input-area {
  padding: 10px 14px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  display: flex;
  gap: 8px;
  align-items: center;
}

.ama-input {
  flex: 1;
  border: 1.5px solid #cbd5e1;
  padding: 9px 14px;
  border-radius: 9999px;
  font-size: 0.86rem;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s ease;
  background: #f8fafc;
}

.ama-input:focus {
  border-color: #15803d;
  background: #ffffff;
}

.ama-send-btn {
  background: #15803d;
  color: #ffffff;
  border: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s ease;
  font-size: 0.95rem;
}

.ama-send-btn:hover {
  background: #16a34a;
  transform: scale(1.05);
}

/* In-Chat Direct Support / Sales Form */
.ama-support-form {
  background: #f0fdf4;
  border: 1.5px solid #86efac;
  border-radius: 12px;
  padding: 12px 14px;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ama-support-form label {
  font-size: 0.76rem;
  font-weight: 700;
  color: #14532d;
  display: block;
  margin-bottom: 2px;
}

.ama-support-input {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 0.82rem;
  font-family: inherit;
  box-sizing: border-box;
  background: #ffffff;
}

.ama-support-input:focus {
  border-color: #15803d;
  outline: none;
}

.ama-support-submit {
  background: #15803d;
  color: #ffffff;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.2s ease;
  margin-top: 4px;
}

.ama-support-submit:hover {
  background: #16a34a;
}

/* Dark Mode Theme Support */
[data-theme="dark"] .ama-window {
  background: #112217;
  border-color: #1e3d29;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
}

[data-theme="dark"] .ama-messages {
  background: #0a140e;
}

[data-theme="dark"] .ama-msg.bot {
  background: #15291d;
  color: #e2e8f0;
  border-color: #1e3d29;
}

[data-theme="dark"] .ama-pkg-card {
  background: #162c1e;
  border-color: #274b34;
}

[data-theme="dark"] .ama-pkg-header {
  color: #86efac;
}

[data-theme="dark"] .ama-quick-prompts,
[data-theme="dark"] .ama-input-area {
  background: #112217;
  border-color: #1e3d29;
}

[data-theme="dark"] .ama-chip {
  background: #162c1e;
  border-color: #274b34;
  color: #86efac;
}

[data-theme="dark"] .ama-input {
  background: #15291d;
  border-color: #274b34;
  color: #f8fafc;
}

[data-theme="dark"] .ama-support-form {
  background: #15291d;
  border-color: #274b34;
}

[data-theme="dark"] .ama-support-form label {
  color: #86efac;
}

[data-theme="dark"] .ama-support-input {
  background: #0a140e;
  border-color: #274b34;
  color: #f8fafc;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .ama-widget-fab {
    bottom: 16px;
    right: 16px;
    padding: 10px 16px;
  }
  .ama-window {
    bottom: 74px;
    right: 16px;
    width: calc(100vw - 32px);
    height: 520px;
  }
}

/* ==========================================================================
   EasyTrac Interactive Guided Tour & Arrow Pointer Engine
   ========================================================================== */

@keyframes tourBounceTop {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

@keyframes tourBounceBottom {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(5px); }
}

@keyframes tourBounceLeft {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(-5px); }
}

@keyframes tourBounceRight {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(5px); }
}

@keyframes tourPulseGlow {
  0%, 100% {
    box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.68), 0 0 0 3px #16a34a, 0 0 20px rgba(22, 163, 74, 0.85);
  }
  50% {
    box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.68), 0 0 0 5px #22c55e, 0 0 32px rgba(34, 197, 94, 0.95);
  }
}

/* Tour Container */
#easyman-tour-container, #easytrac-tour-container {
  position: fixed;
  inset: 0;
  z-index: 1000000;
  pointer-events: none;
}

/* Tour Backdrop */
.tour-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 100001;
  pointer-events: none;
  background: transparent;
  transition: opacity 0.3s ease;
}

/* Tour Spotlight Cutout over Active Input Box / Target */
.tour-spotlight {
  position: fixed;
  z-index: 100002;
  border-radius: 8px;
  pointer-events: none;
  animation: tourPulseGlow 2s ease-in-out infinite;
  transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Tour Popup Card */
.tour-popup {
  position: fixed;
  z-index: 100003;
  width: 360px;
  max-width: calc(100vw - 32px);
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(21, 128, 61, 0.3);
  padding: 18px 20px;
  font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  animation: amaZoomIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
  pointer-events: auto !important;
}

.tour-popup button,
.tour-close-btn,
.tour-skip-btn,
.tour-prev-btn,
.tour-next-btn {
  pointer-events: auto !important;
  cursor: pointer;
}

/* Header */
.tour-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.tour-step-badge {
  background: #dcfce7;
  color: #15803d;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: 1px solid #bbf7d0;
}

.tour-close-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 1.3rem;
  cursor: pointer;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
}

.tour-close-btn:hover {
  color: #0f172a;
  background: #f1f5f9;
}

.tour-title {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tour-body {
  font-size: 0.86rem;
  color: #334155;
  line-height: 1.5;
  margin-bottom: 16px;
}

.tour-body strong {
  color: #15803d;
}

.tour-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid #f1f5f9;
  padding-top: 12px;
}

.tour-skip-btn {
  background: transparent;
  border: none;
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 6px;
}

.tour-skip-btn:hover {
  color: #dc2626;
  background: #fee2e2;
}

.tour-nav-group {
  display: flex;
  gap: 8px;
}

.tour-prev-btn {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tour-prev-btn:hover {
  background: #e2e8f0;
}

.tour-next-btn {
  background: #15803d;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 7px 16px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(21, 128, 61, 0.35);
  transition: all 0.15s ease;
}

.tour-next-btn:hover {
  background: #16a34a;
  transform: translateY(-1px);
}

/* ==========================================================================
   DIRECTIONAL ARROW POINTERS (With Animated Bounce)
   ========================================================================== */
.tour-arrow {
  position: absolute;
  width: 0;
  height: 0;
  pointer-events: none;
}

/* Arrow pointing UP (when popup is BELOW the element) */
.tour-arrow-top {
  top: -14px;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-bottom: 14px solid #ffffff;
  filter: drop-shadow(0 -3px 2px rgba(0, 0, 0, 0.1));
  animation: tourBounceTop 1.5s ease-in-out infinite;
}

/* Arrow pointing DOWN (when popup is ABOVE the element) */
.tour-arrow-bottom {
  bottom: -14px;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-top: 14px solid #ffffff;
  filter: drop-shadow(0 3px 2px rgba(0, 0, 0, 0.1));
  animation: tourBounceBottom 1.5s ease-in-out infinite;
}

/* Arrow pointing LEFT (when popup is to the RIGHT of element) */
.tour-arrow-left {
  left: -14px;
  border-top: 12px solid transparent;
  border-bottom: 12px solid transparent;
  border-right: 14px solid #ffffff;
  filter: drop-shadow(-3px 0 2px rgba(0, 0, 0, 0.1));
  animation: tourBounceLeft 1.5s ease-in-out infinite;
}

/* Arrow pointing RIGHT (when popup is to the LEFT of element) */
.tour-arrow-right {
  right: -14px;
  border-top: 12px solid transparent;
  border-bottom: 12px solid transparent;
  border-left: 14px solid #ffffff;
  filter: drop-shadow(3px 0 2px rgba(0, 0, 0, 0.1));
  animation: tourBounceRight 1.5s ease-in-out infinite;
}

/* Dark Mode Tour Styles */
[data-theme="dark"] .tour-popup {
  background: #112217;
  border-color: #1e3d29;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(34, 197, 94, 0.4);
}

[data-theme="dark"] .tour-title {
  color: #f8fafc;
}

[data-theme="dark"] .tour-body {
  color: #cbd5e1;
}

[data-theme="dark"] .tour-footer {
  border-color: #1e3d29;
}

[data-theme="dark"] .tour-prev-btn {
  background: #162c1e;
  border-color: #274b34;
  color: #cbd5e1;
}

[data-theme="dark"] .tour-prev-btn:hover {
  background: #1f3d2a;
}

[data-theme="dark"] .tour-arrow-top {
  border-bottom-color: #112217;
}

[data-theme="dark"] .tour-arrow-bottom {
  border-top-color: #112217;
}

[data-theme="dark"] .tour-arrow-left {
  border-right-color: #112217;
}

[data-theme="dark"] .tour-arrow-right {
  border-left-color: #112217;
}


