/* ==========================================================================
   Stepwize Contextual Guidance System Styles
   ========================================================================== */

:root {
  /* Single accent: the brand navy. Green is the completed state only. */
  --guidance-accent: #00008B;
  --guidance-accent-hover: #000070;
  --guidance-primary-light: #eef0f9;
  --guidance-primary-border: #ccd1e8;
  --guidance-success: #10b981;
  --guidance-success-light: #ecfdf5;
  --guidance-success-border: #a7f3d0;
  --guidance-success-tint: #f7fcf9;
  --guidance-text-main: #0f172a;
  --guidance-text-muted: #475569;
  --guidance-bg: #ffffff;
  --guidance-card-shadow: 0 10px 25px -5px rgba(0, 0, 139, 0.08), 0 8px 10px -6px rgba(0, 0, 139, 0.04);
  --guidance-focus-ring: 0 0 0 2px var(--guidance-bg), 0 0 0 4px var(--guidance-accent);

  /* Stacking scale. Values preserved from the original rules so the
     highlight still clears dashboard chrome. */
  --guidance-z-base: 20;
  --guidance-z-floating: 999;
  --guidance-z-highlight: 1000;
}

/* Guidance Container wrapper */
.contextual-guidance-wrapper {
  margin-bottom: 1.5rem;
  width: 100%;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  z-index: var(--guidance-z-base);
}

.contextual-guidance-wrapper.is-hidden {
  display: none !important;
}

/* Guidance Banner Card */
.guidance-banner-card {
  background: var(--guidance-bg);
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  border-left: 4px solid var(--guidance-accent);
  box-shadow: var(--guidance-card-shadow);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  position: relative;
  overflow: hidden;
  animation: guidanceSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.guidance-banner-card.is-completed {
  border-left-color: var(--guidance-success);
  background: var(--guidance-success-tint);
  border-color: var(--guidance-success-border);
}

@keyframes guidanceSlideIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Header row */
.guidance-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.guidance-badge-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.guidance-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-radius: 9999px;
  background: var(--guidance-primary-light);
  color: var(--guidance-accent);
  border: 1px solid var(--guidance-primary-border);
}

.guidance-pill.completed {
  background: var(--guidance-success-light);
  color: #047857;
  border-color: var(--guidance-success-border);
}

.guidance-pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 6px currentColor;
  animation: guidancePulseDot 2s infinite ease-in-out;
}

@keyframes guidancePulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.75; }
}

.guidance-header-actions {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.guidance-icon-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
}

.guidance-icon-btn:hover {
  background: #f1f5f9;
  color: #334155;
}

.guidance-icon-btn:active {
  transform: scale(0.92);
}

.guidance-icon-btn:focus-visible {
  outline: none;
  box-shadow: var(--guidance-focus-ring);
  color: #334155;
}

/* Main body row */
.guidance-card-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.guidance-content-left {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  flex: 1;
  min-width: 280px;
}

.guidance-icon-avatar {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--guidance-primary-light);
  color: var(--guidance-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid var(--guidance-primary-border);
}

.guidance-banner-card.is-completed .guidance-icon-avatar {
  background: var(--guidance-success-light);
  color: #047857;
  border-color: var(--guidance-success-border);
}

.guidance-text-block {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.guidance-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--guidance-text-main);
  line-height: 1.35;
  text-wrap: balance;
}

.guidance-description {
  margin: 0;
  font-size: 0.875rem;
  color: var(--guidance-text-muted);
  line-height: 1.55;
  max-width: 65ch;
  text-wrap: pretty;
}

/* Actions block */
.guidance-actions-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.guidance-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.125rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #ffffff;
  background: var(--guidance-accent);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 10px -2px rgba(0, 0, 139, 0.18);
  text-decoration: none;
  white-space: nowrap;
}

.guidance-cta-btn:hover {
  background: var(--guidance-accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 14px -2px rgba(0, 0, 139, 0.24);
  color: #ffffff;
}

.guidance-cta-btn:active {
  transform: scale(0.98);
  box-shadow: 0 2px 6px -2px rgba(0, 0, 139, 0.18);
}

.guidance-cta-btn:focus-visible {
  outline: none;
  box-shadow: var(--guidance-focus-ring);
}

.guidance-secondary-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #334155;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.guidance-secondary-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

.guidance-secondary-btn:active {
  transform: scale(0.98);
}

.guidance-secondary-btn:focus-visible {
  outline: none;
  box-shadow: var(--guidance-focus-ring);
  border-color: var(--guidance-accent);
}

/* Tip Accordion / Footer */
.guidance-tip-row {
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid #f1f5f9;
  padding: 0.5rem 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: #475569;
}

.guidance-tip-tag {
  font-weight: 600;
  color: var(--guidance-accent);
  background: var(--guidance-primary-light);
  padding: 0.125rem 0.4rem;
  border-radius: 4px;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  flex-shrink: 0;
}

.guidance-tip-text {
  flex: 1;
  font-weight: 500;
  line-height: 1.55;
  max-width: 65ch;
}

/* ==========================================================================
   Target Highlighting Animation & Spotlight
   ========================================================================== */

@keyframes guidanceHighlightPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(0, 0, 139, 0.7), 0 0 0 2px rgba(0, 0, 139, 0.9);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(0, 0, 139, 0.15), 0 0 0 4px rgba(0, 0, 139, 0.9);
    transform: scale(1.02);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(0, 0, 139, 0), 0 0 0 2px rgba(0, 0, 139, 0.9);
    transform: scale(1);
  }
}

/* No `outline: none` here — the pulse is a box-shadow, so suppressing the
   outline only ever removed the focus ring of a highlighted control. */
.guidance-target-highlighted {
  position: relative !important;
  z-index: var(--guidance-z-highlight) !important;
  animation: guidanceHighlightPulse 1.4s ease-in-out infinite !important;
  transition: all 0.25s ease !important;
}

/* Minimized Floating Trigger Pill */
.guidance-floating-pill {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--guidance-accent);
  color: #ffffff;
  padding: 0.625rem 1rem;
  border-radius: 9999px;
  box-shadow: 0 10px 20px -3px rgba(0, 0, 139, 0.28), 0 4px 6px -4px rgba(0, 0, 139, 0.16);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  z-index: var(--guidance-z-floating);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  animation: guidancePillFloat 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.guidance-floating-pill:hover {
  background: var(--guidance-accent-hover);
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 14px 24px -3px rgba(0, 0, 139, 0.34);
}

.guidance-floating-pill:active {
  transform: translateY(0) scale(0.98);
}

.guidance-floating-pill:focus-visible {
  outline: none;
  box-shadow: var(--guidance-focus-ring), 0 10px 20px -3px rgba(0, 0, 139, 0.28);
}

@keyframes guidancePillFloat {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Mobile Responsiveness */
@media (max-width: 640px) {
  .guidance-banner-card {
    padding: 1rem;
  }
  
  .guidance-card-body {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }
  
  .guidance-actions-group {
    width: 100%;
    justify-content: stretch;
  }

  .guidance-cta-btn,
  .guidance-secondary-btn {
    flex: 1;
    justify-content: center;
  }

  .guidance-floating-pill {
    bottom: 16px;
    right: 16px;
    padding: 0.5rem 0.875rem;
    font-size: 0.8125rem;
  }
}

/* Reduced motion: drop the two indefinite loops, keep the affordances they
   carried as static state. */
@media (prefers-reduced-motion: reduce) {
  .guidance-banner-card,
  .guidance-floating-pill,
  .guidance-pill-dot {
    animation: none;
  }

  .guidance-pill-dot {
    box-shadow: none;
  }

  .guidance-target-highlighted {
    animation: none !important;
    box-shadow: 0 0 0 2px rgba(0, 0, 139, 0.9) !important;
  }

  .contextual-guidance-wrapper *,
  .contextual-guidance-wrapper {
    transition-duration: 0.01ms !important;
  }

  .guidance-cta-btn:hover,
  .guidance-cta-btn:active,
  .guidance-secondary-btn:active,
  .guidance-icon-btn:active,
  .guidance-floating-pill:hover,
  .guidance-floating-pill:active {
    transform: none;
  }
}
