/**
 * COSAS3D — 3D Printer Head FAQ Assistant
 * Pure CSS/SVG construction representing a precision dual-gear extruder print head
 * with digital expressive display, heated block silicone sock, and brass nozzle.
 */

.print-head-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: var(--z-assistant);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  pointer-events: none;
}

.print-head-widget > * {
  pointer-events: auto;
}

/* 1. Print Head Character Button */
.print-head-character {
  width: 68px;
  height: 80px;
  cursor: pointer;
  position: relative;
  transition: transform var(--transition-fast), filter var(--transition-fast);
  filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.45));
  animation: head-float 4s ease-in-out infinite;
}

.print-head-character:hover {
  transform: translateY(-4px) scale(1.05);
  filter: drop-shadow(0 12px 28px rgba(255, 90, 31, 0.35));
}

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

/* SVG Internal Components */
.head-housing {
  fill: #16181e;
  stroke: #2e3440;
  stroke-width: 1.5;
}

.head-heatsink {
  fill: #222631;
}

.head-orange-accent {
  fill: var(--color-accent-orange);
}

.head-screen-bg {
  fill: #090a0d;
  stroke: #1f232b;
  stroke-width: 1;
}

/* Digital Expressive Eyes */
.head-digital-eye {
  fill: #4fd1c5;
  filter: drop-shadow(0 0 3px #38b2ac);
  transform-origin: center;
  animation: eye-blink 4.5s infinite ease-in-out;
}

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

.head-nozzle {
  fill: #d4a359; /* Brass nozzle */
  stroke: #a87932;
  stroke-width: 1;
}

.head-status-led {
  fill: var(--color-accent-orange);
  animation: led-pulse 2s infinite ease-in-out;
}

@keyframes led-pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; filter: drop-shadow(0 0 4px var(--color-accent-orange)); }
}

/* Mini Telemetry Pill */
.print-head-telemetry {
  position: absolute;
  top: -12px;
  right: 0;
  background-color: rgba(14, 16, 19, 0.9);
  border: 1px solid rgba(255, 90, 31, 0.4);
  color: var(--color-accent-orange);
  font-family: var(--font-family-mono);
  font-size: 0.65rem;
  font-weight: var(--fw-bold);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: all var(--transition-fast);
}

.print-head-character:hover .print-head-telemetry {
  opacity: 1;
  transform: translateY(0);
}

/* 2. Speech Bubble Greeting */
.assistant-speech-bubble {
  width: 320px;
  background-color: var(--color-bg-surface);
  border: 1px solid var(--color-border-medium);
  border-radius: var(--radius-md);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.5), 0 0 1px 1px rgba(255, 255, 255, 0.08);
  padding: var(--space-lg);
  margin-bottom: var(--space-sm);
  position: relative;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) scale(0.96);
  transition: opacity var(--transition-normal), transform var(--transition-normal), visibility var(--transition-normal);
}

.assistant-speech-bubble.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Speech Triangle Pointer */
.assistant-speech-bubble::after {
  content: "";
  position: absolute;
  bottom: -8px;
  right: 28px;
  width: 14px;
  height: 14px;
  background-color: var(--color-bg-surface);
  border-right: 1px solid var(--color-border-medium);
  border-bottom: 1px solid var(--color-border-medium);
  transform: rotate(45deg);
}

.bubble-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-xs);
}

.bubble-title {
  font-family: var(--font-family-mono);
  font-size: 0.775rem;
  color: var(--color-accent-orange);
  font-weight: var(--fw-bold);
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.bubble-close-btn {
  color: var(--color-text-muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.bubble-close-btn:hover {
  color: var(--color-text-primary);
}

.bubble-text {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  line-height: 1.45;
  margin-bottom: var(--space-md);
  white-space: pre-line;
}

.bubble-actions {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

/* 3. Interactive FAQ Modal / Dialog */
.faq-dialog-card {
  max-width: 640px;
}

.faq-header-avatar {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.faq-head-mini-icon {
  width: 44px;
  height: 52px;
  flex-shrink: 0;
}

.faq-accordion-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

.faq-item {
  background-color: var(--color-bg-canvas);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color var(--transition-fast);
}

.faq-item:hover {
  border-color: var(--color-border-medium);
}

.faq-item.is-open {
  border-color: var(--color-accent-orange);
}

.faq-question-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  font-family: var(--font-family-display);
  font-size: 0.95rem;
  font-weight: var(--fw-semibold);
  color: var(--color-text-primary);
  text-align: left;
  cursor: pointer;
}

.faq-chevron {
  transition: transform var(--transition-normal);
  color: var(--color-text-muted);
}

.faq-item.is-open .faq-chevron {
  transform: rotate(180deg);
  color: var(--color-accent-orange);
}

.faq-answer-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-normal);
  background-color: rgba(0, 0, 0, 0.2);
}

.faq-item.is-open .faq-answer-body {
  max-height: 300px;
}

.faq-answer-inner {
  padding: var(--space-md) var(--space-lg) var(--space-lg) var(--space-lg);
  color: var(--color-text-secondary);
  font-size: 0.9rem;
  line-height: 1.55;
  border-top: 1px solid var(--color-border-subtle);
}

.faq-contact-box {
  margin-top: var(--space-xl);
  padding: var(--space-md) var(--space-lg);
  background-color: var(--color-bg-surface-elevated);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  font-size: 0.85rem;
}

/* Reduced Motion Override */
@media (prefers-reduced-motion: reduce) {
  .print-head-character {
    animation: none;
  }
  .head-digital-eye {
    animation: none;
  }
  .head-status-led {
    animation: none;
  }
}
