/* ==========================================================================
   BLUE SEA MATRIX AI — COMPANION AGENT (FLOATING DESKTOP & WEB AVATAR)
   ========================================================================== */

:root {
  --comp-primary: #38bdf8;
  --comp-primary-glow: rgba(56, 189, 248, 0.4);
  --comp-accent: #0284c7;
  --comp-bg: rgba(10, 16, 32, 0.94);
  --comp-card: rgba(18, 26, 48, 0.85);
  --comp-border: rgba(56, 189, 248, 0.25);
  --comp-text: #f8fafc;
  --comp-text-dim: #94a3b8;
  --comp-emerald: #10b981;
  --comp-amber: #f59e0b;
}

/* Floating Figure Container (Bottom Right) - Hidden by default for clean luxury interface */
#blueSeaCompanionWrapper {
  position: fixed;
  bottom: 24px;
  right: 28px;
  z-index: 99999;
  display: none;
  flex-direction: column;
  align-items: flex-end;
  font-family: 'Outfit', 'Plus Jakarta Sans', sans-serif;
  pointer-events: none;
}

#blueSeaCompanionWrapper.active {
  display: flex !important;
}

#blueSeaCompanionWrapper * {
  pointer-events: auto;
}

/* Floating Avatar Figure Button */
.companion-figure-btn {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #1e293b, #090d16);
  border: 2px solid var(--comp-border);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 24px var(--comp-primary-glow);
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  animation: companionFloat 3.8s ease-in-out infinite;
  outline: none;
  user-select: none;
}

.companion-figure-btn:hover {
  transform: scale(1.1) translateY(-4px);
  border-color: var(--comp-primary);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7), 0 0 35px rgba(56, 189, 248, 0.6);
}

.companion-figure-btn:active {
  transform: scale(0.96);
}

/* Pulsing Energy Aura */
.companion-energy-ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1.5px dashed rgba(56, 189, 248, 0.5);
  animation: companionRotate 12s linear infinite;
  pointer-events: none;
}

.companion-pulse-glow {
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.25) 0%, transparent 70%);
  animation: companionPulse 2.4s ease-in-out infinite;
  pointer-events: none;
}

/* Cute Holographic Cyber-Figure Graphic */
.companion-svg-avatar {
  width: 52px;
  height: 52px;
  filter: drop-shadow(0 2px 8px rgba(56, 189, 248, 0.5));
  transition: transform 0.3s ease;
}

.companion-figure-btn:hover .companion-svg-avatar {
  transform: rotate(5deg) scale(1.05);
}

/* Visor Glowing Eyes Blink */
.comp-eye {
  animation: eyeBlink 4.5s infinite;
  transform-origin: center;
}

/* Floating Interactive Speech Bubble */
.companion-speech-bubble {
  position: absolute;
  bottom: 84px;
  right: 4px;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(16px);
  border: 1px solid var(--comp-border);
  color: var(--comp-text);
  padding: 10px 16px;
  border-radius: 16px;
  border-bottom-right-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5), 0 0 15px rgba(56, 189, 248, 0.2);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: bottom right;
  opacity: 0;
  transform: scale(0.8) translateY(10px);
  pointer-events: none;
}

.companion-speech-bubble.visible {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: auto;
}

.bubble-badge {
  background: linear-gradient(135deg, #38bdf8, #0284c7);
  color: #000;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 6px;
  text-transform: uppercase;
}

/* ==========================================================================
   COMPANION CONSOLE / TASK DRAWER
   ========================================================================== */
.companion-console {
  position: fixed;
  bottom: 106px;
  right: 28px;
  width: 440px;
  max-width: calc(100vw - 36px);
  height: 600px;
  max-height: calc(100vh - 130px);
  background: var(--comp-bg);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border: 1px solid var(--comp-border);
  border-radius: 24px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.75), 0 0 45px rgba(56, 189, 248, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 99998;
  opacity: 0;
  transform: scale(0.92) translateY(20px);
  pointer-events: none;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.companion-console.open {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: auto;
}

/* Console Header */
.console-header {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.08) 0%, transparent 100%);
}

.console-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.console-mini-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(2, 132, 199, 0.3));
  border: 1px solid var(--comp-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.console-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--comp-text);
  display: flex;
  align-items: center;
  gap: 6px;
}

.console-status-pill {
  font-size: 11px;
  color: var(--comp-emerald);
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
}

.comp-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--comp-emerald);
  box-shadow: 0 0 8px var(--comp-emerald);
  animation: compPulse 2s infinite;
}

.console-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.console-icon-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--comp-text-dim);
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.console-icon-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--comp-text);
}

/* Quick Action Chips Bar */
.console-quick-actions {
  display: flex;
  gap: 8px;
  padding: 12px 18px;
  overflow-x: auto;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.25);
  scrollbar-width: none;
}

.console-quick-actions::-webkit-scrollbar {
  display: none;
}

.action-chip {
  flex-shrink: 0;
  padding: 6px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--comp-text-dim);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.action-chip:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: var(--comp-primary);
  color: var(--comp-primary);
  transform: translateY(-1px);
}

/* Console Message & Task Body */
.console-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.console-body::-webkit-scrollbar {
  width: 4px;
}

.console-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
}

/* Welcome Card */
.comp-welcome-card {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.1), rgba(15, 23, 42, 0.6));
  border: 1px solid var(--comp-border);
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.comp-welcome-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--comp-text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.comp-welcome-desc {
  font-size: 12px;
  color: var(--comp-text-dim);
  line-height: 1.5;
}

/* Task Progression Timeline Card */
.task-timeline-card {
  background: var(--comp-card);
  border: 1px solid var(--comp-border);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: fadeIn 0.3s ease;
}

.task-timeline-header {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--comp-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.task-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--comp-text-dim);
}

.task-step.active {
  color: var(--comp-text);
  font-weight: 600;
}

.task-step.done {
  color: var(--comp-emerald);
}

.step-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  background: rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
  margin-top: 1px;
}

.task-step.active .step-icon {
  background: var(--comp-primary);
  color: #000;
  box-shadow: 0 0 10px var(--comp-primary);
}

.task-step.done .step-icon {
  background: var(--comp-emerald);
  color: #000;
}

/* Target Restaurant Scout Cards */
.scout-result-item {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.2s;
}

.scout-result-item:hover {
  border-color: var(--comp-primary);
  background: rgba(15, 23, 42, 0.95);
}

.scout-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.scout-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--comp-text);
}

.scout-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.scout-meta {
  font-size: 11px;
  color: var(--comp-text-dim);
  display: flex;
  gap: 12px;
}

.scout-actions {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.scout-btn {
  flex: 1;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: var(--comp-primary);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.2s;
  text-decoration: none;
}

.scout-btn:hover {
  background: var(--comp-primary);
  color: #000;
}

/* Chat Messages in Companion */
.comp-msg {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.5;
  max-width: 90%;
  word-break: break-word;
  animation: fadeIn 0.25s ease;
}

.comp-msg.user {
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: #ffffff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.comp-msg.assistant {
  background: var(--comp-card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--comp-text);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

/* Console Input Bar */
.console-input-bar {
  padding: 14px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(10, 16, 32, 0.98);
  display: flex;
  align-items: center;
  gap: 10px;
}

.console-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 10px 14px;
  color: #ffffff;
  font-size: 13px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s;
}

.console-input:focus {
  border-color: var(--comp-primary);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.25);
}

.console-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, #38bdf8, #0284c7);
  border: none;
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  flex-shrink: 0;
}

.console-send-btn:hover {
  transform: scale(1.06);
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.6);
}

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

/* Animations */
@keyframes companionFloat {
  0%, 100% {
    transform: translateY(0px) rotate(0deg);
  }
  50% {
    transform: translateY(-8px) rotate(-1.5deg);
  }
}

@keyframes companionPulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.3;
  }
  50% {
    transform: scale(1.15);
    opacity: 0.7;
  }
}

@keyframes companionRotate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes compPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

@keyframes eyeBlink {
  0%, 94%, 98%, 100% {
    transform: scaleY(1);
  }
  96% {
    transform: scaleY(0.1);
  }
}

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

/* Mobile Responsiveness */
@media (max-width: 640px) {
  #blueSeaCompanionWrapper {
    bottom: 18px;
    right: 18px;
  }
  .companion-figure-btn {
    width: 60px;
    height: 60px;
  }
  .companion-svg-avatar {
    width: 42px;
    height: 42px;
  }
  .companion-console {
    bottom: 88px;
    right: 12px;
    left: 12px;
    width: auto;
    max-width: none;
    height: 75vh;
  }
}
