/* ==========================================================================
   Floating Reference Cards
   Draggable, closable, stackable entity cards for quick reference.
   ========================================================================== */

.floating-card-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2000;
}

.floating-card {
  position: absolute;
  pointer-events: auto;
  width: 320px;
  max-height: 400px;
  background: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ---------- Header (drag handle) ---------- */

.floating-card-header {
  cursor: grab;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border-primary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-secondary);
  user-select: none;
  flex-shrink: 0;
}

.floating-card-header:active {
  cursor: grabbing;
}

.floating-card-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  min-width: 0;
}

.floating-card-title > span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.floating-card-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0 0.25rem;
  line-height: 1;
  flex-shrink: 0;
}

.floating-card-close:hover {
  color: var(--text-primary);
}

/* ---------- Body ---------- */

.floating-card-body {
  padding: 0.75rem;
  overflow-y: auto;
  flex: 1;
  font-size: 0.85rem;
  min-height: 0;
}

.floating-card-body p {
  margin: 0 0 0.5rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.floating-card-body .badge {
  font-size: 0.7rem;
}

.fc-type-badge {
  font-size: 0.65rem;
}

/* ---------- Field rows ---------- */

.fc-field {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.fc-field-label {
  color: var(--text-muted);
  font-size: 0.8rem;
  flex-shrink: 0;
}

.fc-field-value {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.fc-stat-summary {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-top: 0.35rem;
  padding-top: 0.35rem;
  border-top: 1px solid var(--border-primary);
}

/* ---------- Image in cards ---------- */

.fc-image {
  width: 100%;
  max-height: 120px;
  object-fit: cover;
  border-radius: 4px;
  margin-bottom: 0.5rem;
}

/* ---------- Clock visual ---------- */

.fc-clock-visual {
  display: flex;
  gap: 3px;
  margin: 0.5rem 0;
}

.fc-clock-segment {
  width: 20px;
  height: 20px;
  border: 2px solid var(--text-muted);
  border-radius: 3px;
  background: transparent;
}

.fc-clock-filled {
  background: var(--accent-red);
  border-color: var(--accent-red);
}

/* ---------- Entity link styling ---------- */

.entity-link {
  color: var(--info);
  cursor: pointer;
  text-decoration: underline dotted;
}

.entity-link:hover {
  text-decoration: underline solid;
  color: #93c5fd;
}

/* ---------- Quick view button ---------- */

.quick-view-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.1rem 0.3rem;
  line-height: 1;
  vertical-align: middle;
}

.quick-view-btn:hover {
  color: var(--info);
}

/* ---------- Responsive: full-width on small screens ---------- */

@media (max-width: 480px) {
  .floating-card {
    width: calc(100vw - 2rem);
    left: 1rem !important;
  }
}
