/* DOREVA v2 — Info Bubble Component
   Contextual help system: inline tooltips, card-level info, guidance bars.
   Pure CSS hover with JS click-to-toggle for mobile/touch. */

/* ── Inline Info Bubble (the (i) icon) ── */
.info-bubble {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--blue-light);
  border: 1.5px solid var(--blue);
  color: var(--blue);
  cursor: help;
  position: relative;
  vertical-align: middle;
  margin-left: 6px;
  flex-shrink: 0;
  transition: transform 0.15s ease, background 0.15s ease;
}

.info-bubble svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.info-bubble:hover,
.info-bubble:focus {
  transform: scale(1.1);
  background: rgba(37, 99, 235, 0.15);
  outline: none;
}

/* ── Tooltip (the popover content) ── */
.info-tooltip {
  position: absolute;
  z-index: 1000;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--sidebar-bg);
  color: #e8edf2;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.55;
  padding: 14px 16px;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2), 0 2px 8px rgba(0, 0, 0, 0.1);
  max-width: 320px;
  min-width: 200px;
  width: max-content;
  white-space: normal;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

/* Arrow */
.info-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--sidebar-bg);
}

/* Show on hover / focus / active */
.info-bubble:hover .info-tooltip,
.info-bubble:focus .info-tooltip,
.info-bubble.active .info-tooltip {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* ── Tooltip Title ── */
.info-tooltip-title {
  display: flex;
  align-items: center;
  gap: 5px;
  text-transform: uppercase;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--blue);
  margin-bottom: 6px;
}

.info-tooltip-title svg {
  width: 12px;
  height: 12px;
}

/* ── Position Modifiers ── */

/* Below the element */
.tooltip-below .info-tooltip {
  bottom: auto;
  top: calc(100% + 10px);
}
.tooltip-below .info-tooltip::after {
  top: auto;
  bottom: 100%;
  border-top-color: transparent;
  border-bottom-color: var(--sidebar-bg);
}

/* Left-aligned (for elements near right edge) */
.tooltip-left .info-tooltip {
  left: auto;
  right: -8px;
  transform: none;
}
.tooltip-left .info-tooltip::after {
  left: auto;
  right: 16px;
  transform: none;
}

/* Right-aligned (for elements near left edge) */
.tooltip-right .info-tooltip {
  left: -8px;
  right: auto;
  transform: none;
}
.tooltip-right .info-tooltip::after {
  left: 16px;
  right: auto;
  transform: none;
}

/* ── Card-Level Info Bubble (always visible) ── */
.info-bubble-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  background: var(--blue-light);
  border-left: 3px solid var(--blue);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 20px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.info-bubble-card .card-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  color: var(--blue);
  margin-top: 1px;
}

.info-bubble-card .card-icon svg {
  width: 20px;
  height: 20px;
}

.info-bubble-card .card-text {
  flex: 1;
  min-width: 0;
}

/* ── Journey Layout Overflow Fix ── */
/* These containers use overflow:hidden for layout,
   but tooltips need to escape them. */
.workspace {
  overflow: visible;
}
.workspace-body {
  overflow: visible;
}

/* ── Journey Bar Overrides ── */
/* Smaller bubble icon to fit the compact 56px bar */
.journey-bar .info-bubble {
  width: 15px;
  height: 15px;
  margin-left: 4px;
  border-width: 1px;
}
.journey-bar .info-bubble svg {
  width: 11px;
  height: 11px;
}

/* Let tooltips overflow the fixed-height bar */
.journey-bar {
  overflow: visible;
}
.journey-bar-inner {
  overflow: visible;
}
.jb-step {
  overflow: visible;
}
.jb-deadline {
  overflow: visible;
}

/* Tooltip positioned below + left-aligned for deadline chip near right edge */
.jb-deadline .info-bubble.tooltip-below .info-tooltip {
  left: auto;
  right: -8px;
  transform: none;
}
.jb-deadline .info-bubble.tooltip-below .info-tooltip::after {
  left: auto;
  right: 16px;
  transform: none;
}

/* ── Accessibility ── */
@media (prefers-reduced-motion: reduce) {
  .info-bubble {
    transition: none;
  }
  .info-tooltip {
    transition: none;
  }
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .info-tooltip {
    max-width: 260px;
    min-width: 180px;
    font-size: 12.5px;
    padding: 12px 14px;
  }

  .info-bubble-card {
    padding: 12px 14px;
    font-size: 13px;
  }

  /* On mobile, prevent tooltips from overflowing viewport */
  .info-bubble {
    position: static;
  }
  .info-bubble .info-tooltip {
    position: fixed;
    bottom: auto;
    left: 16px;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    max-width: none;
    width: auto;
    border-radius: var(--radius-sm);
  }
  .info-bubble .info-tooltip::after {
    display: none;
  }
}
